chore(deploy): systemd unit, push.sh, one-time setup notes

This commit is contained in:
root
2026-05-31 15:32:09 +10:00
parent 692f300af5
commit b5e7478158
3 changed files with 93 additions and 0 deletions

53
deploy/README.md Normal file
View File

@@ -0,0 +1,53 @@
# Deploy notes — Void 2.0
## App deploy (CT 311 — `void2-app`)
One-time setup on the target host:
```bash
# Node 22 (from nodesource if Debian's default is older)
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
# Service user + working dir
useradd -r -m -d /opt/void-server void
mkdir -p /opt/void-server
chown void: /opt/void-server
# systemd
install -m 644 void-server.service /etc/systemd/system/void-server.service
systemctl daemon-reload
systemctl enable void-server
# Secrets — /opt/void-server/.env must contain:
# DATABASE_URL=postgres://void:<password>@<db-host>:5432/void
# OWNER_TOKEN=<32+ char secret>
# PORT=3000
# NODE_ENV=production
chmod 600 /opt/void-server/.env
chown void: /opt/void-server/.env
```
Then from the dev box:
```bash
cd /project/src/void-v2
./deploy/push.sh
```
## Maintenance
```bash
journalctl -u void-server -f # follow logs
systemctl status void-server # check status
systemctl restart void-server # cycle
# Run migrations on the deployed copy:
ssh root@void2-app 'cd /opt/void-server && npm run migrate'
```
## Notes
- `.env` is excluded from the rsync to avoid clobbering production secrets with dev values.
- The push script uses `--omit=dev` to skip test deps on the target.
- `tests/` is excluded — they're for the dev environment only.