From 2db764104ee5c4f2a0762d03e373996870c82201 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Thu, 29 Jan 2026 13:57:00 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Update=20deployment=20i?= =?UTF-8?q?nstructions=20with=20rollback=20procedures=20and=20script=20usa?= =?UTF-8?q?ge=20adjustments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/websites/pokedex.online/DEPLOYMENT.md | 87 +++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/code/websites/pokedex.online/DEPLOYMENT.md b/code/websites/pokedex.online/DEPLOYMENT.md index 99f505d..393bb89 100644 --- a/code/websites/pokedex.online/DEPLOYMENT.md +++ b/code/websites/pokedex.online/DEPLOYMENT.md @@ -177,7 +177,7 @@ docker compose logs ### Port Already in Use ```bash # Use different port -npm run deploy:pokedex -- --port 8081 --backend-port 3001 +./deploy.sh --target internal --port 8081 --backend-port 3001 ``` ### Backend Can't Connect to Frontend @@ -185,6 +185,91 @@ npm run deploy:pokedex -- --port 8081 --backend-port 3001 - Verify backend container is on same Docker network - Check backend service name in nginx config matches compose file +## Rollback + +### Automated Backups + +The deploy script creates timestamped backups before each deployment in `backups/`: + +```bash +# List available backups +ls -lh backups/ + +# Example: +# backup_20240115_143022.tar.gz (5.2M) +# backup_20240115_151534.tar.gz (5.3M) +``` + +The script automatically keeps only the last 5 backups to save space. + +### Rollback Procedure + +**1. Stop Current Deployment** +```bash +ssh GregRJacobs@10.0.0.81 -p 2323 +cd /volume1/docker/pokedex.online +docker compose down +``` + +**2. Restore from Backup (Local)** +```bash +# Extract backup to temporary directory +mkdir /tmp/restore +tar -xzf backups/backup_TIMESTAMP.tar.gz -C /tmp/restore + +# Copy files back +rsync -av /tmp/restore/ ./ +``` + +**3. Redeploy** +```bash +./deploy.sh --skip-tests --target internal +``` + +### Quick Restart + +If you just need to restart existing containers without code changes: + +```bash +# On the server +cd /volume1/docker/pokedex.online +docker compose restart +``` + +### Git-Based Rollback + +Roll back to a previous commit: + +```bash +# Find commit to rollback to +git log --oneline -n 10 + +# Checkout previous version +git checkout + +# Redeploy +./deploy.sh --target internal + +# Return to main branch when done +git checkout main +``` + +### Emergency Rollback + +If deployment completely fails and you need to restore quickly: + +```bash +# Stop failed deployment +ssh GregRJacobs@10.0.0.81 -p 2323 "cd /volume1/docker/pokedex.online && docker compose down" + +# Extract most recent backup directly on server +LATEST_BACKUP=$(ls -t backups/backup_*.tar.gz | head -1) +ssh GregRJacobs@10.0.0.81 -p 2323 "cd /volume1/docker/pokedex.online && tar -xzf /path/to/backup" + +# Restart containers +ssh GregRJacobs@10.0.0.81 -p 2323 "cd /volume1/docker/pokedex.online && docker compose up -d" +``` + ## URLs After Deployment ### Internal Network