Skip to content

Production

Queue Workers

The app uses three queues that need workers:

QueuePurpose
defaultGeneral jobs (geocoding, webhook processing)
oosOut-of-stock subscription processing
notificationsEmail notifications (back-in-stock alerts)

Running Workers

Single worker processing all queues:

bash
php artisan queue:work --queue=default,oos,notifications --tries=3

Or dedicated workers per queue for better isolation:

bash
php artisan queue:work --queue=default --tries=3
php artisan queue:work --queue=oos --tries=3
php artisan queue:work --queue=notifications --tries=3

TIP

In production, use a process manager (systemd, Supervisor) to keep workers running and auto-restart on failure.

Horizon

The app includes Laravel Horizon for queue monitoring and management.

Dashboard

Horizon's dashboard is available at /horizon (access controlled via a Gate). It provides:

  • Real-time job monitoring
  • Failed job management
  • Queue metrics and throughput
  • Worker status

Configuration

Horizon is configured in config/horizon.php. Key settings:

  • Supervisor blocks with queue assignments
  • Balancing strategy
  • Min/max processes per supervisor
  • Job timeout and retry settings

Metrics

Schedule the snapshot command for Horizon metrics:

bash
php artisan horizon:snapshot

Add to the scheduler or cron for regular metric collection.

Scheduler

Add to your server's crontab:

* * * * * cd /path/to/app && php artisan schedule:run >> /dev/null 2>&1

Scheduled Tasks

CommandSchedulePurpose
webhook:cleanup --days=30DailyPurge old webhook event records
data:purgeDailyGDPR-compliant data cleanup
bundles:cleanupPeriodicRemove orphaned discounts
bundles:healthPeriodicMonitor discount status
bundles:refresh-anchorsPeriodicRefresh anchor cache

Bundle commands only run when SHOPIFY_FEATURE_BUNDLES is enabled.

Health Checks

The app uses Spatie Laravel Health for monitoring.

Endpoint

GET /health — returns the current health status.

Checks

Configure health checks in app/Providers/HealthServiceProvider.php. Typical checks include:

  • Database connectivity
  • Redis connectivity
  • Queue worker status
  • Disk space
  • Horizon status

Error Monitoring

Flare

Flare is configured for error monitoring. Set FLARE_KEY in .env to enable.

Log Viewer

The Log Viewer package provides a web UI for browsing application logs. Access is IP-gated via a Gate definition in AppServiceProvider.

GDPR Compliance

Webhook Handlers

The app handles three GDPR compliance webhooks from Shopify:

WebhookAction
customers/data_requestReturns stored customer data (wishlists, OOS subscriptions)
customers/redactDeletes all stored data for a customer
shop/redactDeletes all stored data for a shop

Scheduled Purge

The data:purge command runs daily to remove expired data:

  • OOS subscriptions older than the configured retention period
  • Wishlist data older than the configured retention period

Use --dry-run to preview what would be deleted:

bash
php artisan data:purge --dry-run

SSL

An SSL certificate is required for the App Proxy. Shopify will not proxy requests to HTTP endpoints.

Environment Considerations

  • Set APP_ENV=production and APP_DEBUG=false
  • Configure a proper APP_URL (must match the Dev Dashboard proxy URL)
  • Use phpredis for Redis in production (better performance than predis)
  • Set appropriate CACHE_STORE=redis and SESSION_DRIVER=redis

Internal developer documentation