graphql-engine/docker-compose/databases.yaml
Samir Talwar 5910864845 Docker: Upgrade CockroachDB and help all databases shut down correctly.
1.  Upgrade CockroachDB to v22.2 stable, so we're no longer testing against a beta release.

2.  Use init when databases refuse to honor shutdown signals.

    Sometimes programs need help. Without this, CockroachDB and Azure SQL Edge (SQL Server for arm64) ignore the signal sent by `docker compose down` and wait to be forcibly killed, which doesn't seem very sensible.

    This might also be true for SQL Server itself, but I haven't tested it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7321
GitOrigin-RevId: b8085d1dd2974d3aaf09194916d7ceb3f459b6b5
2022-12-19 15:33:59 +00:00

151 lines
4.2 KiB
YAML

version: "3.6"
services:
mariadb:
image: mariadb:10
ports:
- 3306
environment:
MARIADB_USER: "hasura"
MARIADB_PASSWORD: "hasura"
MARIADB_DATABASE: "hasura"
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "true"
MARIADB_MYSQL_LOCALHOST_USER: "1"
volumes:
- /var/lib/mysql
healthcheck:
test:
- CMD
- /usr/local/bin/healthcheck.sh
- --connect
- --innodb_initialized
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
postgres:
image: postgis/postgis:15-3.3-alpine
platform: linux/amd64
command:
- -F # turn fsync off for speed
- -N 1000 # increase max connections from 100 so we can run more HGEs
ports:
- 5432
environment:
POSTGRES_PASSWORD: "password" # you probably want to override this
volumes:
- /var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- psql -U "$${POSTGRES_USER:-postgres}" < /dev/null && sleep 1 && psql -U "$${POSTGRES_USER:-postgres}" < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
citus:
image: citusdata/citus:11
platform: linux/amd64
command:
- -F # turn fsync off for speed
- -N 1000 # increase max connections from 100 so we can run more HGEs
- "-cclient_min_messages=error"
ports:
- 5432
environment:
POSTGRES_PASSWORD: "password" # you probably want to override this
volumes:
- /var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- psql -U "$${POSTGRES_USER:-postgres}" < /dev/null && sleep 1 && psql -U "$${POSTGRES_USER:-postgres}" < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
cockroach:
image: cockroachdb/cockroach:latest-v22.2
platform: linux/amd64
command:
- start-single-node
- --insecure
- --accept-sql-without-tls
init: true # doesn't shut down properly without this
ports:
- 26257
volumes:
- /cockroach/cockroach-data
healthcheck:
test:
- CMD-SHELL
- cockroach sql --insecure < /dev/null && sleep 1 && cockroach sql --insecure < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
yugabyte:
image: yugabytedb/yugabyte
command:
- bin/yugabyted
- start
- --daemon=false
- --initial_scripts_dir=/
ports:
- "65009:5433"
environment:
YSQL_USER: "hasura"
YSQL_PASSWORD: "hasura"
YSQL_DB: "hasura"
volumes:
- /var/lib/postgresql/data
sqlserver:
# We cannot use this image on arm64, as it's not available.
# Instead, we use `mcr.microsoft.com/azure-sql-edge`.
# This uses an environment variable so it can be overridden by scripts to
# provide that image instead.
image: ${MSSQL_IMAGE:-mcr.microsoft.com/mssql/server:2019-latest}
init: true # azure-sql-edge doesn't shut down properly without this
ports:
- 1433
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "Password!"
MSSQL_SA_PASSWORD: "Password!"
volumes:
- /var/opt/mssql
# We would prefer to attach the healthcheck directly to the `sqlserver` container.
# However, while we can do this in the `mcr.microsoft.com/mssql/server` image,
# it's not possible when running on macOS, as we don't use that image, but
# instead `mcr.microsoft.com/azure-sql-edge`.
# The `mcr.microsoft.com/azure-sql-edge` image does not provide `sqlcmd`.
# We therefore need to run it in a separate container.
# We can reconsider this once the MSSQL Server image can run on arm64.
sqlserver-healthcheck:
image: mcr.microsoft.com/mssql-tools
platform: linux/amd64
command:
- sleep
- inf
init: true # handle signals correctly
healthcheck:
test:
- CMD-SHELL
- |
/opt/mssql-tools/bin/sqlcmd -S 'sqlserver,1433' -U SA -P "Password!"
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
# This is commented out because this file can be extended, and dependencies don't work for extensions.
# Instead, ensure you also run this one.
# depends_on:
# sqlserver:
# condition: service_started