rollback¶
The fujin rollback command rolls back your application to a previous version.
Overview¶
When a deployment goes wrong, fujin rollback quickly reverts to a previous version. The command is fully interactive - it lists all available versions from the .versions/ directory, prompts you to select which version to roll back to, and handles the complete rollback process.
Fujin keeps deployment bundles in ~/.fujin/{app_name}/.versions/ as Python zipapps (.pyz files). Each bundle is a self-contained executable containing everything needed to run that version: the application code, dependencies, environment variables, systemd units, and install/uninstall scripts.
How it works¶
Here’s what happens when you run fujin rollback:
List available versions: Scans the
.versions/directory and lists available versions in reverse chronological order (most recent first).Prompt for selection: Asks you to select which version to roll back to, with the most recent version as the default.
Confirm rollback: Shows the current version and target version, and asks for confirmation before proceeding.
Uninstall current version: If a bundle exists for the current version, runs its uninstall script to cleanly remove the current deployment.
Install target version: Extracts and runs the install script from the selected version’s bundle.
Clean up newer versions: Automatically deletes all versions newer than the selected target version to prevent accidentally re-deploying a broken version.
Log operation: Records the rollback operation to the audit log with from/to version information.
Below is an example of the versions directory structure:
~/.fujin/{app_name}/.versions/
├── app-1.2.3.pyz
├── app-1.2.2.pyz
├── app-1.2.1.pyz
└── app-1.2.0.pyz
Warning
Rollback does NOT automatically revert database migrations. If your deployment included schema changes, you’ll need to handle database rollback separately - either restore from backup or manually reverse migrations using your framework’s migration tools.