diff --git a/hosting/.env b/hosting/.env index 7616487c40..c5638a266f 100644 --- a/hosting/.env +++ b/hosting/.env @@ -8,8 +8,6 @@ MINIO_ACCESS_KEY=budibase MINIO_SECRET_KEY=budibase COUCH_DB_PASSWORD=budibase COUCH_DB_USER=budibase -COUCHDB_PASSWORD=budibase -COUCHDB_USER=budibase REDIS_PASSWORD=budibase INTERNAL_API_KEY=budibase diff --git a/hosting/docker-compose.test.yaml b/hosting/docker-compose.test.yaml new file mode 100644 index 0000000000..bd329f1869 --- /dev/null +++ b/hosting/docker-compose.test.yaml @@ -0,0 +1,59 @@ +version: "3" + +# optional ports are specified throughout for more advanced use cases. + +services: + minio-service: + restart: on-failure + # Last version that supports the "fs" backend + image: minio/minio:RELEASE.2022-10-24T18-35-07Z + ports: + - 9000 + - 9001 + environment: + MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} + command: server /data --console-address ":9001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + couchdb-service: + # platform: linux/amd64 + restart: on-failure + image: budibase/couchdb + environment: + - COUCHDB_PASSWORD=${COUCH_DB_PASSWORD} + - COUCHDB_USER=${COUCH_DB_USER} + ports: + - 5984 + - 4369 + - 9100 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5984/_up"] + interval: 30s + timeout: 20s + retries: 3 + + redis-service: + restart: on-failure + image: redis + command: redis-server --requirepass ${REDIS_PASSWORD} + ports: + - 6379 + healthcheck: + test: ["CMD", "redis-cli", "ping"] + + # wait-for-load: + # container_name: wait + # image: curlimages/curl + # depends_on: + # minio-service: + # condition: service_healthy + # couchdb-service: + # condition: service_healthy + # redis-service: + # condition: service_healthy + # restart: always diff --git a/jestTestcontainersConfigGenerator.js b/jestTestcontainersConfigGenerator.js index ad032ed82e..ba91090a91 100644 --- a/jestTestcontainersConfigGenerator.js +++ b/jestTestcontainersConfigGenerator.js @@ -1,16 +1,9 @@ - - module.exports = dependenciesEnv => { return { - devEnv: { - image: "budibase/dependencies", - tag: "latest", - ports: [6379, 5984, 9000], - env: dependenciesEnv, - wait: { - type: "text", - text: "Test environment started...", - }, - } + dockerCompose: { + composeFilePath: "../../hosting", + composeFile: "docker-compose.test.yaml", + startupTimeout: 10000, + }, } } diff --git a/packages/worker/src/tests/jestSetup.ts b/packages/worker/src/tests/jestSetup.ts index 89ffb85b95..1e98c528fd 100644 --- a/packages/worker/src/tests/jestSetup.ts +++ b/packages/worker/src/tests/jestSetup.ts @@ -30,14 +30,14 @@ const globalSafe = global as any overrideConfigValue( "COUCH_DB_PORT", - globalSafe.__TESTCONTAINERS_DEVENV_PORT_5984__ + globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_PORT_5984__"] ) overrideConfigValue( "COUCH_DB_URL", - `http://${globalSafe.__TESTCONTAINERS_DEVENV_IP__}:${globalSafe.__TESTCONTAINERS_DEVENV_PORT_5984__}` + `http://${globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_IP__"]}:${globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_PORT_5984__"]}` ) overrideConfigValue( "MINIO_URL", - `http://${globalSafe.__TESTCONTAINERS_DEVENV_IP__}:${globalSafe.__TESTCONTAINERS_DEVENV_PORT_9000__}` + `http://${globalSafe["__TESTCONTAINERS_MINIO-SERVICE-1_IP__"]}:${globalSafe["__TESTCONTAINERS_MINIO-SERVICE-1_PORT_9000__"]}` )