/admin)kubasobecki/incenta (private), deploy files in deploy/ghcr.io/kubasobecki/incenta:<tag> (private package, tag = short commit SHA of main)web + incenta_internal/opt/stack/incenta/websecure, certresolver le, middleware secure-headers.github/workflows/deploy.yml): every merge to main builds the image and deploys it over SSH as deploy (since 2026-09-30)| Container | Image | Networks | Purpose |
|---|---|---|---|
incenta-app |
ghcr.io/kubasobecki/incenta:$INCENTA_TAG |
web, incenta_internal |
Next.js + Payload 3 (app, admin, API) |
incenta-jobs |
same image, JOBS_AUTORUN=true |
incenta_internal, incenta_egress |
Payload jobs queue (emails); no Traefik |
incenta-db |
postgres:17-alpine | incenta_internal |
Database |
Volumes: incenta_db-data (Postgres), incenta_media (uploads, /app/media).
| File | Contents |
|---|---|
compose.yml |
Copy of deploy/compose.yml from the repo |
.env |
INCENTA_TAG, DATABASE_URL, PAYLOAD_SECRET, Resend keys, SENTRY_DSN (GlitchTip project eventKit) (mode 600) |
.env.db |
POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB (mode 600) |
backups/ |
Daily pg_dump files (mode 700) |
deploy.log |
One line per deploy: time, old tag → new tag, ok / rolled back |
Secrets were generated on the server with openssl rand -hex and exist only there (and in Restic backups).
incenta-db, not db. The app is also on the shared web network, where authentik-db-1 has the service alias db. Using db in DATABASE_URL resolves to the Authentik database and fails with password authentication failed. Any new stack whose app joins web must use a unique DB hostname.incenta_internal is internal: true: the database has no outbound internet access and is not reachable from web.POSTGRES_PASSWORD in .env.db is read only on the first start (empty volume). To change it later: ALTER USER in Postgres, then update both .env.db and .env.prodMigrations run on the first HTTP request, not at container start. Check logs for Migrated:./admin/create-first-user is open to anyone. Create the admin right after a fresh deploy (new certificates appear in CT logs and bots arrive within minutes).mem_limit: 1g on the app container.docker login ghcr.io as root with a classic PAT, scope read:packages only. Expires 2027-09-30. Credentials in /root/.docker/config.json.mail.enclari.com; queued and sent by incenta-jobs (docker logs incenta-jobs).Flow: merge to main → workflow deploy: check (tsc + lint, also on every PR) → build (push ghcr.io/kubasobecki/incenta:<7-char sha>, Actions has Write access to the package) → deploy (ssh deploy@91.98.38.241 <tag>).
deploy user: not in the docker group. ~deploy/.ssh/authorized_keys has a forced command (restrict,command="sudo /usr/local/bin/incenta-deploy \"$SSH_ORIGINAL_COMMAND\""), so whatever the client sends becomes an argument of the script. Sudoers: /etc/sudoers.d/incenta-deploy (only this script)./usr/local/bin/incenta-deploy <tag> (root, 755; source: deploy/incenta-deploy in the repo): accepts only ^[0-9a-f]{7,40}$, lock via flock, pulls before touching .env, sets INCENTA_TAG, up -d app, waits up to 150 s for /api/health (since 2026-10-14; before: /admin), on failure restores the previous tag and exits 1 (the workflow turns red).DEPLOY_SSH_KEY (private key, exists only there), DEPLOY_HOST, DEPLOY_KNOWN_HOSTS (pinned ed25519 host key).authorized_keys (keep the restrict,command=... prefix) and the DEPLOY_SSH_KEY secret.compose.yml on the server is still updated by hand when deploy/compose.yml changes.GET /api/health (public): 200 {"db":"ok","queue":"ok"}; "queue":"late" = an email waiting over 10 min (jobs container down or stuck), still 200 so it never rolls back a deploy; 503 {"db":"down"} without the database."queue":"ok" every 60 s (/apps/uptime-kuma). Better Stack: same URL from outside, every 3 min.app and jobs send server errors to GlitchTip (/apps/glitchtip) when SENTRY_DSN is set; query strings, cookies and bodies are stripped (links carry tokens). Release = INCENTA_TAG.&& curl ... /api/push/<token>).Tag: service=incenta (auto-discovered by backup.sh: /opt/stack/incenta + volumes incenta_*).
/root/backup.sh backup incenta
/root/backup.sh list incenta
Daily pg_dump at 3:40 AM (cron), 7-day local retention:
40 3 * * * docker exec incenta-db pg_dump -U incenta incenta > /opt/stack/incenta/backups/incenta_$(date +\%Y\%m\%d).sql && find /opt/stack/incenta/backups -name "*.sql" -mtime +7 -delete && curl -fsS -m 10 --retry 3 https://uptime.enclari.com/api/push/<token> > /dev/null
Restic copies the incenta_db-data files of a running database, which may be inconsistent. Restore the database from the SQL dump in backups/ (included in every Restic snapshot).
cd /opt/stack/incenta && docker compose stop app
docker exec incenta-db psql -U incenta -d incenta -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public;'
docker exec -i incenta-db psql -U incenta -d incenta < backups/incenta_YYYYMMDD.sql
docker compose up -d
# Deploy / roll back to any tag (same script as CI, with health check and auto-rollback)
sudo /usr/local/bin/incenta-deploy <sha>
# Deploy history
cat /opt/stack/incenta/deploy.log
# Logs
docker compose logs -f app
# Health
curl -s https://incenta.enclari.com/api/health
docker compose ps
# DB shell
docker exec -it incenta-db psql -U incenta -d incenta