Deploy a self-hosted server
pushq is one static binary with the dashboard included. It runs in one of two shapes:
| Shape | Use it when |
|---|---|
| Single node + SQLite | You want zero dependencies: one box, one file. Plan for up to about 500 sustained dispatches per second. |
| Several replicas + Postgres | You need high availability or more throughput. Every replica serves the API; a Postgres advisory lock elects one replica to run the dispatcher. |
Both shapes run the same binary; only the db setting changes. See the server configuration reference for every setting.
# Single node, SQLite: install the unit and config below, thensudo systemctl enable --now pushq# Two replicas on Postgres: save the compose file below, thendocker compose up -dDeploy a single node with systemd and SQLite
Section titled “Deploy a single node with systemd and SQLite”Use this when one machine is enough and you don’t want to run a database server.
[Unit]Description=pushq task queueAfter=network-online.targetWants=network-online.target
[Service]ExecStart=/usr/local/bin/pushq serve -c /etc/pushq/pushq.yamlRestart=alwaysRestartSec=2User=pushqStateDirectory=pushq# SIGTERM starts a graceful drain: in-flight deliveries get up to# dispatcher.drain_timeout (default 30s) to finish.TimeoutStopSec=45
[Install]WantedBy=multi-user.targetdb: sqlite:/var/lib/pushq/pushq.dblisten: 127.0.0.1:8080 # a reverse proxy in front terminates TLSlog: { format: json }sudo useradd --system --no-create-home pushqsudo systemctl daemon-reloadsudo systemctl enable --now pushqjournalctl -u pushq -fStateDirectory=pushq creates /var/lib/pushq owned by the pushq user. SQLite runs in WAL mode, so you’ll see pushq.db-wal and pushq.db-shm next to the database file.
Keep TimeoutStopSec above drain_timeout plus a few seconds, or systemd will kill the process before in-flight deliveries finish.
Run multiple replicas with docker-compose and Postgres
Section titled “Run multiple replicas with docker-compose and Postgres”Use this when you need the API to stay up through a crash or a deploy. All replicas serve the API; one at a time runs the dispatcher.
services: db: image: postgres:16 environment: { POSTGRES_USER: pushq, POSTGRES_PASSWORD: pushq, POSTGRES_DB: pushq } volumes: [pgdata:/var/lib/postgresql/data] healthcheck: { test: ["CMD-SHELL", "pg_isready -U pushq"], interval: 2s, retries: 30 }
pushq-a: &pushq image: ghcr.io/blissfulrays/pushq:1.0.0 # pin a version command: serve environment: PUSHQ_DB: postgres://pushq:pushq@db/pushq?sslmode=disable PUSHQ_LISTEN: ":8080" PUSHQ_LOG_FORMAT: json PUSHQ_API_KEYS: "admin:pq_admin_<generate>,writer:pq_writer_<generate>" depends_on: { db: { condition: service_healthy } } ports: ["8081:8080"]
pushq-b: <<: *pushq ports: ["8082:8080"]
volumes: pgdata:Generate real keys (for example echo "pq_$(openssl rand -hex 24)") instead of the placeholders.
Load-balance across the replicas however you like. GET /readyz reports which replica currently runs the dispatcher ("role": "leader"); the others report "follower" and still serve every API request. See high availability and leader election.
Put pushq behind a reverse proxy
Section titled “Put pushq behind a reverse proxy”Run pushq on a private address and put a TLS-terminating proxy in front. Two things matter.
Forward encoded queue names unmodified
Section titled “Forward encoded queue names unmodified”Queue names can contain / (folders, e.g. user/instagram). In URLs the whole name travels as one encoded segment: /v1/queues/user%2Finstagram. Your proxy must pass %2F through as-is. If it decodes %2F into /, pushq sees a different path and answers 404 not_found.
- Caddy forwards the path unmodified by default.
- nginx: write
proxy_pass http://127.0.0.1:8080;with no URI part. A trailing slash (proxy_pass http://127.0.0.1:8080/;) makes nginx normalize the path and decode%2F.
Set X-Forwarded-Proto for TLS
Section titled “Set X-Forwarded-Proto for TLS”pushq marks the dashboard session cookie Secure only when the request arrived over TLS or carries X-Forwarded-Proto: https. In SaaS mode the same check picks the scheme of the default WorkOS redirect URI. Behind a TLS-terminating proxy, forward that header. Caddy sets X-Forwarded-Proto and gets certificates on its own; with nginx, set it yourself.
server { listen 443 ssl; server_name pushq.example.com; # ssl_certificate / ssl_certificate_key ...
client_max_body_size 10m; # batch enqueue bodies can be up to 8 MiB
location / { proxy_pass http://127.0.0.1:8080; # no trailing slash proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 60s; }}pushq.example.com { reverse_proxy 127.0.0.1:8080}pushq rate-limits password sign-in attempts per client IP. Behind a proxy every client shares the proxy’s address, which still caps brute-force attempts but means one noisy client can briefly lock out others.
Zero-downtime blue/green deploys
Section titled “Zero-downtime blue/green deploys”You can run the old and new versions side by side against the same Postgres database:
- Start the new instance. It serves the API immediately; its dispatcher role is
follower. - Send
SIGTERMto the old instance. It releases dispatcher leadership at once, stops accepting new connections, then drains in-flight deliveries for up todispatcher.drain_timeout(default 30s). - The new instance takes leadership within about 5 seconds (followers retry the lock every 5s) and continues from where the old one left off.
Correctness never depends on the lock: each delivery’s result is recorded only if the task’s lease token still matches, so overlapping instances can’t both complete the same attempt. As with any at-least-once queue, a task whose lease expires mid-delivery is retried, so keep handlers idempotent. See at-least-once delivery.
New versions apply their database migrations on startup. To apply them before switching traffic, run pushq migrate with the new binary first.
Deploy on Coolify or another Docker PaaS
Section titled “Deploy on Coolify or another Docker PaaS”The image works on any platform that runs a container image. A typical setup on Coolify or a similar Docker PaaS:
- Create a Postgres database on a private network.
- Create an app from the Docker image
ghcr.io/blissfulrays/pushq:<version>, or:latestto follow stable releases. - Expose port
8080and attach your domain. The platform’s proxy terminates TLS and should sendX-Forwarded-Proto. - Set environment variables:
PUSHQ_DB=postgres://USER:PASS@<db-host>:5432/<db>?sslmode=disable, plusPUSHQ_API_KEYSor the SaaS mode variables if you need them. Use the platform’s secret storage for passwords and keys. - Turn off the platform’s in-container health check, or point it at the HTTP endpoint from outside: the image is distroless, so a check that runs
curlorwgetinside the container fails.
To redeploy automatically on every release, run the app on :latest and trigger the platform’s deploy webhook when a new image is published. With SQLite instead of Postgres, mount a persistent volume at /data (the image defaults to PUSHQ_DB=sqlite:/data/pushq.db).
Sizing and performance
Section titled “Sizing and performance”- Memory: the ceiling is roughly
dispatcher.global_concurrency × limits.max_body_bytes(defaults: 512 × 1 MiB = 512 MiB worst case), plus a few MB per 10,000 active queues. - SQLite (pure-Go driver, one writer): plan for about 500 sustained dispatches per second with headroom. Beyond that, or for high availability, use Postgres.
- Postgres: each replica opens up to 16 pooled connections, plus a dedicated connection for the leader lock and one for
LISTEN/NOTIFY. If you put PgBouncer in front, use session mode:LISTEN/NOTIFYand advisory locks need real sessions.
Throughput benchmark
Section titled “Throughput benchmark”Smoke benchmark from the repository (PUSHQ_LOAD=1 go test ./test/load): one laptop, a local receiver that answers instantly, 1,000 dynamic queues and 50,000 tasks.
| Backend | Queue creation | Enqueue | End-to-end dispatch |
|---|---|---|---|
| SQLite | 1,000 in 0.2s | ~11,000/s | ~2,300 tasks/s |
| Postgres 15 | 1,000 in 0.6s | ~2,600/s (batched) | ~3,600 tasks/s |
Treat these as upper-bound smoke numbers, not guarantees. In production, throughput is usually bounded by your receivers and by each queue’s rate limits.
Read more
Section titled “Read more”- Install a self-hosted server: binaries, Docker image and first-time setup.
- Server configuration reference: every setting and environment variable.
- Monitoring, backups and upgrades: health checks, metrics and leader election.
- SaaS mode with WorkOS: multi-team sign-in.
- How delivery works: at-least-once delivery and signatures.