Files

158 lines
4.9 KiB
YAML

name: ${COMPOSE_PROJECT_NAME:-lmnp-real-e2e}
x-e2e-fixed-instant: &e2e-fixed-instant '${E2E_FIXED_INSTANT:-2027-09-02T12:00:00Z}'
services:
mongodb:
image: docker.io/library/mongo:8.0.15
environment:
MONGO_INITDB_ROOT_USERNAME: e2e-root
MONGO_INITDB_ROOT_PASSWORD: e2e-root-password
entrypoint:
- /bin/bash
- -c
- |
if [ ! -s /data/configdb/keyfile ]; then
umask 077
openssl rand -base64 756 > /data/configdb/keyfile
fi
chmod 400 /data/configdb/keyfile
exec docker-entrypoint.sh mongod --replSet rs0 --keyFile /data/configdb/keyfile --bind_ip_all
volumes:
- e2e_mongodb_data:/data/db
- e2e_mongodb_config:/data/configdb
networks:
- e2e
healthcheck:
test:
- CMD-SHELL
- >-
mongosh --quiet --host localhost
--username "$${MONGO_INITDB_ROOT_USERNAME}"
--password "$${MONGO_INITDB_ROOT_PASSWORD}"
--authenticationDatabase admin
--eval 'try { rs.status() } catch (error) { rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27017"}]}) }; db.hello().isWritablePrimary'
| grep -q true
interval: 2s
timeout: 10s
retries: 30
start_period: 10s
dex:
build:
context: ./compose.e2e.d/dex
dockerfile: Dockerfile
command: [dex, serve, /etc/dex/config.yaml]
networks:
- e2e
healthcheck:
test:
[
CMD-SHELL,
wget -qO- http://127.0.0.1:5556/dex/.well-known/openid-configuration >/dev/null,
]
interval: 2s
timeout: 5s
retries: 30
start_period: 5s
insee:
build:
context: ./compose.e2e.d/insee
dockerfile: Dockerfile
networks:
- e2e
healthcheck:
test: [CMD, wget, -qO-, http://127.0.0.1:8080/health]
interval: 2s
timeout: 5s
retries: 30
backend:
build:
context: ./backend
dockerfile: Dockerfile
environment:
SPRING_PROFILES_ACTIVE: e2e
E2E_FIXED_INSTANT: *e2e-fixed-instant
SPRING_DATA_MONGODB_URI: mongodb://e2e-root:e2e-root-password@mongodb:27017/lmnp?authSource=admin&replicaSet=rs0&directConnection=true
OIDC_ISSUER_URI: http://dex:5556/dex
OIDC_CLIENT_ID: lmnp-client
OIDC_CLIENT_SECRET: lmnp-secret
OIDC_ADMIN_ROLE: admin
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_USER_NAME_ATTRIBUTE: sub
LMNP_ATTACHMENT_STORAGE_PATH: /data/attachments
INSEE_IRL_BASE_URI: http://insee:8080/series/
JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=55
volumes:
- e2e_attachment_data:/data/attachments
- e2e_lease_document_data:/data/leases
depends_on:
mongodb:
condition: service_healthy
dex:
condition: service_healthy
insee:
condition: service_healthy
networks:
- e2e
expose:
- '8080'
healthcheck:
test: [CMD-SHELL, wget -qO- http://127.0.0.1:8080/api/user | grep -q 'authenticated']
interval: 3s
timeout: 5s
retries: 40
start_period: 20s
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
depends_on:
backend:
condition: service_healthy
networks:
- e2e
expose:
- '80'
healthcheck:
test: [CMD-SHELL, wget -qO- http://127.0.0.1/ | grep -q '<app-root>']
interval: 2s
timeout: 5s
retries: 30
start_period: 5s
runner:
build:
context: ./frontend
dockerfile: e2e-real/runner.Dockerfile
environment:
E2E_BASE_URL: http://frontend
E2E_FIXED_INSTANT: *e2e-fixed-instant
E2E_AUTH_DIR: /tmp/e2e-real-auth
E2E_ARTIFACT_DIR: /work/artifacts
depends_on:
mongodb:
condition: service_healthy
dex:
condition: service_healthy
insee:
condition: service_healthy
backend:
condition: service_healthy
frontend:
condition: service_healthy
networks:
- e2e
networks:
e2e:
internal: true
volumes:
e2e_mongodb_data:
e2e_mongodb_config:
e2e_attachment_data:
e2e_lease_document_data: