<commit_before># 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_TESTDB=true
      - GO_DISCOVERY_DATABASE_TEST_PORT=5432
      - GO_DISCOVERY_DATABASE_TEST_HOST=db
      - GO_DISCOVERY_DATABASE_TEST_USER=postgres
      - GO_DISCOVERY_DATABASE_TEST_PASSWORD=<PASSWORD>
      - GOMODCACHE=/gomodcache
      # TERM is set to xterm-256color for use by devtools/lib.sh.
      - TERM=xterm-256color
    entrypoint: "./third_party/wait-for-it/wait-for-it.sh db:5432 -- ./all.bash"
    volumes:
      - ../../:/pkgsite
      - $GOPATH/pkg/mod:/gomodcache
    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: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
  chrome:
    image: browserless/chrome:1.46-chrome-stable
    ports:
      - 3000:3000
    environment:
      - CONNECTION_TIMEOUT=120000
  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_USER=postgres
      - GO_DISCOVERY_DATABASE_PASSWORD=<PASSWORD>
      - GO_DISCOVERY_DATABASE_HOST=db
      - GO_DISCOVERY_DATABASE_NAME=discovery_e2e_test
      - GO_DISCOVERY_LOG_LEVEL=info
      - GOMODCACHE=/gomodcache
      - WAITFORIT_TIMEOUT=300
      - PORT=8080
    ports:
      - 8080:8080
    volumes:
      - ../../:/pkgsite
      - $GOPATH/pkg/mod:/gomodcache
    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/seeddb/main.go"
    environment:
      - GO_DISCOVERY_DATABASE_USER=postgres
      - GO_DISCOVERY_DATABASE_PASSWORD=<PASSWORD>
      - GO_DISCOVERY_DATABASE_HOST=db
      - GO_DISCOVERY_DATABASE_NAME=discovery_e2e_test
      - GO_DISCOVERY_LOG_LEVEL=info
      - GOMODCACHE=/gomodcache
      - WAITFORIT_TIMEOUT=300
      - PORT=8080
    ports:
      - 8080:8080
    volumes:
      - ../../:/pkgsite
      - $GOPATH/pkg/mod:/gomodcache
    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://postgres:postgres@db:5432/discovery_e2e_test?sslmode=disable up"
    environment:
      - WAITFORIT_TIMEOUT=300
    volumes:
      - ../../:/pkgsite
    working_dir: /pkgsite
  db:
    image: postgres:11.12
    environment:
      - LANG=C
      - POSTGRES_PASSWORD=<PASSWORD>
      - POSTGRES_USER=postgres
      - POSTGRES_DB=discovery_e2e_test
    ports:
        - 5428:5432
  nodejs:
    image: node:14.17.0
    environment:
      # Use the values set on the host machine environment.
      - CI
      - GO_DISCOVERY_E2E_BASE_URL
      - GO_DISCOVERY_E2E_AUTHORIZATION
      - GO_DISCOVERY_E2E_QUOTA_BYPASS
      - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
    volumes:
      - ../../:/pkgsite
    working_dir: /pkgsite
<commit_msg>devtools/docker: allow custom db port<commit_after># 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_TESTDB=true
      - GO_DISCOVERY_DATABASE_TEST_PORT=5432
      - GO_DISCOVERY_DATABASE_TEST_HOST=db
      - GO_DISCOVERY_DATABASE_TEST_USER=postgres
      - GO_DISCOVERY_DATABASE_TEST_PASSWORD=<PASSWORD>
      - GOMODCACHE=/gomodcache
      # 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
      - $GOPATH/pkg/mod:/gomodcache
    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: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
  chrome:
    image: browserless/chrome:1.46-chrome-stable
    ports:
      - 3000:3000
    environment:
      - CONNECTION_TIMEOUT=120000
  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_USER=postgres
      - GO_DISCOVERY_DATABASE_PASSWORD=postgres
      - GO_DISCOVERY_DATABASE_HOST=db
      - GO_DISCOVERY_DATABASE_NAME=discovery_e2e_test
      - GO_DISCOVERY_LOG_LEVEL=info
      - GOMODCACHE=/gomodcache
      - WAITFORIT_TIMEOUT=300
      - PORT=8080
    ports:
      - 8080:8080
    volumes:
      - ../../:/pkgsite
      - $GOPATH/pkg/mod:/gomodcache
    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/seeddb/main.go"
    environment:
      - GO_DISCOVERY_DATABASE_USER=postgres
      - GO_DISCOVERY_DATABASE_PASSWORD=postgres
      - GO_DISCOVERY_DATABASE_HOST=db
      - GO_DISCOVERY_DATABASE_NAME=discovery_e2e_test
      - GO_DISCOVERY_LOG_LEVEL=info
      - GOMODCACHE=/gomodcache
      - WAITFORIT_TIMEOUT=300
      - PORT=8080
    ports:
      - 8080:8080
    volumes:
      - ../../:/pkgsite
      - $GOPATH/pkg/mod:/gomodcache
    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://postgres:postgres@db:5432/discovery_e2e_test?sslmode=disable up"
    environment:
      - WAITFORIT_TIMEOUT=300
    volumes:
      - ../../:/pkgsite
    working_dir: /pkgsite
  db:
    image: postgres:11.12
    environment:
      - LANG=C
      - POSTGRES_PASSWORD=<PASSWORD>
      - POSTGRES_USER=postgres
      - POSTGRES_DB=discovery_e2e_test
    ports:
        - ${GO_DISCOVERY_DATABASE_PORT:-5432}:5432
  nodejs:
    image: node:14.17.0
    environment:
      # Use the values set on the host machine environment.
      - CI
      - GO_DISCOVERY_E2E_BASE_URL
      - GO_DISCOVERY_E2E_AUTHORIZATION
      - GO_DISCOVERY_E2E_QUOTA_BYPASS
      - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
    volumes:
      - ../../:/pkgsite
    working_dir: /pkgsite

{'fraction_non_alphanumeric': 0.09774760211229658, 'fraction_numerical': 0.03416316413406617, 'mean_word_length': 2.347763347763348, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '955374', 'n_tokens_mistral': 3523, 'n_tokens_neox': 3306, 'n_words': 659}