docs(docker): clarify how to update (nightly cron + manual run) in README
This commit is contained in:
1 parent
fb978612d7
commit
e1ecb190bc
1 file changed
+18
-11
@@ -156,26 +156,33 @@ The CMS will be available at `http://localhost:3002`.
|
||||
|
||||
### Automatic Updates
|
||||
|
||||
A cron-safe update script is included: `scripts/docker-update.sh`. It pulls the
|
||||
latest `main`, runs CMS migrations on the host, rebuilds the image, recreates the
|
||||
container, waits for a healthy status, and makes sure the stale host-side PM2 CMS
|
||||
(`pm2 stop next`) stays stopped so it can't clash on port 3002.
|
||||
Updating is fully scripted — no need to touch Docker or nginx by hand. The
|
||||
script `scripts/docker-update.sh` pulls the latest `main`, runs CMS migrations
|
||||
on the host, rebuilds the image, recreates the container and waits for a healthy
|
||||
status. It also makes sure a stale host-side PM2 CMS (`pm2 stop next`) stays
|
||||
stopped so it can't clash on port 3002.
|
||||
|
||||
```bash
|
||||
./scripts/docker-update.sh # run once manually
|
||||
# log: logs/docker-update.log
|
||||
```
|
||||
|
||||
Set it up as a nightly cron job (03:30 example):
|
||||
**Automatically (recommended):** a nightly cron job is already configured on a
|
||||
production server that installed this setup. It runs the script every night at
|
||||
03:30 and appends to `logs/docker-update.cron.log`:
|
||||
|
||||
```bash
|
||||
crontab -e
|
||||
# 30 3 * * * /var/www/atom-nexst/scripts/docker-update.sh >> /var/www/atom-nexst/logs/docker-update.cron.log 2>&1
|
||||
```
|
||||
|
||||
**Manually** — to update right now (same steps as the cron runs):
|
||||
|
||||
```bash
|
||||
cd /var/www/atom-nexst
|
||||
./scripts/docker-update.sh
|
||||
# log: logs/docker-update.log
|
||||
```
|
||||
|
||||
The script aborts safely (exit 1) if the working tree has uncommitted changes so
|
||||
a `git pull` can never clobber local edits, and leaves the container running if
|
||||
health fails so you can debug it (exit 3).
|
||||
health fails so you can debug it (exit 3). Failed runs are reported in the log;
|
||||
an exit of 0 means the CMS is healthy on the new commit.
|
||||
|
||||
### Docker Commands
|
||||
|
||||
|
||||
Reference in new issue
Block a user