|
1 | 1 | \title{\aux{Install Concourse with} Docker Compose}{install-docker-compose}
|
2 | 2 |
|
3 | 3 | \use-plugin{concourse-docs}
|
| 4 | + |
| 5 | +This guide will show you how to install Concourse on any Linux system |
| 6 | +using \link{Docker Compose}{https://docs.docker.com/compose/}. |
| 7 | + |
| 8 | +This guide makes the following assumptions: |
| 9 | +\ordered-list{ |
| 10 | + The host system has Docker installed already. |
| 11 | +}{ |
| 12 | + You have a PostgreSQL database running somewhere already. You created a |
| 13 | + database called \code{concourse} and created a user for Concourse to |
| 14 | + authenticate as. |
| 15 | +}{ |
| 16 | + You have generated the necessary |
| 17 | + \reference{generating-keys}{encryption Keys}. |
| 18 | +}{ |
| 19 | + The host system the Web node will be running on is exposed to the |
| 20 | + internet and can therefore accept inbound traffic on port \code{443}. |
| 21 | +}{ |
| 22 | + The Web and Worker node are being installed on separate servers and you |
| 23 | + will figure out networking between the two servers. The Web node needs |
| 24 | + to accept ingress traffic on the TSA port (default is port \code{2222}) |
| 25 | + from the Worker node(s). |
| 26 | +} |
| 27 | + |
| 28 | + |
| 29 | +\section{ |
| 30 | + \title{Setup Web Node}{docker-web} |
| 31 | + |
| 32 | + You can do the following from any directory on your system. This guide |
| 33 | + will assume all work is done in \code{~/concourse}. |
| 34 | + |
| 35 | + Create a directory called \code{keys} (\code{~/concourse/keys}). Place |
| 36 | + the following encryption keys inside the new directory: |
| 37 | + \list{ |
| 38 | + \code{session_signing_key} |
| 39 | + }{ |
| 40 | + \code{tsa_host_key} |
| 41 | + }{ |
| 42 | + \code{worker_key.pub} |
| 43 | + } |
| 44 | + |
| 45 | + Next, create a \code{docker-compose.yml} file |
| 46 | + (\code{~/concourse/docker-compose.yml}) with the following content: |
| 47 | + |
| 48 | + \codeblock{yaml}{{{ |
| 49 | + services: |
| 50 | + web: |
| 51 | + image: docker.io/concourse/concourse:latest |
| 52 | + command: web |
| 53 | + restart: "unless-stopped" |
| 54 | + ports: |
| 55 | + - "443:8080" |
| 56 | + - "2222:2222" |
| 57 | + volumes: |
| 58 | + - ~/concourse/keys:/concourse-keys:ro |
| 59 | + environment: |
| 60 | + CONCOURSE_EXTERNAL_URL: https://ci.example.com |
| 61 | + CONCOURSE_ENABLE_LETS_ENCRYPT: "true" |
| 62 | + CONCOURSE_SESSION_SIGNING_KEY: /concourse-keys/session_signing_key |
| 63 | + CONCOURSE_TSA_AUTHORIZED_KEYS: /concourse-keys/worker_key.pub |
| 64 | + CONCOURSE_TSA_HOST_KEY: /concourse-keys/tsa_host_key |
| 65 | + CONCOURSE_POSTGRES_HOST: <psql hostname> |
| 66 | + CONCOURSE_POSTGRES_USER: <psql user> |
| 67 | + CONCOURSE_POSTGRES_PASSWORD: <psql password> |
| 68 | + CONCOURSE_POSTGRES_DATABASE: concourse |
| 69 | + CONCOURSE_ADD_LOCAL_USER: test:test |
| 70 | + CONCOURSE_MAIN_TEAM_LOCAL_USER: test |
| 71 | + CONCOURSE_CLUSTER_NAME: Concourse |
| 72 | + CONCOURSE_ENABLE_ACROSS_STEP: "true" |
| 73 | + CONCOURSE_ENABLE_REDACT_SECRETS: "true" |
| 74 | + CONCOURSE_ENABLE_PIPELINE_INSTANCES: "true" |
| 75 | + CONCOURSE_ENABLE_CACHE_STREAMED_VOLUMES: "true" |
| 76 | + logging: |
| 77 | + driver: local |
| 78 | + options: |
| 79 | + max-size: "100m" |
| 80 | + }}} |
| 81 | + |
| 82 | + \aside{ |
| 83 | + The above file configues the web node with |
| 84 | + \reference{local-auth}{local user authentication} with the username |
| 85 | + and password set to \code{test}. You will probably want to configure |
| 86 | + your web node with one of the other |
| 87 | + \reference{configuring-auth}{authentication providers} and remove the |
| 88 | + \code{*_LOCAL_USER} environment variables. |
| 89 | + } |
| 90 | + |
| 91 | + You can start the Web node by running: |
| 92 | + |
| 93 | + \codeblock{bash}{{{ |
| 94 | + docker compose up -d |
| 95 | + }}} |
| 96 | + |
| 97 | + You should then be able to access Concourse from the |
| 98 | + \code{CONCOURSE_EXTERNAL_URL} you specified. |
| 99 | + |
| 100 | + If you're using local authentication you can login using the |
| 101 | + \reference{fly}. |
| 102 | + |
| 103 | + \codeblock{bash}{{{ |
| 104 | + fly -t ci -c https://ci.example.com -u test -p test |
| 105 | + }}} |
| 106 | +} |
| 107 | + |
| 108 | +\section{ |
| 109 | + \title{Setup Worker Node}{docker-worker} |
| 110 | + |
| 111 | + You can do the following from any directory on your system. This guide |
| 112 | + will assume all work is done in \code{~/concourse}. |
| 113 | + |
| 114 | + Create a directory called \code{keys} (\code{~/concourse/keys}). Place |
| 115 | + the following encryption keys inside the new directory: |
| 116 | + \list{ |
| 117 | + \code{tsa_host_key.pub} |
| 118 | + }{ |
| 119 | + \code{worker_key} |
| 120 | + } |
| 121 | + |
| 122 | + Next, create a \code{docker-compose.yml} file |
| 123 | + (\code{~/concourse/docker-compose.yml}) with the following content: |
| 124 | + |
| 125 | + \codeblock{yaml}{{{ |
| 126 | + services: |
| 127 | + worker: |
| 128 | + image: docker.io/concourse/concourse:latest |
| 129 | + command: worker |
| 130 | + privileged: true |
| 131 | + restart: "unless-stopped" |
| 132 | + stop_signal: SIGUSR2 |
| 133 | + volumes: |
| 134 | + - ~/concourse/keys:/concourse-keys:ro |
| 135 | + environment: |
| 136 | + CONCOURSE_NAME: worker-01 |
| 137 | + CONCOURSE_RUNTIME: containerd |
| 138 | + CONCOURSE_BAGGAGECLAIM_DRIVER: overlay |
| 139 | + CONCOURSE_TSA_PUBLIC_KEY: /concourse-keys/tsa_host_key.pub |
| 140 | + CONCOURSE_TSA_WORKER_PRIVATE_KEY: /concourse-keys/worker_key |
| 141 | + CONCOURSE_TSA_HOST: <web-hostname-or-ip>:2222 |
| 142 | + logging: |
| 143 | + driver: local |
| 144 | + options: |
| 145 | + max-size: "100m" |
| 146 | + }}} |
| 147 | + |
| 148 | + \aside{ |
| 149 | + If your pipelines are having issues with DNS resolution please read |
| 150 | + \reference{worker-troubleshoot-dns}{this section}. |
| 151 | + } |
| 152 | + |
| 153 | + You can start the Worker node by running: |
| 154 | + |
| 155 | + \codeblock{bash}{{{ |
| 156 | + docker compose up -d |
| 157 | + }}} |
| 158 | + |
| 159 | + Using the \reference{fly} you should be able to see the worker successfully |
| 160 | + connected to the Web node by running \code{fly workers}. |
| 161 | + |
| 162 | + Congratulations, you've successfully deployed a Concourse cluster! |
| 163 | +} |
0 commit comments