Laravel Cloud
Laravel Cloud is our deployment platform, replacing Laravel Vapor for hosting Laravel services. Not all projects are on Cloud yet - we're migrating incrementally.
Current State​
Services​
| Service | Status | Notes |
|---|---|---|
| farfalla | Vapor | Core monolith |
| farfalla-https-guard | Cloud | First migrated service |
| farfalla-integrations | Vapor | |
| medusa | Vapor | |
| coniglio | Hybrid | Staging on Cloud, production on Vapor |
| castoro | Vapor |
How We Deploy​
Deployments are triggered via deploy hooks from GitLab CI:
deploy:staging:
script:
- curl -X POST "$LARAVEL_CLOUD_STAGING_DEPLOY_HOOK"
deploy:production:
script:
- curl -X POST "$LARAVEL_CLOUD_PRODUCTION_DEPLOY_HOOK"
Deploy hooks are async - the curl returns immediately and the actual deployment happens in the background. No post-deploy health checks.
CI variables per project:
LARAVEL_CLOUD_STAGING_DEPLOY_HOOKLARAVEL_CLOUD_PRODUCTION_DEPLOY_HOOK
Build & Deploy Commands​
Configured in the Laravel Cloud dashboard per environment.
Build commands (typical):
composer install --no-dev --optimize-autoloader
php artisan event:cache
php artisan config:cache
php artisan route:cache
Deploy commands:
php artisan migrate --force
php artisan optimize
Custom Domains​
We point custom domains to Laravel Cloud via Cloudflare CNAME (proxy ON), then disable the default .laravel.cloud domain.
Monitoring​
Server-side PHP monitoring uses Laravel Nightwatch (auto-injected env vars by Cloud). Keep Sentry JS SDK for frontend monitoring.
Configuration Reference​
Queue Connection​
Cloud does NOT auto-set QUEUE_CONNECTION. Add QUEUE_CONNECTION=redis to env vars manually, otherwise jobs run synchronously. Symptom: Jobs not appearing in Horizon despite worker being active.
Horizon​
Cloud does NOT auto-protect Horizon (Vapor did). You must add HTTP Basic Auth middleware yourself. Also: move laravel/horizon to require (not require-dev), configure supervisors per environment, create a Worker Cluster in Cloud dashboard with php artisan horizon, and schedule horizon:snapshot for non-local environments.
Persistent DB Connections​
Config and test caveat
Enabled for better performance, but disabled in tests (breaks parallel execution and Bus::batch()):
// config/database.php
'options' => [
PDO::ATTR_PERSISTENT => app()->environment('testing') ? false : true,
],
Valkey (Redis-compatible)​
ACL auth config
Cloud uses Valkey with ACL auth. Needs both username and password:
// config/database.php, redis connection
'username' => env('REDIS_USERNAME'),
Symptom: Horizon can't connect to Valkey. Cause: Vapor didn't need a username. Cloud uses Valkey ACL requiring both.
artisan optimize​
Views directory requirement
Requires resources/views directory to exist. Create an empty one if your project doesn't have views.
Symptom: php artisan optimize fails with view:cache error.