Guide
How to roll back a Go deployment
The dangerous part of a deploy is not shipping the new version. It is having no safe way back. Rollback works when every build is a version and the previous binary is still on disk.
Every build is a version
Phelix records each build as a numbered version with a build report and an encrypted environment snapshot. The current pointer moves only after a successful deploy, so a version that never served cannot become current by accident.
Old versions are pruned after each successful build, keeping the last five by default; the active version is never pruned. Raise retention if you want a longer history.
Rolling back
phelix rollback picks the right topology automatically: classic stop-and-start for plain builds, zero-downtime for apps deployed with blue-green or rolling. In a terminal it offers an interactive picker; with --to vN or a tag it runs non-interactively, which keeps scripts deterministic.
--dry-run previews the target, strategy, health checks, and traffic transition without changing any state. --reason records why the rollback happened, and --verify watches stability for a duration after it completes.
Safety rails
A deploy lock prevents rollback from racing another deploy or rollback on the same app, and every attempt is written to the rollback audit log. If the target fails its health check, the rollback aborts and the active instance is left untouched.
Binary and environment roll back together, so a restored version runs with the configuration it was built against rather than whatever is set now.
Frequently asked questions
Short answers; the docs go deeper.
How do I roll back a Go deployment?
Keep each build as a numbered version with its binary on disk, then restore the previous one. Phelix runs phelix rollback <app> (or --to vN) and selects the same topology the app was deployed with, so a proxy-based app rolls back without downtime.
Can I preview a rollback before running it?
Yes. phelix rollback <app> --to vN --dry-run prints the target, strategy, health checks, and traffic transition without changing any process, proxy, or deployment state.
Are environment variables restored on rollback?
Yes. Each version is paired with an encrypted environment snapshot, so rollback restores the binary and its configuration together.
One binary between git push and production.
Install the CLI, verify the host, and follow the quick start to build your first application.