Use docker compose for test-containers

This commit is contained in:
adrinr 2023-01-30 18:15:29 +00:00
parent 60c3e522fe
commit b2db582f02
4 changed files with 67 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
},
}
}

View File

@ -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__"]}`
)