Skip to content

API deployment

Authoritative deployment runbook for the TyteRide API container. Replaces stale top-level deploy details for the API.

Host and runtime

  • Web server: CyberPanel + OpenLiteSpeed (not nginx).
  • Vhost config: /usr/local/lsws/conf/vhosts/api.tyteride.drolez-apps.cloud/vhost.conf
  • docRoot: /home/api.tyteride.drolez-apps.cloud/public_html/public
  • Deployed checkout: /home/api.tyteride.drolez-apps.cloud/public_html
  • PHP 8.3 via lsphp/lsapi; site owner apity8249.
  • Database: MariaDB 10.6.22, database tyteride.
  • Cache/queue/broadcast: Redis 127.0.0.1:6379.

Environment (.env key inventory)

Keys only; values/secrets never documented. See .env.example.

APP_ENV, APP_DEBUG, APP_URL, DB_, REDIS_, CACHE_STORE, QUEUE_CONNECTION, BROADCAST_CONNECTION, FRONTEND_URL, DASHBOARD_URL, SANCTUM_STATEFUL_DOMAINS, SESSION_, REVERB_, SMS_DRIVER, SMS_FROM, SMS_LOG_OTP_IN_PRODUCTION

Secrets (never document/copy): APP_KEY, DB_PASSWORD, REVERB_APP_KEY, REVERB_APP_SECRET, SMS_API_KEY, GOOGLE_MAPS_API_KEY, Let's Encrypt private keys.

Reverb (WebSockets)

  • systemd unit: tyteride-reverb.service
  • ExecStart: /usr/bin/php artisan reverb:start --host=127.0.0.1 --port=8080
  • OpenLiteSpeed proxies /app/ and /apps/.
  • Public WSS: api.tyteride.drolez-apps.cloud:443
  • Let's Encrypt certs: /etc/letsencrypt/live/api.tyteride.drolez-apps.cloud/

Runtime services

  • tyteride-reverb.service — Reverb WebSocket server.
  • tyteride-queue.service — php artisan queue:work (verify on host).
  • tyteride-scheduler.timer — php artisan schedule:run (verify on host).

Deploy procedure

  1. Ensure target commit is tagged vX.Y.Z.
  2. Run tests: php artisan test.
  3. Install deps (production): COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --optimize-autoloader
  4. Sync release (rsync) excluding .env, vendor/, storage/, tests/.
  5. Fix ownership: chown -R apity8249:apity8249 on deployed checkout (verify on host).
  6. Migrate: php artisan migrate --force
  7. Clear + rebuild caches:
  8. php artisan optimize:clear
  9. php artisan config:cache
  10. php artisan route:cache
  11. php artisan event:cache
  12. php artisan view:cache
  13. Restart Reverb: sudo systemctl restart tyteride-reverb.service
  14. Restart queue worker and scheduler if present (verify on host).

Seeding caveat

Only run TierSeeder in production. Never run DatabaseSeeder (creates a test user).

SMS fake warning

SMS_DRIVER=log with SMS_LOG_OTP_IN_PRODUCTION=true writes plaintext OTPs to logs. Temporary/manual testing only; disable after.

Health checks

  • API: GET /api/health → {"status":"ok"}; also /up.
  • Broadcast: POST /api/broadcasting/auth returns 401 without auth.
  • Reverb: unit active and listening on 127.0.0.1:8080.

Rollback

Restore previous release directory, then php artisan optimize:clear and rebuild caches (config/route/event/view). Restart Reverb and queue/scheduler as needed.

Secrets

Never document or copy secrets: APP_KEY, DB_PASSWORD, Reverb keys, SMS_API_KEY, GOOGLE_MAPS_API_KEY, and Let's Encrypt private keys. Use .env on host only; rotate if exposed.

Pre-deploy checks

  • php artisan test green.
  • Target commit tagged vX.Y.Z.
  • .env present on host (never committed).
  • Database backup taken (verify on host).

Post-deploy verification

  • GET /api/health returns {"status":"ok"}.
  • POST /api/broadcasting/auth returns 401 without auth.
  • Reverb unit active and listening on 127.0.0.1:8080.
  • Queue worker and scheduler running (verify on host).

Notes

  • Do not fetch or initialize apps/passenger or apps/driver on this host.
  • Deploy only tagged surface commits; never ship untagged.
  • Verify host-specific service names and sudo policy before running systemctl.