Skip to content

Commit 8536f7e

Browse files
committed
Merge branch 'dev'
2 parents b5bbe00 + 3071b95 commit 8536f7e

4 files changed

Lines changed: 508 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
## ⚡ Quick Start
2222

23+
> Updating an existing installation? See [Safe Production Updates](safe-update.md).
24+
2325
**1. Install Docker** (if not installed):
2426
```bash
2527
curl -fsSL https://get.docker.com | sh

‎README.ru.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
## ⚡ Быстрый старт
2222

23+
> Нужно обновить уже установленную панель? См. [Безопасное обновление на проде](safe-update.ru.md).
24+
2325
**1. Установите Docker** (если не установлен):
2426
```bash
2527
curl -fsSL https://get.docker.com | sh

‎safe-update.md‎

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# Safe Production Updates
2+
3+
Step-by-step guide for updating C³ CELERITY on production servers with minimal downtime.
4+
5+
---
6+
7+
## 📋 Pre-Update Checklist
8+
9+
Before any update:
10+
11+
1. **Create a database backup**
12+
```bash
13+
# Via panel UI: Dashboard → Backup → Download
14+
# Or manually via mongodump:
15+
docker exec hysteria-mongo mongodump --archive=/data/db/backup.archive --username=hysteria --password --authenticationDatabase=admin
16+
docker cp hysteria-mongo:/data/db/backup.archive ./backup-$(date +%Y%m%d-%H%M%S).archive
17+
```
18+
19+
2. **Check current version**
20+
```bash
21+
docker logs hysteria-backend --tail 50 | grep -i version
22+
```
23+
24+
3. **Check available disk space**
25+
```bash
26+
df -h
27+
# Minimum 2GB free space for the new image
28+
```
29+
30+
4. **Backup your .env file**
31+
```bash
32+
cp .env .env.backup-$(date +%Y%m%d)
33+
```
34+
35+
---
36+
37+
## 🚀 Update (Docker Hub — recommended)
38+
39+
For production deployments using `docker-compose.hub.yml`:
40+
41+
### 1. Navigate to project directory
42+
43+
```bash
44+
cd /path/to/hysteria-panel
45+
```
46+
47+
### 2. Stop current containers (short downtime)
48+
49+
```bash
50+
docker compose -f docker-compose.hub.yml down
51+
```
52+
53+
> **Downtime:** ~10-30 seconds
54+
55+
### 3. Pull the new image
56+
57+
```bash
58+
docker compose -f docker-compose.hub.yml pull
59+
```
60+
61+
### 4. Start updated containers
62+
63+
```bash
64+
docker compose -f docker-compose.hub.yml up -d
65+
```
66+
67+
### 5. Check status
68+
69+
```bash
70+
# All containers should be "running"
71+
docker compose -f docker-compose.hub.yml ps
72+
73+
# Check logs for errors
74+
docker logs hysteria-backend --tail 100 -f
75+
```
76+
77+
### 6. Verify accessibility
78+
79+
```bash
80+
curl -I https://your-domain/panel
81+
```
82+
83+
---
84+
85+
## 🔧 Update (build from source)
86+
87+
For deployments using `docker-compose.yml` with local build:
88+
89+
### 1. Navigate to project directory
90+
91+
```bash
92+
cd /path/to/hysteria-panel
93+
```
94+
95+
### 2. Get latest changes
96+
97+
```bash
98+
git fetch origin
99+
git status # check for uncommitted changes
100+
git pull origin main
101+
```
102+
103+
### 3. Stop current containers
104+
105+
```bash
106+
docker compose down
107+
```
108+
109+
### 4. Rebuild the image
110+
111+
```bash
112+
docker compose build --no-cache backend
113+
```
114+
115+
> **Time:** 2-5 minutes depending on server
116+
117+
### 5. Start containers
118+
119+
```bash
120+
docker compose up -d
121+
```
122+
123+
### 6. Check status
124+
125+
```bash
126+
docker compose ps
127+
docker logs hysteria-backend --tail 100 -f
128+
```
129+
130+
---
131+
132+
## 🔄 Rollback to Previous Version
133+
134+
If problems occur after update:
135+
136+
### Option 1: Rollback to specific image version
137+
138+
1. Edit `docker-compose.hub.yml`:
139+
```yaml
140+
backend:
141+
image: clickdevtech/hysteria-panel:v1.2.3 # specify desired version
142+
```
143+
144+
2. Apply changes:
145+
```bash
146+
docker compose -f docker-compose.hub.yml down
147+
docker compose -f docker-compose.hub.yml pull
148+
docker compose -f docker-compose.hub.yml up -d
149+
```
150+
151+
### Option 2: Rollback to previous git commit
152+
153+
```bash
154+
# Find the previous working commit
155+
git log --oneline -10
156+
157+
# Checkout
158+
git checkout <commit-hash>
159+
160+
# Rebuild
161+
docker compose build --no-cache backend
162+
docker compose up -d
163+
```
164+
165+
### Option 3: Database restoration
166+
167+
```bash
168+
# Restore from backup
169+
docker cp ./backup.archive hysteria-mongo:/data/db/backup.archive
170+
docker exec hysteria-mongo mongorestore --archive=/data/db/backup.archive --drop --username=hysteria --password --authenticationDatabase=admin
171+
```
172+
173+
---
174+
175+
## ✅ After Update
176+
177+
1. **Check authentication** — login to the panel
178+
2. **Check nodes** — all nodes should show `online` status
179+
3. **Check subscriptions** — open subscription URL in browser
180+
4. **Check API** — make a test request with API key
181+
5. **Monitor logs** for 10-15 minutes:
182+
```bash
183+
docker logs hysteria-backend -f --tail 50
184+
```
185+
186+
---
187+
188+
## ⚠️ Common Issues
189+
190+
### Container won't start
191+
192+
```bash
193+
# Check logs
194+
docker logs hysteria-backend
195+
196+
# Common causes:
197+
# - Error in .env file
198+
# - MongoDB connection issue
199+
# - Out of memory
200+
```
201+
202+
### MongoDB connection fails
203+
204+
```bash
205+
# Check MongoDB status
206+
docker logs hysteria-mongo --tail 50
207+
208+
# Restart MongoDB
209+
docker compose restart mongo
210+
```
211+
212+
### SSL certificates not working
213+
214+
```bash
215+
# Check greenlock.d contents
216+
ls -la greenlock.d/
217+
218+
# Restart with cache clear
219+
docker compose down
220+
docker compose up -d
221+
```
222+
223+
---
224+
225+
## 📅 Recommended Schedule
226+
227+
| Action | Frequency |
228+
|--------|-----------|
229+
| Database backup | Daily (auto) + before updates |
230+
| Check for updates | Weekly |
231+
| Security patches | Within 48 hours |
232+
| Major updates | After staging testing |
233+
234+
---
235+
236+
## 🛡️ Best Practices
237+
238+
1. **Test on staging** — duplicate environment for update testing
239+
2. **Update during low-traffic hours** — night/early morning in users' timezone
240+
3. **Keep backups** — at least 3 recent database backups
241+
4. **Document changes** — save records of versions and update dates
242+
5. **Don't update everything at once** — panel first, then nodes if needed
243+
244+
---
245+
246+
## 📞 If Something Goes Wrong
247+
248+
1. Don't panic — data is safe in MongoDB
249+
2. Check logs: `docker logs hysteria-backend --tail 200`
250+
3. Rollback to previous version
251+
4. Restore database from backup if needed
252+
5. Create a GitHub issue with problem description and logs

0 commit comments

Comments
 (0)