From f13ea890ef1075c566a90e065c5c1589230e1900 Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 30 Apr 2024 23:28:23 +0200 Subject: [PATCH] test: docker compose e2e --- .github/workflows/e2e.yml | 2 +- webapp/e2e/docker-compose.yml | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 webapp/e2e/docker-compose.yml diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index f9a3ed84..df32e00e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,7 +19,7 @@ jobs: - run: openssl pkcs12 -export -out server.p12 -inkey server.key -in server.crt -passout pass:${{ secrets.E2E_SSL_PASSWORD }} - run: sudo mkdir /certs - run: sudo mv server.p12 /certs/keystore.p12 - - run: docker compose --profile e2e up -d --pull always + - run: docker compose -f ./webapp/e2e/docker-compose.yml up -d --pull always - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e \ No newline at end of file diff --git a/webapp/e2e/docker-compose.yml b/webapp/e2e/docker-compose.yml new file mode 100644 index 00000000..664445c3 --- /dev/null +++ b/webapp/e2e/docker-compose.yml @@ -0,0 +1,76 @@ + version: '3' + services: + WIQ_DB: + container_name: postgresql-${teamname:-defaultASW} + environment: + POSTGRES_USER: ${DATABASE_USER} + POSTGRES_PASSWORD: ${DATABASE_PASSWORD} + volumes: + - postgres_data:/var/lib/postgresql/data + image: postgres:latest + profiles: ["dev", "prod","e2e"] + networks: + mynetwork: + + api: + container_name: api-${teamname:-defaultASW} + build: + context: ./api + args: + DATABASE_USER: ${DATABASE_USER} + DATABASE_PASSWORD: ${DATABASE_PASSWORD} + JWT_SECRET: ${JWT_SECRET} + SSL_PASSWORD: ${SSL_PASSWORD} + dockerfile: Dockerfile + environment: + - DATABASE_URL=jdbc:postgresql://WIQ_DB:5432/wiq + - DATABASE_USER=${DATABASE_USER} + - DATABASE_PASSWORD=${DATABASE_PASSWORD} + - JWT_SECRET=${JWT_SECRET} + - SSL_PASSWORD=${SSL_PASSWORD} + ports: + - 8443:8443 + networks: + mynetwork: + volumes: + - /certs:/etc/letsencrypt/live/kiwiq.run.place:ro + depends_on: + - WIQ_DB + - kiwiq + + question-generator: + container_name: question-generator-${teamname:-defaultASW} + build: + context: ./questiongenerator + args: + DATABASE_USER: ${DATABASE_USER} + DATABASE_PASSWORD: ${DATABASE_PASSWORD} + dockerfile: Dockerfile + environment: + - DATABASE_URL=jdbc:postgresql://WIQ_DB:5432/wiq + - DATABASE_USER=${DATABASE_USER} + - DATABASE_PASSWORD=${DATABASE_PASSWORD} + networks: + mynetwork: + depends_on: + - WIQ_DB + + webapp: + container_name: webapp-${teamname:-defaultASW} + build: + args: + REACT_APP_API_ENDPOINT: ${API_URI} + context: ./webapp + dockerfile: Dockerfile + environment: + - REACT_APP_API_ENDPOINT=${API_URI} + networks: + mynetwork: + + volumes: + postgres_data: + certs: + + networks: + mynetwork: + driver: bridge