Skip to content

Deployment, observability, and operations

Status: Concise draft.

A safe deployment assumes old and new processes may coexist. Use expand/contract database changes:

  1. Add backward-compatible schema.
  2. Deploy code that can operate across the transition.
  3. Backfill with throttling and observability.
  4. Switch reads/writes deliberately.
  5. Remove old schema only after no old code depends on it.

Avoid long blocking migrations in the release critical path. Understand the database’s lock/rewrite behavior for each DDL operation.

A typical release installs locked production dependencies, builds assets, runs safe migrations, warms configuration/routes/views, atomically switches release, reloads PHP-FPM as appropriate, and restarts queue workers gracefully. Exact ordering depends on compatibility and hosting.

queue:restart signals workers to exit after their current job; supervision must bring them back. Horizon termination serves a similar deployment purpose. Long jobs need sufficient termination grace.

Container images should be immutable and reproducible. Runtime state belongs in databases/object stores or explicit volumes. Do not bake secrets into image layers. Separate build-time and runtime concerns, and run as a non-root user where possible.

  • Logs explain discrete events with correlation IDs and safe structured context.
  • Metrics reveal trends, rates and saturation.
  • Traces connect latency across service boundaries.
  • Health checks answer whether a process is alive; readiness answers whether it should receive work.

Alert on user-visible symptoms and exhausted error budgets, then use diagnostic signals to locate causes. A dashboard nobody owns is not observability.

Rollback is not always safe after irreversible data changes or externally visible side effects. Prefer roll-forward capability, feature flags with cleanup ownership, tested backups and rehearsed restores. Record deployment and schema versions with incidents.

  • Deploy a required-column change without downtime.
  • Explain why code rollback after a migration may fail.
  • Design worker shutdown during a release.
  • Choose signals and alerts for a queue-backed import service.