-
-
Save colthreepv/6b818cfcf296dc1b5c2cf15eb76a140e to your computer and use it in GitHub Desktop.
version: '2' | |
services: | |
concourse-db: | |
image: postgres:9.5 | |
volumes: ['database:/database'] | |
environment: | |
POSTGRES_DB: concourse | |
POSTGRES_USER: concourse | |
POSTGRES_PASSWORD: changeme | |
PGDATA: /database | |
restart: on-failure:10 | |
concourse-web: | |
image: concourse/concourse | |
command: web | |
ports: ['8080:8080'] | |
volumes: ['web-keys:/concourse-keys'] | |
depends_on: [keys, concourse-db] | |
extra_hosts: ['dockerhost:$DOCKERHOST'] | |
environment: | |
CONCOURSE_BASIC_AUTH_USERNAME: colthreepv | |
CONCOURSE_BASIC_AUTH_PASSWORD: allthewin | |
CONCOURSE_EXTERNAL_URL: http://dockerhost:8080 | |
CONCOURSE_POSTGRES_DATA_SOURCE: |- | |
postgres://concourse:changeme@concourse-db:5432/concourse?sslmode=disable | |
dns: | |
- 8.8.8.8 | |
- 8.8.4.4 | |
restart: on-failure:10 | |
concourse-worker: | |
image: concourse/concourse | |
privileged: true | |
command: worker | |
depends_on: [keys] | |
volumes: ['worker-keys:/concourse-keys'] | |
environment: | |
CONCOURSE_TSA_HOST: concourse-web | |
CONCOURSE_GARDEN_ADDRESS: concourse-worker | |
CONCOURSE_BAGGAGECLAIM_ADDRESS: concourse-worker | |
CONCOURSE_GARDEN_FORWARD_ADDRESS: concourse-worker | |
CONCOURSE_BAGGAGECLAIM_FORWARD_ADDRESS: concourse-worker | |
CONCOURSE_GARDEN_DNS_SERVER: 8.8.8.8 | |
dns: | |
- 8.8.8.8 | |
- 8.8.4.4 | |
restart: on-failure:10 | |
keys: | |
build: . | |
volumes: | |
- web-keys:/keys/web | |
- worker-keys:/keys/worker | |
volumes: | |
database: { external: { name: concourse-db } } | |
web-keys: { external: { name: concourse-web-keys } } | |
worker-keys: { external: { name: concourse-worker-keys } } |
FROM alpine:latest | |
RUN apk update && apk upgrade && \ | |
apk add --no-cache \ | |
openssh | |
RUN mkdir -p /keys/web /keys/worker | |
CMD ssh-keygen -t rsa -f /keys/web/tsa_host_key -N '' && \ | |
ssh-keygen -t rsa -f /keys/web/session_signing_key -N '' && \ | |
ssh-keygen -t rsa -f /keys/worker/worker_key -N '' && \ | |
cp /keys/worker/worker_key.pub /keys/web/authorized_worker_keys && \ | |
cp /keys/web/tsa_host_key.pub /keys/worker |
docker volume create --name concourse-db | |
docker volume create --name concourse-web-keys | |
docker volume create --name concourse-worker-keys | |
DOCKERHOST=192.168.56.51 docker-compose up |
You can simply remove the links attribute.
By default all containers in a docker compose file are in the same network.
So the simplest version 2 file would look like this:
version: '2'
services:
concourse-db:
image: postgres:9.5
environment:
POSTGRES_DB: concourse
POSTGRES_USER: concourse
POSTGRES_PASSWORD: changeme
PGDATA: /database
concourse-web:
image: concourse/concourse
command: web
ports: ["8080:8080"]
volumes: ["./keys/web:/concourse-keys"]
environment:
CONCOURSE_BASIC_AUTH_USERNAME: concourse
CONCOURSE_BASIC_AUTH_PASSWORD: changeme
CONCOURSE_EXTERNAL_URL: "${CONCOURSE_EXTERNAL_URL}"
CONCOURSE_POSTGRES_DATA_SOURCE: |-
postgres://concourse:changeme@concourse-db:5432/concourse?sslmode=disable
concourse-worker:
image: concourse/concourse
privileged: true
command: worker
volumes: ["./keys/worker:/concourse-keys"]
environment:
CONCOURSE_TSA_HOST: concourse-web```
How did you get this to work? Whenever I do, I run into the DNS issue with 127.0.0.11
copied into the worker runc
containers, and thus unable to resolve, leading all tasks to hang on initializing
.
See concourse/concourse#347 and the start of resolution at cloudfoundry/guardian#42
Ha! It works! if you add the line:
CONCOURSE_GARDEN_DNS_SERVER: 8.8.8.8
@deitch... thanks for the pointers. It worked for me. Just for others that stumble on this as well (+ future me ;)), this should go in the environment
section of the concourse-worker
...
concourse-worker:
image: concourse/concourse
privileged: true
command: worker
volumes: ["./keys/worker:/concourse-keys"]
environment:
CONCOURSE_TSA_HOST: concourse-web
CONCOURSE_GARDEN_DNS_SERVER: 8.8.8.8
this works!
i tried before with adding dns config to concourse-worker
, but looks like concourse-web
also needs it.
... maybe the extra worker envs did the trick:
CONCOURSE_GARDEN_ADDRESS: concourse-worker
CONCOURSE_BAGGAGECLAIM_ADDRESS: concourse-worker
CONCOURSE_GARDEN_FORWARD_ADDRESS: concourse-worker
CONCOURSE_BAGGAGECLAIM_FORWARD_ADDRESS: concourse-worker
using "regular" volume mounts (no volume containers).
👍
I am still experimenting with this docker-compose as I don't exactly know how all the gears work inside Concourse CI.
Mostly triaging bugs I have encountered while trying to get it running.
Please comment for any insight, thanks