Deployment
The main torq repository includes a complete setup for running torq on a small Linux VPS with automatic deployments on every push, HTTPS via Cloudflare Tunnel, and zero open web ports. This page summarizes the setup from docs/deployment.md.
Architecture & pipeline
Images report their version from git describe (for example v1.12.0-2-gabc1234 for commits after a release). A release tag (v1.12.0) runs the same checks and updates :latest and :1.12.0. Release candidates (v1.11.0-rc.1) publish :preview without touching :latest.
Components
| Component | Details |
|---|---|
| Server | Any small Linux VPS with Docker (e.g. Hetzner Cloud CAX11 ARM, ~€4/month, Ubuntu 24.04). Only inbound TCP 22 (SSH) is needed; ports 80 and 443 stay closed. |
| HTTPS & domain | A Cloudflare Tunnel (cloudflared) connects outward from the VPS to Cloudflare — no open web ports and no TLS certificates to manage. Optionally add Cloudflare Zero Trust → Access for an extra email OTP gate. |
| Stack | deploy/docker-compose.yml runs torq and cloudflared; settings live in /opt/torq/torq.env from deploy/env.example. |
| CI/CD | GitHub Actions runs the deploy job when the repository variable DEPLOY_HOST is set, using DEPLOY_USER, DEPLOY_SSH_KEY, and DEPLOY_KNOWN_HOSTS. |
Setup summary
- Create the server: Provision an
arm64oramd64Linux VPS, enable provider disk backups, and allow only SSH (TCP 22) in the firewall. - Prepare Docker & deploy user: Install Docker Engine + Compose plugin, create a
deployuser in thedockergroup with/opt/torq, and authorize a dedicateded25519deploy key. - Create a Cloudflare Tunnel: In Cloudflare Zero Trust → Networks → Tunnels, create a
cloudflaredtunnel, copy its token, and point your public hostname (e.g.torq.example.com) to HTTPtorq:8080. - Configure
/opt/torq/torq.env: Copydeploy/env.exampleto/opt/torq/torq.env(chmod 600) and setTORQ_BASE_URL,TZ, and your tunnel token. - Connect GitHub Actions: Set repository variable
DEPLOY_HOST(and optionallyDEPLOY_USER) plus secretsDEPLOY_SSH_KEYandDEPLOY_KNOWN_HOSTSunder Settings → Secrets and variables → Actions. - First start: Push to
main(or trigger the workflow). Once healthy, openhttps://torq.example.comand create the administrator account immediately.
Day-to-day operations & rollbacks
ssh deploy@<server-ip>
cd /opt/torq
docker compose ps # status and health
docker compose logs -f torq # application logs
docker compose restart torq
Every image is tagged with its commit SHA, so rolling back takes one command:
cd /opt/torq
echo "TORQ_IMAGE=ghcr.io/<owner>/torq:sha-<commit>" > .env
docker compose up -d
Database migrations only move forward. Before each upgrade, torq automatically copies the database to /data/backups/. If an older container refuses a newer database schema, restore the matching pre-upgrade backup from /data/backups/ (or a server snapshot). See Data and backups.
You don't have to use Cloudflare Tunnel or the CI/CD pipeline. Run ghcr.io/app-torq/torq:latest anywhere Docker runs and place Caddy, Nginx, or Traefik in front of it — see Installation.