Skip to content

Install Concourse CI self-hosted

Stand up Concourse CI with web, worker, and Postgres tiers — pipeline-as-code, resources, and the credential manager pattern we run for clients.

Concourse is the build system that took “pipeline as code” most literally: there is no implicit state, every input is a declared resource, every step runs in a fresh container, and re-running the same configuration against the same inputs produces the same result. That purity costs more to install and operate than Jenkins or Drone, but it eliminates a class of “works on the CI box” bugs entirely. This article covers the three-tier self-hosted install we run for clients with strict reproducibility requirements.

How to verify

fly --target main login --concourse-url https://ci.example.com
fly --target main workers
fly --target main pipelines
fly --target main containers
journalctl -u concourse-web -n 100
journalctl -u concourse-worker -n 100
psql -h db -U concourse -c "SELECT count(*) FROM builds WHERE status='started';"

fly workers is the canary. If it shows zero workers or workers in stalled, the web node cannot reach worker BaggageClaim/Garden ports — almost always a firewall or TSA registration issue. Pipelines just queue silently until a worker shows up.

What’s happening

Concourse has three components. The web node serves the UI, the API, and the ATC (the scheduler). The worker runs the containers — every step in every job in every pipeline. The database (Postgres) stores pipeline state, builds, and resource versions.

Workers register with the web node via the TSA (a small SSH server inside web that brokers worker registration), then the ATC dispatches work to them. This is the only Concourse-specific bit of network plumbing; the rest is just HTTP and Postgres.

The conceptual primitive is the resource: a typed input/output (git repo, S3 object, semver, time trigger, etc.) that the scheduler tracks versions of. Jobs declare which resource versions they consume and produce; the scheduler chains them. This is what makes pipelines DAGs of versioned artifacts rather than DAGs of script invocations.

The credential manager is the other piece that scales. Pipelines reference secrets via ((var)) syntax; the web node resolves them at build time from Vault, AWS Secrets Manager, Kubernetes Secrets, or a credhub. Secrets never sit in pipeline YAML.

The procedure

  1. Postgres. Concourse needs Postgres 13+. Single instance is fine for evaluation; use a managed Postgres or a primary+replica for production:

    CREATE USER concourse WITH PASSWORD 'XXXX';
    CREATE DATABASE concourse OWNER concourse;
    GRANT ALL PRIVILEGES ON DATABASE concourse TO concourse;
  2. Web node. Run as a systemd unit (or container). Generate session signing keys once and persist them:

    ssh-keygen -t rsa -b 4096 -m PEM -f session_signing_key -N ''
    ssh-keygen -t rsa -b 4096 -m PEM -f tsa_host_key -N ''
    ssh-keygen -t rsa -b 4096 -m PEM -f worker_key -N ''

    Then:

    /usr/local/bin/concourse web \
      --postgres-host=db.internal --postgres-user=concourse --postgres-database=concourse \
      --postgres-password="$PG_PW" \
      --external-url=https://ci.example.com \
      --session-signing-key=/etc/concourse/session_signing_key \
      --tsa-host-key=/etc/concourse/tsa_host_key \
      --tsa-authorized-keys=/etc/concourse/worker_key.pub \
      --add-local-user platform-admin:$BCRYPT \
      --main-team-local-user platform-admin
  3. Worker node. One per host; each worker should have its own resources (CPU, memory, disk). The worker holds container caches, so disk is the constraint that bites first:

    /usr/local/bin/concourse worker \
      --work-dir=/var/lib/concourse \
      --tsa-host=web.internal:2222 \
      --tsa-public-key=/etc/concourse/tsa_host_key.pub \
      --tsa-worker-private-key=/etc/concourse/worker_key \
      --baggageclaim-driver=overlay \
      --team= ""  # global worker; scope to a team if multi-tenant
  4. First pipeline. Author a pipeline.yml, then set it via fly:

    fly --target main set-pipeline --pipeline hello --config pipeline.yml
    fly --target main unpause-pipeline --pipeline hello
    fly --target main trigger-job --job hello/say-hi
  5. Credential manager. Configure Vault (or AWS Secrets Manager) on the web node:

    /usr/local/bin/concourse web \
      ... \
      --vault-url=https://vault.example.com \
      --vault-auth-backend=approle \
      --vault-auth-param=role_id=$ROLE_ID --vault-auth-param=secret_id=$SECRET_ID \
      --vault-path-prefix=/concourse

    A pipeline ((aws.access_key)) then resolves from /concourse/<team>/<pipeline>/aws/access_key.

  6. HTTPS. Put a reverse proxy in front (Caddy, Traefik). Concourse can terminate TLS itself but you rarely want it to — proxy in front, force HTTP between proxy and web inside the trusted network.

  7. Garbage collection. Concourse runs GC continuously, but a long-running install with many resources will accumulate volumes on workers. Watch df -h /var/lib/concourse on each worker; if it’s >80%, your resource cache is the culprit. fly prune-worker --worker NAME re-registers and clears caches.

Common pitfalls

  • Forgot to persist session_signing_key. Restart the web node, all sessions invalidate, everyone has to log in again — once. Lose the key entirely and pipelines that had encrypted credentials cached in the DB cannot decrypt them.
  • Shared workers, no team isolation. Any pipeline can read any volume cached on the same worker. For multi-tenant installs, scope workers to teams with --team.
  • Postgres at default max_connections=100. Web nodes open a lot of pooled connections; combined with the API, you’ll exhaust the limit at ~50 concurrent pipelines. Raise to 400 or front with PgBouncer.
  • Resource check_every: 1m on a large pipeline. Every check is API+disk; checking every minute on 200 resources hammers the database. Use 10m or webhook triggers.
  • Worker container limit. Workers cap concurrent containers; if pipelines stall, check fly containers against the worker’s configured limit.

We run Concourse for clients whose builds need byte-for-byte reproducibility — financial pipelines, regulated artifact chains, anything where “the box drifted” is an audit finding. The three-tier install, Vault credential broker, worker fleet management, and the pipeline review process are operated by our team alongside the rest of the /en/solutions/clustered-environments/ we run.