Skip to main content

Runtime & Deployment

Production Execution Model

Logidav runs on a dedicated server with the following stack:

ComponentVersion / Details
PHP7.3 (CLI for commands, FPM for web)
DatabaseMySQL / MariaDB
Message brokerRabbitMQ
SchedulerSystem crontab (164 entries)
Web serverApache / Nginx with PHP-FPM

The system executes work through two parallel mechanisms:

  1. Cronjobs -- 164 scheduled commands that poll external systems and trigger processing
  2. Queue processor -- a continuous process that consumes and executes queued tasks

Process Management

Cronjob Execution with run_job.sh

All production cronjobs are wrapped in the run_job.sh shell script, which provides structured logging and monitoring:

# Crontab entry example
*/10 * * * * /path/to/run_job.sh menzzo:v2:sales
*/30 * * * * /path/to/run_job.sh menzzo:v2:sales:update
0 */2 * * * /path/to/run_job.sh menzzo:v2:products

The run_job.sh wrapper provides:

FeatureDescription
JSON loggingStructured output with fields for parsing by log aggregators
UUID per runEach execution gets a unique identifier for tracing
Status trackingStart/end timestamps, exit code, duration
Error captureStderr captured and included in the log entry
tip

The structured logging from run_job.sh makes it straightforward to search for failed runs, measure execution times, and trace issues across the 164 cronjobs. See Cron Incident Triage for debugging procedures.

Concurrency Prevention

Critical commands use LockableTrait to prevent overlapping execution. If a cron triggers while a previous instance is still running, the new instance exits immediately without processing.

Error Handling

  • Errors are logged to dedicated log files per command
  • Deadlocks and EntityManager closed errors are caught and downgraded to warnings (the next cron cycle will retry)
  • Critical failures trigger SystemAlertService notifications for operator visibility

Queue Processor

The queue processor must run continuously in production:

php bin/console meduse:queue:processor --action=runQueues

It is managed through one of:

  • Supervisor -- recommended for automatic restart on failure
  • Cron at high frequency -- alternative approach, relies on LockableTrait to prevent overlap

The processor polls the Queue table for pending tasks and executes them sequentially, grouped by run_category. See Queue Model for the full lifecycle.

danger

If the queue processor stops, async tasks (Meduse sync, marketplace updates, notification dispatch) will accumulate in the database but not execute. Monitor the process and set up alerting for restarts. See Queue Debugging for troubleshooting.

Deployment

Deployment Steps

Logidav follows a standard Symfony deployment process:

# 1. Install dependencies (no dev packages in production)
composer install --no-dev --optimize-autoloader

# 2. Apply database schema changes (no migration system)
php bin/console doctrine:schema:update --dump-sql # Review first
php bin/console doctrine:schema:update --force # Apply

# 3. Clear and warm the production cache
php bin/console cache:clear --env=prod
php bin/console cache:warmup --env=prod

# 4. Install and dump web assets
php bin/console assets:install --symlink
warning

This project does not use Doctrine migrations. Schema changes are applied directly with doctrine:schema:update --force. Always review the SQL output with --dump-sql before applying to production.

Pre-Deployment Checklist

Before deploying, run the following checks:

# Run the test suite
SYMFONY_DEPRECATIONS_HELPER=weak_vendors vendor/bin/simple-phpunit -c phpunit.xml.dist

# Run static analysis
composer phpstan

# Fix code style
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php
CheckCommandWhat It Catches
Testssimple-phpunitRegressions, broken business logic
PHPStancomposer phpstanType errors, undefined methods, missing imports
CS Fixerphp-cs-fixer fixPSR-2/PSR-12 formatting violations

CI/CD Pipeline

The Jenkins pipeline automates the pre-deployment checks. It mirrors the local tooling:

  1. Installs dependencies with composer install
  2. Runs PHPStan analysis on the PHP 8.2 shared agent
  3. Executes the test suite
  4. Reports results back to the merge request

The pipeline operates in two modes:

  • Fast mode -- runs on every push, covers linting and static analysis
  • Full mode -- runs on merge requests, includes the full test suite

See Deployment Reference for CI configuration details.

Documentation Site

The Docusaurus documentation site is deployed on Cloudflare Pages:

SettingValue
Source directoryGlobal menzzo-docs repository root
Build commandnpm run build
Output directorybuild/
URLhttps://menzzo-docs.pages.dev