intersoftlab/teamcity-server
3.1K
Distributed Build Management and Continuous Integration Server
You need to add two systemd units:
[Unit]
Description=Postgres Database %i
Requires=docker.service
After=docker.service
Before=postgres-restore@%i.service
Before=postgres-backup@%i.service
[Service]
Environment=POSTGRES_PASSWORD=my_db_pass
Environment=INSTANCE=%i-postgres-db
Environment=IMAGE=postgres
Environment=DATA=/data/%i-postgres-db
Environment=MEMORY=512m
ExecStartPre=-/bin/sh -c "docker pull ${IMAGE}"
ExecStartPre=-/bin/sh -c "docker rm -f ${INSTANCE} >/dev/null 2>&1"
ExecStart=/bin/sh -c "docker run --rm -i -m=${MEMORY} --name ${INSTANCE} \
-h ${INSTANCE} \
-l SERVICE_NAME=${INSTANCE} \
-l SERVICE_TAGS=postgres,%i,database,%H \
-v ${DATA}:/var/lib/postgresql/data \
-e POSTGRES_USER=%i \
-e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \
${IMAGE}"
ExecStop=/bin/sh -c "docker stop ${INSTANCE}"
TimeoutStartSec=0
TimeoutStopSec=5m
[Install]
WantedBy=multi-user.target
teamcity.service
[Unit]
Description=TeamCity Continuous Integration Server
Requires=docker.service
After=docker.service
After=postgres@%p.service
Wants=postgres@%p.service
PartOf=postgres@%p.service
Conflicts=postgres-restore@%p.service
[Service]
Environment=IMAGE=intersoftlab/teamcity-server:stable
Environment=NAME=teamcity-%i
Environment=DATA=/data/teamcity
ExecStartPre=-/bin/sh -c "/usr/bin/docker pull ${IMAGE}"
ExecStartPre=/bin/sh -c "/usr/bin/docker inspect ${NAME} >/dev/null 2>&1 && /usr/bin/docker rm -f ${NAME} >/dev/null 2>&1 || true"
ExecStart=/bin/sh -c "docker run --rm --name ${NAME} \
-v ${DATA}:/data/teamcity \
-p 80:8111 \
--link %p-postgres-db:postgres \
${IMAGE}"
ExecStop=/usr/bin/docker stop ${NAME}
TimeoutStartSec=20m
Restart=always
RestartSec=5m
[X-Fleet]
MachineOf=postgres@%p.service
After running teamcity.service will create an empty postgres database, available from teamcity with hostname postgres, user teamcity, password my_db_pass.
Do not forget to run a sufficient number of Teamcity agents.
Content type
Image
Digest
sha256:80c7edcd5…
Size
738 MB
Last updated
almost 11 years ago
docker pull intersoftlab/teamcity-server