Skip to content

Self-hosting

Beacon runs as one Docker Compose stack: Nginx, the dashboard, the ingest service, the worker, Postgres, ClickHouse and Redis. You need a server with Docker and Compose.

  1. Get the code at the latest release and copy the env file. Releases are tagged vX.Y.Z and listed on the tags page.

    Terminal window
    git clone https://github.com/tbdsux/beacon.git
    cd beacon
    git checkout v0.1.0
    cp .env.example .env
  2. Set the secrets in .env: POSTGRES_PASSWORD, CLICKHOUSE_PASSWORD, REDIS_PASSWORD, AUTH_SECRET, INGEST_SECRET and APP_URL. Use long random values, for example:

    Terminal window
    openssl rand -hex 24

    Every variable is described in Environment variables.

  3. Start the stack. Compose builds the images from the checked-out code, and every up runs the database migrations before the apps start.

    Terminal window
    docker compose up -d
  4. Open APP_URL and finish setup.

Nginx serves plain HTTP on HTTP_PORT (default 80). To serve HTTPS from the same container, follow the steps at the top of infra/nginx/tls.conf.template.

If a proxy or tunnel in front of Beacon already terminates TLS (Cloudflare Tunnel, Caddy, a load balancer), enable the trusted-proxy block in infra/nginx/templates/00-beacon-http.conf.template so visitor IPs come from the right header.

Back up first: before 1.0, a minor release (0.1 to 0.2) can include breaking changes. Then check out the new release and rebuild. Migrations run on start.

Terminal window
git fetch --tags
git checkout v0.2.0
docker compose up -d --build

Every release also publishes the app images to the GitHub Container Registry, for running Beacon without this Compose file:

Image Runs
ghcr.io/tbdsux/beacon-dashboard The dashboard and its API
ghcr.io/tbdsux/beacon-ingest The ingest service and the tracker script
ghcr.io/tbdsux/beacon-worker Background jobs: exports, digests, alerts, retention
ghcr.io/tbdsux/beacon-migrate One-shot Postgres and ClickHouse migrations

Each is tagged with the exact version (0.1.0), its minor line (0.1) and latest, for linux/amd64 only. Run all four at the same version, let beacon-migrate finish before the others start, and give each the environment that docker-compose.yml sets for it. A proxy in front must send INGEST_PREFIX paths to ingest and the rest to the dashboard, as infra/nginx/templates/beacon-locations.inc.template does.

Countries, regions and cities need a MaxMind GeoLite2 or DB-IP Lite .mmdb file. Mount it into the ingest container and set GEOIP_DB_PATH to its path; the ingest service in docker-compose.yml shows how. Without it, locations show as Unknown.

Digests and email alerts need SMTP. A superadmin sets it up in the dashboard under Settings → Email. Webhook alerts work without it.

Back up Postgres, the ClickHouse analytics tables and Redis to backups/<UTC timestamp>:

Terminal window
infra/scripts/backup.sh

Restore one:

Terminal window
infra/scripts/restore.sh backups/<timestamp>