Deployment, observability, and operations
Status: Concise draft.
Deployable change shape
Section titled “Deployable change shape”A safe deployment assumes old and new processes may coexist. Use expand/contract database changes:
- Add backward-compatible schema.
- Deploy code that can operate across the transition.
- Backfill with throttling and observability.
- Switch reads/writes deliberately.
- 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.
Laravel release sequence
Section titled “Laravel release sequence”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.
Containers and state
Section titled “Containers and state”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.
Observability
Section titled “Observability”- 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.
Recovery
Section titled “Recovery”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.
Interview prompts
Section titled “Interview prompts”- 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.