graphql-engine/server/tests-py/docker-compose.yml
Samir Talwar c3afa0fdd7 Install and use ODBC Driver 18 for SQL Server (msodbcsql18).
This installs the ODBC Driver 18 for SQL Server in all our shipped Docker images, and update our tests and documentation accordingly.

This version supports arm64, and therefore can run natively (or via Docker) on macOS on aarch64.

`msodbcsql17` is still installed in production-targeted Docker images so that users do not _have_ to migrate to the new driver.

Nix expressions are packaged for the new driver, as it is not yet available in nixpkgs.

In this version, [the default encryption setting was changed from "no" to "yes"](https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228). In addition, "mandatory" and "optional" were added as synonyms for "yes" and "no" respectively.

I have therefore modified all connection strings in tests to specify `Encrypt=optional` (and changed some from `Encrypt=no`). I chose "optional" rather than "no" because I feel it's more honest; these connection strings will work with or without an encrypted connection.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6241
GitOrigin-RevId: 959f88dd1f271ef06a3616bc46b358f364f6cdfd
2022-10-21 16:25:04 +00:00

158 lines
4.9 KiB
YAML

# These services are brought up in 'run.sh' (see that file)
version: "3.6"
services:
cabal-update:
image: hasura/graphql-engine-server-builder:${DOCKER_PLATFORM:-}-${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- cabal
- update
volumes:
- .:/src
- hge-dist:/src/dist-newstyle
- cabal-cache:/root/.cabal
working_dir: /src
hge-build:
image: hasura/graphql-engine-server-builder:${DOCKER_PLATFORM:-}-${HASURA_GRAPHQL_ENGINE_SERVER_BUILDER_SHA}
command:
- sh
- -c
- |
set -ex
cabal build graphql-engine:exe:graphql-engine
cabal list-bin graphql-engine:exe:graphql-engine > dist-newstyle/bin.txt
volumes:
- ../..:/src
- /dev/null:/src/cabal.project.local # don't include cabal.project.local in build
- hge-dist:/src/dist-newstyle
- cabal-cache:/root/.cabal
working_dir: /src
depends_on:
cabal-update:
condition: service_completed_successfully
tests-py:
build:
context: ../..
dockerfile: ./.buildkite/dockerfiles/server-pytest-runner/Dockerfile
image: hasura/graphql-engine-server-pytest-runner:${HASURA_GRAPHQL_ENGINE_SERVER_PYTEST_RUNNER_SHA}
command:
- sh
- -c
- |
set -ex
export GRAPHQL_ENGINE="$$(cat dist-newstyle/bin.txt)"
./oss-.circleci/test-server.sh
environment:
- CIRCLE_NODE_INDEX=1
- CIRCLE_NODE_TOTAL=1
- OUTPUT_FOLDER=/output
- HASURA_GRAPHQL_DATABASE_URL=postgresql://postgres:hasura@tests-py-postgres-1/postgres
- HASURA_GRAPHQL_DATABASE_URL_2=postgresql://postgres:hasura@tests-py-postgres-2/postgres
- HASURA_GRAPHQL_CITUS_SOURCE_URL=postgresql://postgres:hasura@citus/postgres
- HASURA_GRAPHQL_MSSQL_SOURCE_URL=DRIVER={ODBC Driver 18 for SQL Server};SERVER=mssql,1433;Uid=sa;Pwd=Password!;Encrypt=optional
- HASURA_GRAPHQL_PG_SOURCE_URL_1=postgresql://postgres:hasura@tests-py-postgres-1/postgres
- HASURA_GRAPHQL_PG_SOURCE_URL_2=postgresql://postgres:hasura@tests-py-postgres-2/postgres
- HASURA_BIGQUERY_PROJECT_ID
- HASURA_BIGQUERY_SERVICE_KEY
- SERVER_TEST_TO_RUN
volumes:
- ../..:/src
- hge-dist:/src/dist-newstyle
- output:/output
working_dir: /src
depends_on:
citus:
condition: service_healthy
mssql-healthcheck:
condition: service_healthy
postgres:
condition: service_healthy
citus:
image: citusdata/citus:10.1@sha256:7e497e5ca18d7f2ae2a66c1d5d676b548e9221b7e6294adfb03006adad85502c
ports:
- 5432
environment:
POSTGRES_PASSWORD: "hasura"
healthcheck:
test:
- CMD-SHELL
- psql -U postgres < /dev/null && sleep 5 && psql -U postgres < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
volumes:
- /var/lib/postgresql/data
mssql:
# 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@sha256:a098c9ff6fbb8e1c9608ad7511fa42dba8d22e0d50b48302761717840ccc26af}
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.
mssql-healthcheck:
image: mcr.microsoft.com/mssql-tools
command:
- sleep
- inf
init: true # handle signals correctly
healthcheck:
test:
- CMD-SHELL
- |
/opt/mssql-tools/bin/sqlcmd -S 'mssql,1433' -U SA -P "Password!"
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
depends_on:
mssql:
condition: service_started
postgres:
image: cimg/postgres:14.4-postgis@sha256:492a389895568e2f89a03c0c45c19350888611001123514623551a014e83a625
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: "hasura"
healthcheck:
test:
- CMD-SHELL
- psql -U postgres < /dev/null && sleep 5 && psql -U postgres < /dev/null
start_period: 5s
interval: 5s
timeout: 10s
retries: 10
volumes:
- /var/lib/postgresql/data
deploy:
replicas: 2
volumes:
cabal-cache:
hge-dist:
output: