graphql-engine/docker-compose.yaml
Samir Talwar 3670a10ee5 Share database configuration across tests.
This enables sharing the Docker Compose-based database configuration across the Haskell-based API tests and the legacy Python integration tests.

Why? Because we depend on different database versions and I keep running out of disk space. I am far too lazy to buy another disk and set up my operating system _again_.

The files in question are:

- _docker-compose/databases.yaml_, which is the base specification for the databases
- _docker-compose.yml_, used by the API tests locally (and for other manual testing), which extends the above
- _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, used by the API tests in CI, which extends _databases.yaml_
- _server/tests-py/docker-compose.yml_, used by the Python integration tests

The changes are summarized as follows:

1. The following snippets are moved from _docker-compose/databases.yaml_ to _docker-compose.yml_ and _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, as they're not strictly necessary for other forms of testing:
    - the fixed port mappings (in the range 65000–65010)
    - the PostgreSQL initialization
    - the SQL Server initialization
2. Environment variables are used a little more in health checks and initialization scripts, as usernames, passwords, etc. can be overridden.
3. The volumes in _docker-compose/databases.yaml_ are made anonymous (unnamed), and the names are only specified in _docker-compose.yml_. We don't need to do this elsewhere.
    - For extra fun, I have removed all named volumes from the CI Docker Compose files, as they seem to be unnecessary.
4. _server/tests-py/docker-compose.yml_ now depends on _docker-compose/databases.yaml_.
    - This was the point.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6864
GitOrigin-RevId: f22f2839716f543ce8a62f890da244de7e23abaa
2022-11-15 14:32:46 +00:00

123 lines
2.8 KiB
YAML

# This file extends the base Docker Compose files to make manual testing easy.
#
# Run the following to get started:
#
# docker compose up -d
#
# That will start up services in the background. To take them down, you have to
# run:
#
# docker compose down
#
# If you changed DB init scripts, then you should also run:
#
# docker compose down -v
#
# That'll delete the volumes. Otherwise e.g. PostgreSQL will skip initializing
# if a DB already exists.
#
# If you omit `-d`, it'll run them all in the foreground, then you can stop them
# with your usual Ctrl-C terminal command.
#
# Facts:
#
# * The SERVICE PORTS numbering start at 65001, 65002, etc. to avoid bother
# existing instances of databases.
#
# * The login credentials are, where possible, all "hasura" to avoid unnecessary
# mental overhead.
version: "3.6"
services:
mariadb:
extends:
file: docker-compose/databases.yaml
service: mariadb
ports:
- "65001:3306"
volumes:
- mariadb-data:/var/lib/mysql
postgres:
extends:
file: docker-compose/databases.yaml
service: postgres
ports:
- "65002:5432"
environment:
POSTGRES_USER: "hasura"
POSTGRES_PASSWORD: "hasura"
POSTGRES_DB: "hasura"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./docker-compose/postgres/init.sh:/docker-entrypoint-initdb.d/init-hasura.sh:ro
citus:
extends:
file: docker-compose/databases.yaml
service: citus
ports:
- "65004:5432"
environment:
POSTGRES_USER: "hasura"
POSTGRES_PASSWORD: "hasura"
POSTGRES_DB: "hasura"
volumes:
- citus-data:/var/lib/postgresql/data
- ./docker-compose/postgres/init.sh:/docker-entrypoint-initdb.d/init-hasura.sh:ro
cockroach:
extends:
file: docker-compose/databases.yaml
service: cockroach
ports:
- "65008:26257"
environment:
COCKROACH_USER: "root"
COCKROACH_DATABASE: "hasura"
volumes:
- cockroach-data:/cockroach/cockroach-data
sqlserver:
extends:
file: docker-compose/databases.yaml
service: sqlserver
ports:
- "65003:1433"
volumes:
- mssql-data:/var/opt/mssql
sqlserver-healthcheck:
extends:
file: docker-compose/databases.yaml
service: sqlserver-healthcheck
depends_on:
sqlserver:
condition: service_started
sqlserver-init:
extends:
file: docker-compose/sqlserver-init/docker-compose.yaml
service: sqlserver-init
depends_on:
sqlserver:
condition: service_started
dc-reference-agent:
extends:
file: dc-agents/docker-compose.yaml
service: dc-reference-agent
dc-sqlite-agent:
extends:
file: dc-agents/docker-compose.yaml
service: dc-sqlite-agent
volumes:
citus-data:
cockroach-data:
mariadb-data:
mssql-data:
postgres-data: