Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sukarix Shell Toolbox

Introduction

The Sukarix Shell Toolbox is a Bash utility for configuring, developing, monitoring and administering a Sukarix application on its server. It lives in its own repository, sukarix/cli, and ships with the template application under tools/sukarix.sh. It targets Ubuntu 22.04 and later.

Install it once so the sukarix command is available from anywhere:

tools/sukarix.sh --selfinstall

Environment

The toolbox follows the same rule as the framework’s Boot::detectEnvironment(): APP_ENV wins when it is one of development, staging or production; otherwise a hostname ending in .test means development and anything else means production. Commands that only make sense on a server (--pull, --deploy) refuse to run outside production.

Functionality

Configuration

  • --version: Display the application, Nginx, PHP, Redis and PostgreSQL versions.
  • --selfinstall: Make sukarix runnable from anywhere.

Development

  • --enabletests: Enable running unit tests from the browser.
  • --test [-c] [name]: Run the unit tests, optionally a single group; -c adds code coverage.
  • --fix: Fix PHP code style.
  • --migrate: Run database migrations.
  • --metrics: Generate code metrics.

Monitoring

  • --check: Check configuration files and processes for problems.
  • --status: Display the running status of components.

Administration

  • --pull: Pull source code from its repository.
  • --deploy: Deploy the application on a production server.
  • --jobs: Install the cron jobs.
  • --start, --stop, --restart: Control the Sukarix stack (PostgreSQL, Redis, Nginx, PHP-FPM).
  • --clean: Clean the cache and log files.
  • --cleansessions: Clean sessions through the framework’s Sukarix\Actions\Core\SessionsClean CLI action.
  • --zip: Zip up log files for reporting an error.

Example Usage

# Display the installed versions
sukarix --version

# Enable running unit tests
sukarix --enabletests

# Run one test group with coverage
sukarix --test -c core

# Deploy on a production server
APP_ENV=production sukarix --deploy