Backend deploy
The artifact is a static musl binary — same file on EL7/EL8/ubuntu/Alpine. Deploy = binary + TOML + data dir + systemd.
# /etc/systemd/system/hakobackend.service
[Service]
User=hako
WorkingDirectory=/srv/hakobackend
ExecStart=/srv/hakobackend/hakobackend --config /srv/hakobackend/hakobackend.toml
Restart=on-failure
Checklist:
- Config: copy
hakobackend.example.toml→ setdriver/data,auth,admin_uids,rules(start frompolicy.standard.toml, deny-by-default). No secrets in the file — env only. - Data dir: owned by the service user, on a volume with headroom (alert 80%). SQLite/hako files live here.
- Smoke:
/api/ready→{"ready":true}. Then one authenticated write + read through policy (proves auth→policy→driver, not just TCP). - Reload vs restart: policy/auth/DB/limits/indexes/aliases →
POST /api/admin/reload. Port/TLS/socket → restart. - Backups: stopped file copies (or
backupsemantics) on a schedule; verify restores quarterly; monitor backup age. - Monitor:
/api/ready, disk space, backup age. Pairreadywith those three or you will learn about full disks from users.
Upgrades: download the new tarball → verify SHA → backup binary + data → atomic install → restart → smoke → rollback restores previous bytes on failure. (This is exactly what deploy-release.sh automates where present.)
Common mistakes
- Running as root with a world-writable data dir. Service user,
750dirs,640configs. Secrets in env, not files. - Skipping the authenticated smoke.
ready:truewith broken policy means “serving denials”. One authed write+read closes the loop. - Forgetting the reload port. Changing policy and waiting for it to apply without calling
/api/admin/reload— the file is read on reload, not watched.