Deploy: deploy.sh builds tarball, backs up current code (keep 3), deploys, restarts, health-gates 60s (ok/backend=postgres/db_ok), auto-rolls back on failure; rollback.sh restores latest backup. Rollback is code-only, DB migrations are additive-only so old code can still read new columns. Backup: restore_postgres refuses to restore into the production DB name unless explicitly allowed (drill never allows it); restore-drill.sh backs up fresh, restores to a test DB, compares tasks/projects/users/audit row counts, drops the test DB. Monitoring: worker writes heartbeat file every loop (atomic replace, failure only logged); GET /health adds worker_last_seen_seconds_ago + worker_ok (180s default, env tunable, still HTTP 200 when worker is stale); monitor.sh checks server/worker/health/pg_isready/docker-postgres/disk/ app dir as one JSON line, exit non-zero on any fail, plus systemd timer every 5 minutes. Push alerting to chat still needs a separate channel decision (SSH key or webhook URL). Multi-user: verify-multiuser.py creates test users/projects in memory-key only, checks RBAC via real HTTP API (owner/ maintainer/contributor/viewer, cross-project isolation, merge 200/403/409, no-key 401), test tasks carry a never- satisfiable dependency so the production worker never claims them, cleanup deletes only multiuser-test- rows (audit log is append-only and keeps test entries by design). Tests: host 27 pass, cloud 298 pass (8 skipped are environment-dependent real-Postgres tests).
15 lines
483 B
Desktop File
15 lines
483 B
Desktop File
[Unit]
|
|
Description=Codex cloud monitor check (one-shot)
|
|
After=network.target codex-cloud-server.service codex-cloud-worker.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=codexsvc
|
|
WorkingDirectory=/opt/codex-app-server
|
|
# monitor.sh 只做检查、不读 env 文件、不发消息;失败时 systemd 会把
|
|
# 退出码与输出记进 journal,告警通道见 deploy/README.md(另行决定)。
|
|
ExecStart=/bin/sh /opt/codex-app-server/deploy/monitor.sh
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|