Skip to content

Commit

Permalink
Use upstream docker-compose file for bootstrap
Browse files Browse the repository at this point in the history
Concourse upstream publishes a docker-compose file which uses their new
`quickstart` command to auto-wire a worker and atc together. This commit
uses that upstream file (vendorered, as a couple of changes need to be
accepted upstream before we can use it [1]).

To use it, we needed to upgrade to Bionic as our bootstrap substrate for
a later version of docker-compose, which introduced a subtle cloud-init
boot-time timing problem, where Vagrant can run our commands (`apt-get
update`) before the apt config files are pointing at the correct repos.

[1] concourse/docs#112
  • Loading branch information
Jonathan Matthews committed Sep 24, 2018
1 parent a2c1210 commit bd4409e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 50 deletions.
36 changes: 0 additions & 36 deletions docker/docker-compose.yml

This file was deleted.

6 changes: 3 additions & 3 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ AWS_ACCOUNT_DATA = {
}.freeze
AWS_ACCOUNT_VARIABLES = AWS_ACCOUNT_DATA.fetch(AWS_ACCOUNT).fetch(AWS_REGION)

# ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170202
# ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20180912
AWS_AMI = {
"eu-west-1" => "ami-98ecb7fe",
"eu-west-2" => "ami-c5d0c5a1",
"eu-west-1" => "ami-00035f41c82244dab",
"eu-west-2" => "ami-0b0a60c0a2bd40612",
}.freeze

# rubocop:disable Metrics/BlockLength
Expand Down
1 change: 0 additions & 1 deletion vagrant/docker-compose.yml

This file was deleted.

26 changes: 26 additions & 0 deletions vagrant/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3'

services:
concourse-db:
image: postgres
environment:
- POSTGRES_DB=${CONCOURSE_POSTGRES_DATABASE:-concourse}
- POSTGRES_PASSWORD=${CONCOURSE_POSTGRES_PASSWORD:-concourse_pass}
- POSTGRES_USER=${CONCOURSE_POSTGRES_USER:-concourse_user}
- PGDATA=/database

concourse:
image: concourse/concourse
command: quickstart
privileged: true
depends_on: [concourse-db]
ports: ["8080:8080"]
environment:
- CONCOURSE_POSTGRES_HOST=${CONCOURSE_POSTGRES_HOST:-concourse-db}
- CONCOURSE_POSTGRES_USER=${CONCOURSE_POSTGRES_USER:-concourse_user}
- CONCOURSE_POSTGRES_PASSWORD=${CONCOURSE_POSTGRES_PASSWORD:-concourse_pass}
- CONCOURSE_POSTGRES_DATABASE=${CONCOURSE_POSTGRES_DATABASE:-concourse}
- CONCOURSE_EXTERNAL_URL
- CONCOURSE_ADD_LOCAL_USER=${CONCOURSE_ADD_LOCAL_USER:-test:test}
- CONCOURSE_MAIN_TEAM_ALLOW_ALL_USERS=true
- CONCOURSE_WORKER_GARDEN_NETWORK
25 changes: 15 additions & 10 deletions vagrant/post-deploy.d/00-run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@

set -eu

echo "Waiting for cloud-init to update /etc/apt/sources.list .." >&2
until grep -q ec2.archive.ubuntu.com /etc/apt/sources.list; do
sleep 2
echo ".. still waiting .." >&2
done
echo ".. update complete." >&2

sudo apt-get update && sudo apt-get install docker-compose -y

cd /vagrant

# Generate keys for concourse
mkdir -p keys/web keys/worker
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

# shellcheck disable=SC2091
$("./environment.sh")
$(./environment.sh)

# Expose settings as the envvars which the upstream docker-compose file expects
export CONCOURSE_POSTGRES_DATABASE="$CONCOURSE_DATABASE_NAME"
export CONCOURSE_POSTGRES_USER="$CONCOURSE_DATABASE_USER"
export CONCOURSE_POSTGRES_PASSWORD="$CONCOURSE_DATABASE_PASS"
export CONCOURSE_ADD_LOCAL_USER="${CONCOURSE_ATC_USER}:${CONCOURSE_ATC_PASSWORD}"
export CONCOURSE_EXTERNAL_URL="$CONCOURSE_URL"

sudo -E docker-compose up -d

0 comments on commit bd4409e

Please sign in to comment.