Deployment
ZeroAuth now supports a proper GitHub Actions based deployment flow for zeroauth.dev.
Current Production Topology
Production runs on a VPS at 104.207.143.14 with:
zeroauth-prodfor the Node.js API and static assetszeroauth-caddyfor HTTPS termination and reverse proxyzeroauth-postgresfor tenant, API-key, usage, and central API datazeroauth-redisfor Redis-backed runtime support
All services are orchestrated with Docker Compose in /opt/zeroauth.
CI Workflow
Workflow file: .github/workflows/ci.yml
Triggered on:
- pull requests
- pushes to non-
mainbranches
What it does:
- installs root, dashboard, and docs dependencies
- runs
npm test - runs
npm run build:all
This is the branch protection layer.
CD Workflow
Workflow file: .github/workflows/deploy.yml
Triggered on:
- pushes to
main - manual
workflow_dispatch
What it does:
- re-runs tests and builds on GitHub Actions
- opens an SSH session with the deploy key
- rsyncs the repository to
/opt/zeroauth - runs
scripts/deploy-remote.sh - validates container health and the public
/api/healthendpoint
Required GitHub Secret
Add this repository secret:
DEPLOY_SSH_KEY
The private key for the VPS deploy user is expected here. The workflow uses:
- host:
104.207.143.14 - user:
zeroauth-deploy - path:
/opt/zeroauth
Server-Side Deploy User
The server should deploy through a dedicated SSH user, not a root password.
Configured deploy user:
zeroauth-deploy
Expected capabilities:
- member of the
dockergroup - write access to
/opt/zeroauth - SSH key in
~/.ssh/authorized_keys
Remote Deploy Script
Script file: scripts/deploy-remote.sh
The remote script:
- validates Docker Compose config
- runs
docker compose --profile prod up -d --build --remove-orphans - waits for
zeroauth-prodto become healthy - calls
https://zeroauth.dev/api/health - prunes dangling Docker images
Important Build Detail
The production Docker image is now self-contained:
- backend compiled inside Docker
- dashboard built inside Docker
- Docusaurus docs built inside Docker
That means deploys no longer depend on someone manually prebuilding website/build on a laptop before syncing files to the server.
First-Time Setup Checklist
- Add
DEPLOY_SSH_KEYto GitHub repository secrets. - Ensure
/opt/zeroauth/.envexists on the VPS and is not overwritten by CI/CD. - Push to
mainor trigger the Deploy workflow manually. - Verify https://zeroauth.dev/api/health.
Recommended Hardening
- disable password SSH login once the deploy key path is confirmed
- disable direct root SSH login and keep root for break-glass only
- rotate any secret that was ever stored in-repo or shared insecurely
- add branch protection so
mainonly deploys after passing CI