Self-hosting Tally

Tally is one Go binary plus PostgreSQL 14 or newer. The Docker image bundles the binary, the dashboard assets, and the DB-IP City Lite GeoIP database.

Docker Compose

curl -O https://raw.githubusercontent.com/waymark-labs/tally/main/docker-compose.yml
TALLY_SECRET=$(openssl rand -hex 32) docker compose up -d

Open http://localhost:8000 and finish setup. Keep the same TALLY_SECRET for every restart (put it in a .env file next to docker-compose.yml); changing it signs everyone out.

For a public instance, put a TLS-terminating proxy in front (Caddy, Nginx, Traefik) and set APP_URL=https://analytics.example.com. Finish setup immediately after the first start, or set TALLY_SETUP_TOKEN so the setup form requires it.

Plain Docker

docker run -d --name tally -p 8000:8000 \
  -e APP_URL=https://analytics.example.com \
  -e TALLY_SECRET=... \
  -e DATABASE_URL='postgres://tally:password@db-host:5432/tally?sslmode=require' \
  ghcr.io/waymark-labs/tally:latest

The entrypoint runs migrations before serving (TALLY_SKIP_MIGRATIONS=true turns that off). Run commands with docker exec tally ./app <command>.

Without Docker

npm ci && npm run build
go build -o app .
APP_ENV=production APP_URL=... TALLY_SECRET=... DATABASE_URL=... ./app migrate --force
APP_ENV=production APP_URL=... TALLY_SECRET=... DATABASE_URL=... SERVER_HOST=0.0.0.0 ./app

The binary needs public/ (with public/build/) and a writable storage/ directory beside it. For geolocation, download a GeoIP file and set TALLY_GEOIP_PATH (see below).

Hosts and proxies

  • In production Tally only answers requests whose Host is APP_URL's host or a subdomain of it, and returns 400 otherwise. Add extra hosts with TALLY_TRUSTED_HOSTS=other.example.com,*.example.org or disable the check with *.
  • X-Forwarded-* headers are honored only when the direct peer is in TALLY_TRUSTED_PROXIES (private and CGNAT networks by default), and the visitor is the right-most X-Forwarded-For entry that isn't a trusted proxy. * trusts every peer and uses the left-most entry, which visitors can spoof; use it only when your load balancer overwrites the header. If the client IP arrives in another header, set TALLY_CLIENT_IP_HEADER (for example CF-Connecting-IP); it's also honored only from trusted peers.
  • Settings → System shows the IP Tally sees for you, which is the quickest way to check this.

GeoIP

The image includes DB-IP City Lite (CC BY 4.0), refreshed monthly by the release workflow; pull :latest to update. docker build --build-arg GEOIP=country . builds a smaller country-only image. To use MaxMind GeoLite2-City instead, mount the .mmdb file and set TALLY_GEOIP_PATH to it.

Operations

  • Background work runs inside the server process: the ingest buffer flushes every second, rollups rebuild every 5 minutes, and an hourly maintenance job creates partitions, applies retention, and prunes salts. No cron or worker is needed.
  • Shutdown: on SIGTERM Tally finishes in-flight requests and flushes the buffer (up to 20 seconds). A hard crash loses at most about one second of events.
  • Retention: TALLY_RETENTION_MONTHS=N drops raw monthly partitions older than N months. Daily rollups and people are kept, so unfiltered dashboards cover all time; filtered views and journeys reach back N months.
  • Backups: pg_dump "$DATABASE_URL" > tally.sql. Everything Tally stores is in Postgres.
  • Upgrades: pull the new image and restart. Migrations are forward-only; take a backup first.
  • Health: GET /up returns 200. ./app tally:doctor checks the database, partitions, GeoIP, APP_URL, and proxies; --fix repairs partitions; --bench times dashboard queries.
  • Scaling: one replica handles well over 10M events/month on 1 vCPU. See "Running multiple replicas" below.

Commands

Command Does
./app tally:user:create --email=you@example.com --role=owner [--password-stdin] Create a user without the setup page
./app tally:user:password you@example.com [--password-stdin] Reset a password
./app tally:rollup --site=<id> --from=YYYY-MM-DD --to=YYYY-MM-DD Rebuild daily rollups (after changing a site's timezone)
./app tally:demo --site=<id> --days=30 --events=50000 Generate synthetic traffic
./app tally:doctor [--fix] [--bench] Check the installation

Running multiple replicas

One replica is the supported topology for v1. Tally keeps an ingest buffer and visit cache in memory, so several replicas work but with these known limitations:

  • A visitor whose requests land on different replicas can be split into two visits, and visit IDs can (very rarely) collide across replicas.
  • The site and API-key caches (up to 30 s and 15 s) may keep serving a just-deleted site or key on other replicas until they expire.
  • Rollups and site deletion run on whichever replica takes the lock; a rollup that races a site deletion can write rollup rows for the deleted site, which the next maintenance sweep removes.
  • If a replica crashes after the database commits a batch but before it learns of the commit, that batch can be written twice (rare; a batch receipt table is future work).
  • An account switch on a shared browser with no activity after it can be forgotten if the process restarts before the next event.

Alerts and digests are safe with several replicas: each send is claimed in the database first.

NextDeploy on Railway