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
|
### Automatic Updates
|
||||||
|
|
||||||
A cron-safe update script is included: `scripts/docker-update.sh`. It pulls the
|
Updating is fully scripted — no need to touch Docker or nginx by hand. The
|
||||||
latest `main`, runs CMS migrations on the host, rebuilds the image, recreates the
|
script `scripts/docker-update.sh` pulls the latest `main`, runs CMS migrations
|
||||||
container, waits for a healthy status, and makes sure the stale host-side PM2 CMS
|
on the host, rebuilds the image, recreates the container and waits for a healthy
|
||||||
(`pm2 stop next`) stays stopped so it can't clash on port 3002.
|
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
|
**Automatically (recommended):** a nightly cron job is already configured on a
|
||||||
./scripts/docker-update.sh # run once manually
|
production server that installed this setup. It runs the script every night at
|
||||||
# log: logs/docker-update.log
|
03:30 and appends to `logs/docker-update.cron.log`:
|
||||||
```
|
|
||||||
|
|
||||||
Set it up as a nightly cron job (03:30 example):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
crontab -e
|
crontab -e
|
||||||
# 30 3 * * * /var/www/atom-nexst/scripts/docker-update.sh >> /var/www/atom-nexst/logs/docker-update.cron.log 2>&1
|
# 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
|
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
|
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
|
### Docker Commands
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user