feat: add stack reset helper and setup runbook

This commit is contained in:
Md Bayazid Bostame
2026-03-31 15:11:16 +02:00
parent 80cb7a409d
commit 541736a9a2
4 changed files with 141 additions and 0 deletions

View File

@@ -217,6 +217,43 @@ HEALTH_URL=http://192.168.2.55:8088/healthz/ \
./scripts/deploy_test_from_mac.sh
```
## Reset a stack from scratch
Use this only when you intentionally want a fresh environment with default bootstrap data.
What it does:
1. syncs the current checkout to the target server
2. stops the stack
3. removes compose volumes with `down -v`
4. rebuilds and bootstraps the stack again
5. verifies the health endpoint
Local test server reset:
```bash
git checkout develop
RESET_CONFIRM=RESET EXPECTED_BRANCH=develop ./scripts/reset_stack_from_mac.sh
```
Customer/TUBCO reset example:
```bash
git checkout release/tubco-v1
RESET_CONFIRM=RESET \
EXPECTED_BRANCH=release/tubco-v1 \
DEPLOY_HOST=root@<customer-host> \
DEPLOY_PATH=/opt/workdock \
REMOTE_ENV_FILE=.env.prod \
HEALTH_URL=https://portal.tub.co/healthz/ \
RUN_DJANGO_CHECK=1 \
./scripts/reset_stack_from_mac.sh
```
This is destructive. It wipes:
- database state
- generated documents/media
- staticfiles volume
- backup volume
It does not remove the server-local env file. That file must already exist.
## Manual production deployment
For production, use a dedicated helper instead of the test script.