aboutsummaryrefslogtreecommitdiff
path: root/devtools/docker/compose.yaml
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2021-07-13 17:49:20 -0400
committerJulie Qiu <julie@golang.org>2021-07-14 13:37:09 +0000
commit309b7c0966701bfdbfd2e4597465e8c175ff2b7e (patch)
tree3b323edb5c88213ee14c229b9b9207e627974e7b /devtools/docker/compose.yaml
parent91f7a1a6ab6658151affa92e172474996f119dbb (diff)
downloadgo-x-pkgsite-309b7c0966701bfdbfd2e4597465e8c175ff2b7e.tar.xz
devtools/docker: rename docker-compose.yaml to compose.yaml
The "docker-" is removed from docker-compose.yaml to remove unnecessary repetition. Change-Id: I9a4bfcb7dcb52281f49d2c67361454d900ce38c5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/334449 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'devtools/docker/compose.yaml')
-rw-r--r--devtools/docker/compose.yaml144
1 files changed, 144 insertions, 0 deletions
diff --git a/devtools/docker/compose.yaml b/devtools/docker/compose.yaml
new file mode 100644
index 00000000..cc7038c6
--- /dev/null
+++ b/devtools/docker/compose.yaml
@@ -0,0 +1,144 @@
+# Copyright 2021 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+version: '3'
+services:
+ allbash:
+ # Allocate a pseudo-tty, which sets the TERM
+ # environment variable to xterm.
+ # See
+ # https://docs.docker.com/engine/reference/run/#env-environment-variables and
+ # https://www.gnu.org/software/gettext/manual/html_node/The-TERM-variable.html.
+ # This is necessary because devtools/lib.sh uses tput.
+ tty:
+ true
+ # allbash depends only on db, since the Go tests will set up its own
+ # test databases.
+ depends_on:
+ - db
+ # This should match the version we are using on AppEngine.
+ image: golang:1.15.5
+ environment:
+ - GO_DISCOVERY_DATABASE_HOST=db
+ - GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-discovery-db}
+ - GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
+ - GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
+ - GO_DISCOVERY_TESTDB=${GO_DISCOVERY_TESTDB:-true}
+ # TERM is set to xterm-256color for use by devtools/lib.sh.
+ - TERM=xterm-256color
+ - WAITFORIT_TIMEOUT=300
+ entrypoint: ./third_party/wait-for-it/wait-for-it.sh db:5432 -- ./all.bash
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ e2e:
+ image: node:14.17.0
+ depends_on:
+ - chrome
+ - frontend
+ environment:
+ # CI is used for cleaner log output from jest and npm install
+ - CI=true
+ - GO_DISCOVERY_E2E_BASE_URL=http://frontend:8080
+ - GO_DISCOVERY_E2E_CHROME_URL=ws://chrome:${GO_DISCOVERY_E2E_TEST_PORT:-3000}
+ - WAITFORIT_TIMEOUT=300
+ entrypoint: ./third_party/wait-for-it/wait-for-it.sh frontend:8080 -- npx jest
+ command: e2e
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ frontend:
+ # This should match the version we are using on AppEngine.
+ image: golang:1.15.5
+ depends_on:
+ - migrate
+ command: bash -c "
+ ./third_party/wait-for-it/wait-for-it.sh db:5432 --
+ go run ./cmd/frontend -host=0.0.0.0:8080"
+ environment:
+ - GO_DISCOVERY_DATABASE_HOST=db
+ - GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-discovery-db}
+ - GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
+ - GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
+ - GO_DISCOVERY_LOG_LEVEL=${GO_DISCOVERY_LOG_LEVEL:-info}
+ - PORT=8080
+ - WAITFORIT_TIMEOUT=300
+ ports:
+ - 8080:8080
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ seeddb:
+ # This should match the version we are using on AppEngine.
+ image: golang:1.15.5
+ depends_on:
+ - migrate
+ # Note: technically we should check that migrations have completed before
+ # running seeddb, but in general, migrations will have completed by the
+ # time seeddb runs. If this ends up being flaky, we should add a check here.
+ command: bash -c "
+ ./third_party/wait-for-it/wait-for-it.sh db:5432 --
+ go run ./devtools/cmd/seeddb/main.go -seed ${GO_DISCOVERY_SEED_DB_FILE:-seed.txt}"
+ environment:
+ - GO_DISCOVERY_DATABASE_HOST=db
+ - GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-discovery-db}
+ - GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
+ - GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
+ - GO_DISCOVERY_LOG_LEVEL=${GO_DISCOVERY_LOG_LEVEL:-info}
+ - PORT=8080
+ - WAITFORIT_TIMEOUT=300
+ ports:
+ - 8080:8080
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ migrate:
+ depends_on:
+ - db
+ image: migrate/migrate:v4.14.1
+ entrypoint: ""
+ command: sh -c "
+ apk add --no-cache bash &&
+ ./third_party/wait-for-it/wait-for-it.sh db:5432 --
+ migrate -path /pkgsite/migrations
+ -database postgres://${GO_DISCOVERY_DATABASE_USER:-postgres}:${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}@db:5432/${GO_DISCOVERY_DATABASE_NAME:-discovery-db}?sslmode=disable up"
+ environment:
+ - WAITFORIT_TIMEOUT=300
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ db:
+ image: postgres:11.12
+ environment:
+ - LANG=C
+ # GO_DISCOVERY_DATABASE* variables are set so that this docker file can
+ # be used for local development.
+ - POSTGRES_DB=${GO_DISCOVERY_DATABASE_NAME:-discovery-db}
+ - POSTGRES_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
+ - POSTGRES_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
+ ports:
+ - ${GO_DISCOVERY_DATABASE_PORT:-5432}:5432
+ nodejs:
+ image: node:14.17.0
+ depends_on:
+ - chrome
+ environment:
+ # Use the values set on the host machine environment.
+ - CI
+ # GO_DISCOVERY_E2E_* variables are used by the deployment script.
+ - GO_DISCOVERY_E2E_AUTHORIZATION
+ - GO_DISCOVERY_E2E_BASE_URL
+ - GO_DISCOVERY_E2E_CHROME_URL=ws://chrome:${GO_DISCOVERY_E2E_TEST_PORT:-3000}
+ - GO_DISCOVERY_E2E_QUOTA_BYPASS
+ - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
+ - WAITFORIT_TIMEOUT=300
+ entrypoint: "./third_party/wait-for-it/wait-for-it.sh chrome:3000 -- "
+ volumes:
+ - ../../:/pkgsite
+ working_dir: /pkgsite
+ chrome:
+ image: browserless/chrome:1.46-chrome-stable
+ ports:
+ - 3000:3000
+ environment:
+ - CONNECTION_TIMEOUT=120000