Skip to content

Commit 37edc20

Browse files
committed
update readme
1 parent aa5a8b5 commit 37edc20

1 file changed

Lines changed: 33 additions & 12 deletions

File tree

pharia-ai-backup-restore/README.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,48 @@ psql -h localhost -p 5432 -U pharia_user -d dev -c "SELECT version();"
6363

6464
### ⬆️ Perform Upgrade
6565

66-
```bash
67-
helm upgrade pharia-ai ./pharia-ai-chart --namespace pharia-ai
68-
```
66+
Follow your standard deployment process to upgrade Pharia AI.
6967

7068
### ✅ If Upgrade Succeeds
7169

7270
Test your application and you're done!
7371

7472
### ⚠️ If Upgrade Fails: Rollback
7573

74+
> **Important:** Always stop application pods before restoring databases to prevent data corruption and ensure a clean restore.
75+
7676
```bash
77-
# 1. Restore databases
77+
# 1. Scale down application pods to prevent database writes during restore
78+
kubectl scale deployment --all --replicas=0 -n pharia-ai
79+
80+
# 2. Verify all pods are terminated
81+
kubectl get pods -n pharia-ai
82+
# Wait until no application pods are running (only database pods should remain)
83+
84+
# 3. Restore databases
7885
./bin/pharia-backup.sh db restore all
7986

80-
# 2. Restore secrets
87+
# 4. Restore secrets
8188
./bin/pharia-backup.sh secrets restore --latest -f -n pharia-ai
8289

83-
# 3. Rollback Helm deployment
84-
helm rollback pharia-ai -n pharia-ai
90+
# 5. Scale deployments back up (adjust replica counts as needed for your setup)
91+
kubectl scale deployment --all --replicas=1 -n pharia-ai
8592

86-
# 4. Verify pods are running
87-
kubectl get pods -n pharia-ai
93+
# 6. Verify pods are running and healthy
94+
kubectl get pods -n pharia-ai -w
8895
```
8996

97+
> **💡 Note:** If your deployments have different replica counts, you can scale them individually:
98+
> ```bash
99+
> kubectl scale deployment <deployment-name> --replicas=<count> -n pharia-ai
100+
> ```
101+
90102
## 📝 Common Commands
91103
92104
### 🗄️ Database Operations
93105
106+
> **💡 Tip:** Before restoring databases, always scale down your application pods to zero replicas. This prevents data corruption from concurrent writes during the restore process.
107+
94108
```bash
95109
# Backup all databases
96110
./bin/pharia-backup.sh db backup
@@ -140,13 +154,20 @@ ls -lt database-backups/ | head -3
140154
ls -lt secrets-backups/ | head -3
141155

142156
# === UPGRADE ===
143-
helm upgrade pharia-ai ./pharia-ai-v2.0 -n pharia-ai
157+
# Follow your standard deployment process
144158

145159
# === IF ROLLBACK NEEDED ===
160+
# Step 1: Stop application to prevent writes during restore
161+
kubectl scale deployment --all --replicas=0 -n pharia-ai
162+
kubectl get pods -n pharia-ai # Wait for pods to terminate
163+
164+
# Step 2: Restore data from backups
146165
./bin/pharia-backup.sh db restore all
147166
./bin/pharia-backup.sh secrets restore --latest -f -n pharia-ai
148-
helm rollback pharia-ai -n pharia-ai
149-
kubectl get pods -n pharia-ai
167+
168+
# Step 3: Bring application back online
169+
kubectl scale deployment --all --replicas=1 -n pharia-ai
170+
kubectl get pods -n pharia-ai -w # Watch pods come back up
150171
```
151172

152173
## 🔧 Troubleshooting

0 commit comments

Comments
 (0)