├── .gitignore ├── Dockerfile ├── README.md ├── docker-compose.yml ├── generate-keys.sh ├── quick-start ├── README.md └── docker-compose.yml └── scripts ├── start.sh └── wait-for-it.sh /.gitignore: -------------------------------------------------------------------------------- 1 | keys/* 2 | bin/* 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | RUN apt-get update && \ 3 | apt-get install -y iptables ca-certificates aufs-tools wget && \ 4 | apt-get clean && \ 5 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ 6 | wget -q https://github.com/concourse/concourse/releases/download/v1.5.1/concourse_linux_amd64 -O /root/concourse && chmod +x /root/concourse && \ 7 | wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.1.1/dumb-init_1.1.1_amd64 && \ 8 | chmod +x /usr/local/bin/dumb-init && \ 9 | apt-get remove wget -y && apt-get autoremove -y && \ 10 | apt-get clean 11 | ADD ./keys /root/keys 12 | ADD ./scripts /root/scripts 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Concourse Docker 2 | 3 | # *Deprecated* 4 | See [the new official image](https://github.com/concourse/concourse-docker) for the latest. 5 | 6 | **Running 1.4.1** 7 | 8 | Create [Docker](https://www.docker.com/) images to run [Concourse](http://concourse.ci) in. 9 | 10 | See [here](https://github.com/concourse/bin) for more details. 11 | 12 | See [Standalone Binaries](http://concourse.ci/binaries.html) for binary details. 13 | 14 | ## Usage 15 | 16 | ### Quick-start 17 | 18 | See the Quick-start folder. 19 | 20 | ### Generate private keys 21 | 22 | Run generate-keys.sh to create keys to be used by the web host and workers. 23 | 24 | ### Environment variables 25 | 26 | * `CONCOURSE_EXTERNAL_URL` - The URL to access concourse web at. Usually [http://192.168.99.100:8080](http://192.168.99.100:8080) or [http://localhost:8080](http://localhost:8080) 27 | * `CONCOURSE_LOGIN` - Username to use for concourse basic auth. 28 | * `CONCOURSE_PASSWORD` = Password to use for concourse basic auth. 29 | 30 | ### Start Concourse 31 | 32 | Run: 33 | ``` 34 | docker-compose up 35 | ``` 36 | 37 | Open the CONCOURSE_EXTERNAL_URL specified above ([http://192.168.99.100:8080](http://192.168.99.100:8080)) and start using concourse. 38 | 39 | See [Using Concourse](https://concourse.ci/using-concourse.html) to get started. 40 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | concourse-db: 2 | image: postgres:9.5 3 | environment: 4 | POSTGRES_DB: concourse 5 | POSTGRES_PASSWORD: concourse_pass 6 | POSTGRES_USER: concourse_user 7 | PGDATA: /database 8 | concourse-web: 9 | build: . 10 | links: 11 | - concourse-db 12 | command: /root/scripts/start.sh web 13 | ports: 14 | - "8080:8080" 15 | environment: 16 | CONCOURSE_LOGIN: '${CONCOURSE_LOGIN}' 17 | CONCOURSE_PASSWORD: '${CONCOURSE_PASSWORD}' 18 | CONCOURSE_EXTERNAL_URL: '${CONCOURSE_EXTERNAL_URL}' 19 | concourse-worker: 20 | build: . 21 | privileged: true 22 | links: 23 | - concourse-web 24 | - concourse-db 25 | command: /root/scripts/start.sh worker 26 | -------------------------------------------------------------------------------- /generate-keys.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm -rf ./keys 4 | mkdir -p keys 5 | ssh-keygen -t rsa -f ./keys/host_key -N '' > /dev/null 6 | ssh-keygen -t rsa -f ./keys/worker_key -N '' > /dev/null 7 | ssh-keygen -t rsa -f ./keys/session_signing_key -N '' > /dev/null 8 | cp ./keys/worker_key.pub ./keys/authorized_worker_keys > /dev/null 9 | chmod 600 ./keys/* > /dev/null 10 | -------------------------------------------------------------------------------- /quick-start/README.md: -------------------------------------------------------------------------------- 1 | # Concourse Quick start 2 | 3 | This is for getting concourse up and running quickly without any setup. It should only be used for local testing and trying out concourse. 4 | 5 | ## Instructions 6 | 7 | From the quick-start folder run docker-compose up then go to [http://192.168.99.100:8080](http://192.168.99.100:8080) 8 | 9 | You can edit the compose file to change the URL and login/password as needed. 10 | 11 | Defaults are the following: 12 | 13 | * `URL` [http://192.168.99.100:8080](http://192.168.99.100:8080) 14 | * `login` concourse 15 | * `password` password 16 | -------------------------------------------------------------------------------- /quick-start/docker-compose.yml: -------------------------------------------------------------------------------- 1 | concourse-db: 2 | image: postgres:9.5 3 | environment: 4 | POSTGRES_DB: concourse 5 | POSTGRES_PASSWORD: concourse_pass 6 | POSTGRES_USER: concourse_user 7 | PGDATA: /database 8 | concourse-web: 9 | image: gregoryarcara/concourse-bin:1.5.1 10 | links: 11 | - concourse-db 12 | command: /root/scripts/start.sh web 13 | ports: 14 | - "8080:8080" 15 | environment: 16 | CONCOURSE_LOGIN: 'concourse' 17 | CONCOURSE_PASSWORD: 'password' 18 | CONCOURSE_EXTERNAL_URL: 'http://192.168.99.100:8080/' 19 | concourse-worker: 20 | image: gregoryarcara/concourse-bin:1.5.1 21 | privileged: true 22 | links: 23 | - concourse-web 24 | - concourse-db 25 | command: /root/scripts/start.sh worker 26 | -------------------------------------------------------------------------------- /scripts/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | command=$1 4 | 5 | if [[ "$command" == "web" ]]; then 6 | /usr/local/bin/dumb-init /root/concourse web \ 7 | --basic-auth-username $CONCOURSE_LOGIN \ 8 | --basic-auth-password $CONCOURSE_PASSWORD \ 9 | --session-signing-key /root/keys/session_signing_key \ 10 | --tsa-host-key /root/keys/host_key \ 11 | --tsa-authorized-keys /root/keys/authorized_worker_keys \ 12 | --external-url $CONCOURSE_EXTERNAL_URL \ 13 | --postgres-data-source postgres://concourse_user:concourse_pass@concourse-db:5432/concourse?sslmode=disable 14 | elif [[ "$command" == "worker" ]]; then 15 | /usr/local/bin/dumb-init /root/concourse worker \ 16 | --work-dir /opt/concourse/worker \ 17 | --tsa-host concourse-web \ 18 | --tsa-public-key /root/keys/host_key.pub \ 19 | --tsa-worker-private-key /root/keys/worker_key 20 | else 21 | echo "argument should be web or worker" 22 | fi 23 | -------------------------------------------------------------------------------- /scripts/wait-for-it.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Use this script to test if a given TCP host/port are available 3 | 4 | cmdname=$(basename $0) 5 | 6 | echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } 7 | 8 | usage() 9 | { 10 | cat << USAGE >&2 11 | Usage: 12 | $cmdname host:port [-s] [-t timeout] [-- command args] 13 | -h HOST | --host=HOST Host or IP under test 14 | -p PORT | --port=PORT TCP port under test 15 | Alternatively, you specify the host and port as host:port 16 | -s | --strict Only execute subcommand if the test succeeds 17 | -q | --quiet Don't output any status messages 18 | -t TIMEOUT | --timeout=TIMEOUT 19 | Timeout in seconds, zero for no timeout 20 | -- COMMAND ARGS Execute command with args after the test finishes 21 | USAGE 22 | exit 1 23 | } 24 | 25 | wait_for() 26 | { 27 | if [[ $TIMEOUT -gt 0 ]]; then 28 | echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" 29 | else 30 | echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" 31 | fi 32 | start_ts=$(date +%s) 33 | while : 34 | do 35 | (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 36 | result=$? 37 | if [[ $result -eq 0 ]]; then 38 | end_ts=$(date +%s) 39 | echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" 40 | break 41 | fi 42 | sleep 1 43 | done 44 | return $result 45 | } 46 | 47 | wait_for_wrapper() 48 | { 49 | # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 50 | if [[ $QUIET -eq 1 ]]; then 51 | timeout $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 52 | else 53 | timeout $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 54 | fi 55 | PID=$! 56 | trap "kill -INT -$PID" INT 57 | wait $PID 58 | RESULT=$? 59 | if [[ $RESULT -ne 0 ]]; then 60 | echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" 61 | fi 62 | return $RESULT 63 | } 64 | 65 | # process arguments 66 | while [[ $# -gt 0 ]] 67 | do 68 | case "$1" in 69 | *:* ) 70 | hostport=(${1//:/ }) 71 | HOST=${hostport[0]} 72 | PORT=${hostport[1]} 73 | shift 1 74 | ;; 75 | --child) 76 | CHILD=1 77 | shift 1 78 | ;; 79 | -q | --quiet) 80 | QUIET=1 81 | shift 1 82 | ;; 83 | -s | --strict) 84 | STRICT=1 85 | shift 1 86 | ;; 87 | -h) 88 | HOST="$2" 89 | if [[ $HOST == "" ]]; then break; fi 90 | shift 2 91 | ;; 92 | --host=*) 93 | HOST="${1#*=}" 94 | shift 1 95 | ;; 96 | -p) 97 | PORT="$2" 98 | if [[ $PORT == "" ]]; then break; fi 99 | shift 2 100 | ;; 101 | --port=*) 102 | PORT="${1#*=}" 103 | shift 1 104 | ;; 105 | -t) 106 | TIMEOUT="$2" 107 | if [[ $TIMEOUT == "" ]]; then break; fi 108 | shift 2 109 | ;; 110 | --timeout=*) 111 | TIMEOUT="${1#*=}" 112 | shift 1 113 | ;; 114 | --) 115 | shift 116 | CLI="$@" 117 | break 118 | ;; 119 | --help) 120 | usage 121 | ;; 122 | *) 123 | echoerr "Unknown argument: $1" 124 | usage 125 | ;; 126 | esac 127 | done 128 | 129 | if [[ "$HOST" == "" || "$PORT" == "" ]]; then 130 | echoerr "Error: you need to provide a host and port to test." 131 | usage 132 | fi 133 | 134 | TIMEOUT=${TIMEOUT:-15} 135 | STRICT=${STRICT:-0} 136 | CHILD=${CHILD:-0} 137 | QUIET=${QUIET:-0} 138 | 139 | if [[ $CHILD -gt 0 ]]; then 140 | RESULT=$(wait_for) 141 | exit $RESULT 142 | else 143 | if [[ $TIMEOUT -gt 0 ]]; then 144 | wait_for_wrapper 145 | RESULT=$? 146 | else 147 | RESULT=$(wait_for) 148 | fi 149 | fi 150 | 151 | if [[ $CLI != "" ]]; then 152 | if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then 153 | echoerr "$cmdname: strict mode, refusing to execute subprocess" 154 | exit $RESULT 155 | fi 156 | exec $CLI 157 | else 158 | exit $RESULT 159 | fi 160 | --------------------------------------------------------------------------------