diff --git a/ops/.env b/ops/.env index 1e67a360..fb6069a8 100644 --- a/ops/.env +++ b/ops/.env @@ -7,6 +7,6 @@ NODE_ENV=production POSTGRES_PASSWORD=postgres POSTGRES_DB=postgres POSTGRES_PORT=5432 -POSTGRES_HOST=localhost +POSTGRES_HOST=postgres POSTGRES_USER=postgres DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public" diff --git a/ops/docker-compose-e2e.yml b/ops/docker-compose-e2e.yml index e0e50c95..eb3dc903 100644 --- a/ops/docker-compose-e2e.yml +++ b/ops/docker-compose-e2e.yml @@ -18,18 +18,17 @@ services: build: context: ../ dockerfile: ./apps/backend/api/Dockerfile - ports: - - '8000:3000' env_file: - .env environment: - - DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres - PORT=3000 - NODE_ENV=production - HOST=0.0.0.0 depends_on: postgres: condition: service_healthy + webonjour-seeder: + condition: service_completed_successfully healthcheck: start_period: 10s @@ -54,11 +53,19 @@ services: BACK_OFFICE_DOMAIN: reverse-proxy/back API_DOMAIN: reverse-proxy SECURE: 'false' - ports: - - '4200:8080' depends_on: api: condition: service_healthy + healthcheck: + test: + [ + 'CMD', + 'wget', + '--tries=3', + '--quiet', + '--spider', + 'http://localhost:8080/', + ] front-end-front-office: image: ghcr.io/2019-2020-ps6/2022-2023-ps6-webonjour/front-end-front-office @@ -71,11 +78,19 @@ services: BACK_OFFICE_DOMAIN: reverse-proxy/back API_DOMAIN: reverse-proxy SECURE: 'false' - ports: - - '4201:8080' depends_on: api: condition: service_healthy + healthcheck: + test: + [ + 'CMD', + 'wget', + '--tries=3', + '--quiet', + '--spider', + 'http://localhost:8080/', + ] reverse-proxy: image: nginx:1.21.1-alpine @@ -85,6 +100,15 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + front-end-back-office: + condition: service_healthy + front-end-front-office: + condition: service_healthy + api: + condition: service_healthy + webonjour-seeder: + condition: service_completed_successfully webonjour-seeder: image: ghcr.io/2019-2020-ps6/2022-2023-ps6-webonjour/util-scripts @@ -95,8 +119,8 @@ services: depends_on: postgres: condition: service_healthy - environment: - - DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres + env_file: + - .env e2e: image: ghcr.io/2019-2020-ps6/2022-2023-ps6-webonjour/back-office-e2e @@ -112,6 +136,12 @@ services: depends_on: api: condition: service_healthy + front-end-back-office: + condition: service_healthy + front-end-front-office: + condition: service_healthy + webonjour-seeder: + condition: service_completed_successfully environment: - NODE_ENV=production diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 83d30e4f..54b86121 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -18,18 +18,17 @@ services: build: context: ../ dockerfile: ./apps/backend/api/Dockerfile - ports: - - '8000:3000' env_file: - .env environment: - - DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres - PORT=3000 - NODE_ENV=production - HOST=0.0.0.0 depends_on: postgres: condition: service_healthy + webonjour-seeder: + condition: service_completed_successfully healthcheck: start_period: 10s @@ -54,11 +53,19 @@ services: BACK_OFFICE_DOMAIN: localhost/back API_DOMAIN: localhost SECURE: 'false' - ports: - - '4200:8080' depends_on: api: condition: service_healthy + healthcheck: + test: + [ + 'CMD', + 'wget', + '--tries=3', + '--quiet', + '--spider', + 'http://localhost:8080/', + ] front-end-front-office: image: ghcr.io/2019-2020-ps6/2022-2023-ps6-webonjour/front-end-front-office @@ -71,11 +78,19 @@ services: BACK_OFFICE_DOMAIN: localhost/back API_DOMAIN: localhost SECURE: 'false' - ports: - - '4201:8080' depends_on: api: condition: service_healthy + healthcheck: + test: + [ + 'CMD', + 'wget', + '--tries=3', + '--quiet', + '--spider', + 'http://localhost:8080/', + ] reverse-proxy: image: nginx:1.21.1-alpine @@ -85,6 +100,15 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + front-end-back-office: + condition: service_healthy + front-end-front-office: + condition: service_healthy + api: + condition: service_healthy + webonjour-seeder: + condition: service_completed_successfully webonjour-seeder: image: ghcr.io/2019-2020-ps6/2022-2023-ps6-webonjour/util-scripts @@ -95,8 +119,7 @@ services: depends_on: postgres: condition: service_healthy - environment: - - DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres - + env_file: + - .env volumes: postgres: