2.5 KiB
2.5 KiB
Rollback
Purpose
This document describes a low-risk rollback procedure for the first-stage production deployment.
Principles
- do not delete PostgreSQL or Redis volumes during rollback;
- do not remove
.env.production; - prefer switching containers back to the last known-good image or revision;
- avoid ad-hoc schema downgrades during an incident;
- verify
/healthand login before declaring rollback complete.
Safe Rollback Procedure
- Identify the currently running revision and the last known-good revision.
- Keep a copy of the current environment file:
cp .env.production .env.production.backup
-
If the issue is configuration-only, restore the previous config file versions first:
.env.productiondeploy/nginx/server-panel.confdocker-compose.prod.yml
-
Switch the repository back to the last known-good revision.
-
Rebuild and restart the production stack without touching volumes:
docker compose \
--env-file .env.production \
-f docker-compose.prod.yml \
up --build -d
- If the rollback target expects the same additive schema, keep the migrated database in place. If a future revision introduces incompatible schema changes, restore from a database backup instead of attempting an emergency manual downgrade.
- Verify:
http://YOUR_HOST/health- frontend load at
/ - admin login
- one read-only API flow
If The New Frontend Is The Only Problem
If the backend is healthy and only the frontend is broken:
- restore the previous frontend source or image tag;
- rebuild only the frontend and reverse proxy path:
docker compose \
--env-file .env.production \
-f docker-compose.prod.yml \
up --build -d frontend reverse-proxy
- re-check
/and one authenticated UI action.
If The Backend Or Worker Is The Problem
- restore the previous backend revision;
- rebuild:
docker compose \
--env-file .env.production \
-f docker-compose.prod.yml \
up --build -d backend worker bot reverse-proxy
- verify:
/health- login
- queued action processing
Do Not Do This During Rollback
- do not run
docker compose down -v; - do not remove
postgres_data; - do not remove
redis_data; - do not delete the database to "start clean";
- do not improvise manual
ALTER TABLErollback steps on production data.
After Rollback
Capture:
- what failed;
- which revision was restored;
- whether any queued actions need manual follow-up;
- whether the reverse proxy or environment template needs a corrective update before the next deployment.