Skip to content

Instantly share code, notes, and snippets.

@bschaatsbergen
Created May 10, 2021 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bschaatsbergen/30ef51f416000b7eea9809280acc134d to your computer and use it in GitHub Desktop.
Save bschaatsbergen/30ef51f416000b7eea9809280acc134d to your computer and use it in GitHub Desktop.
Dockerized TeamCity cluster
version: '3.1'
# ./buildserver_pgdata - Postgres DB data
# ./data - TeamCity data directory
# ./teamcity-server-logs1 - logs of primary TeamCity server
# ./teamcity-server-logs2 - logs of secondary TeamCity server (running-builds node)
# ./teamcity-server-logs3 - logs of read-only TeamCity server (secondary node)
# ./teamcity-agent-conf1 - conf directory for the build agent
# ./teamcity-agent-conf2 - conf directory for the build agent
# ./teamcity-agent-conf3 - conf directory for the build agent
services:
db:
image: postgres
restart: always
ports:
- 5433:5432
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: buildserver
volumes:
- ./buildserver_pgdata:/var/lib/postgresql/data
main:
image: jetbrains/teamcity-server
volumes:
- ./data:/data/teamcity_server/datadir
- ./teamcity-server-logs1:/opt/teamcity/logs
ports:
- 8111:8111
node1:
image: jetbrains/teamcity-server
volumes:
- ./data:/data/teamcity_server/datadir
- ./teamcity-server-logs2:/opt/teamcity/logs
ports:
- 8112:8111
environment:
TEAMCITY_SERVER_OPTS: -Dteamcity.server.rootURL=http://node1:8111
node2:
image: jetbrains/teamcity-server
volumes:
- ./data:/data/teamcity_server/datadir
- ./teamcity-server-logs3:/opt/teamcity/logs
ports:
- 8113:8111
environment:
TEAMCITY_SERVER_OPTS: -Dteamcity.server.rootURL=http://node2:8111
agent1:
image: jetbrains/teamcity-agent:latest
environment:
SERVER_URL: http://teamcity:8111
volumes:
- ./teamcity-agent-conf1:/data/teamcity_agent/conf
- /var/run/docker.sock:/var/run/docker.sock
agent2:
image: jetbrains/teamcity-agent:latest
environment:
SERVER_URL: http://teamcity:8111
volumes:
- ./teamcity-agent-conf2:/data/teamcity_agent/conf
- /var/run/docker.sock:/var/run/docker.sock
agent3:
image: jetbrains/teamcity-agent:latest
environment:
SERVER_URL: http://teamcity:8111
volumes:
- ./teamcity-agent-conf3:/data/teamcity_agent/conf
- /var/run/docker.sock:/var/run/docker.sock
@bschaatsbergen
Copy link
Author

bschaatsbergen commented May 10, 2021

TeamCity docker-compose multi-node sample

Starts TeamCity in docker-compose with several servers of different roles (Ubuntu-based).

Requires at least 4Gb of RAM in the docker engine.

  • Uses Postgres DB (psql -p5433 -hlocalhost -Uuser -dbuildserver, password password)
  • Starts 3 server: primary, running-builds node, secondary node.
  • And, 3 build agents

For details on volumes, created folders, logs see docker-compose.yml file.

To start

docker-compose up

Next, open http://localhost:8111 for the initial setup.

After creating a user, visit "Agents -> Unauthorized" to authorize the build agent.

See https://localhost:8111/admin/admin.html?item=nodesConfiguration for nodes configuration.

To shutdown

docker-compose down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment