Small infrastructure does not need careless deployments.
A single VPS may run Docker Compose behind a reverse proxy instead of a large orchestration platform. That changes the tools, but it does not remove the need for provenance, isolation, health checks, and rollback.
The deployment pattern I trust most on a modest server is intentionally plain: every release has its own directory, one stable pointer selects the active release, and the previous release remains available until the new one proves itself.
Stop treating the checkout as the release
The fragile pattern looks like this:
textssh to server -> git pull -> docker compose up -d
It hides several questions:
- Which exact commit was pulled?
- Did local changes affect the checkout?
- Did the image build from that commit?
- Which environment file was used?
- Were migrations applied?
- What files would a rollback restore?
The server checkout becomes a mutable mixture of source, deployment state, and operator history.
I prefer release directories named by immutable source identity:
text/opt/service/releases/<commit-sha>/ /opt/service/current -> /opt/service/releases/<commit-sha>/
The directory contains the deployment definition and the exact material required for that release. The current link says which release is active.
Build provenance before promotion
A release should connect four things:
textsource SHA -> image digest -> migration set -> runtime configuration version
Tags are convenient labels, but mutable tags are weak evidence. The image digest identifies the bytes actually running.
Before promotion, I record the source revision and inspect the image metadata. If the deployment process builds remotely, it should still report which source produced the image.
This prevents a common failure: testing one revision, deploying another, and referring to both as "main."
Back up before crossing a state boundary
Application files are easy to replace. Database changes are the point where rollback becomes complicated.
Before applying a migration, I want:
- A database-native backup.
- A catalog or integrity check appropriate to the backup format.
- A recorded creation time and source database.
- A known restoration procedure.
- A copy stored outside the release directory being changed.
If the migration is destructive or expensive, I also want an explicit rollback decision. Sometimes rollback means restoring the database and losing writes after the backup. Sometimes it means a forward fix. The team should know which before the incident.
Promote in a controlled order
A typical release sequence is:
textstage exact release directory -> validate configuration shape without printing secrets -> pull or verify exact images -> take and inspect backup -> apply migrations once -> start new application services -> run local health and dependency checks -> switch or confirm the active release -> run public journey checks
The order depends on compatibility. A backward-compatible migration may run before new application containers. A breaking migration may require a maintenance window or an expand-and-contract plan.
What matters is that the order is documented and repeatable.
Health is more than a running container
Docker reporting Up tells me that the process did not immediately exit. It does not tell me that the service can reach the database, read required configuration, process a job, or serve the public route through the edge.
I check from several positions:
- Inside the application container.
- From the host network.
- Through the reverse proxy.
- Through the public edge or CDN.
- Through one critical user journey.
I also inspect logs after the exact release time. Old errors should not be mistaken for evidence about the new release.
Rollback should be boring
If the application release is compatible with the current schema, rollback can be as simple as repointing current, restoring the previous Compose definition, and starting the previous image digest.
That simplicity is the reason to retain previous releases for an observation window.
Rollback becomes dangerous when operators delete the old stack immediately, reuse one mutable directory, or remove images before the new journey has been verified.
Disk cleanup is a separate maintenance task. It should not be mixed into the moment when confidence is lowest.
The old release is not a second production system
Retaining files does not mean leaving two active schedulers or workers processing the same queue.
After promotion I inspect the old services. Only the intended release should own background work, callbacks, and timers. Duplicate workers can create more damage than a failed deployment, especially around messages and financial actions.
Small systems deserve precise operations
Kubernetes is not required for deployment discipline. A release directory, immutable identity, verified backup, stable pointer, focused health gate, and retained rollback target provide a great deal of safety.
The server may be small. The state it carries and the trust users place in it are not.