companion/@tooling/e2e/docker-compose.e2e.yml

119 lines
3.1 KiB
YAML
Raw Permalink Normal View History

# E2E test stack for @companion
#
# Starts postgres + redis + companion-api + companion-web (nginx), then runs
# Playwright headless against the full stack.
#
# Usage (from monorepo root):
# docker compose -f ./@tooling/e2e/docker-compose.e2e.yml up --build \
# --abort-on-container-exit --exit-code-from e2e-tests
#
# Or via the run script:
# ./run e2e:docker
# LAN registry hosts (forge.black.lan, npm.black.lan → 10.0.0.11)
x-lan-hosts: &lan-hosts
extra_hosts:
- "forge.black.lan:10.0.0.11"
- "npm.black.lan:10.0.0.11"
x-lan-build: &lan-build
args:
- BUILDKIT_SANDBOX_HOSTNAME=builder
extra_hosts:
- "forge.black.lan:10.0.0.11"
- "npm.black.lan:10.0.0.11"
services:
e2e-postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: companion
POSTGRES_PASSWORD: companion
POSTGRES_DB: companion_test
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U companion -d companion_test']
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
e2e-redis:
image: redis:7-alpine
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
start_period: 5s
companion-api:
<<: *lan-hosts
build:
context: ../..
dockerfile: "./@tooling/e2e/Dockerfile.api.e2e"
<<: *lan-build
environment:
NODE_ENV: test
API_PORT: '3850'
DATABASE_HOST: e2e-postgres
DATABASE_PORT: '5432'
DATABASE_USER: companion
DATABASE_PASSWORD: companion
DATABASE_NAME: companion_test
DATABASE_SYNCHRONIZE: 'true'
REDIS_URL: "redis://e2e-redis:6379"
CHAT_MODEL: stub
VAPID_PUBLIC_KEY: "BMrVU3JFoq8bX0YEwUTsHvoIGmzWBluhT98IZXqMQ1vHdFtD1SQlKUJx5DeftHFhYuhfRw-4DOL5wfcQ8fXqDTo"
VAPID_PRIVATE_KEY: "H_Rllr7WXAgOajWjVBFY7yIxVwR2HiDlz0BeNJfbYKs"
VAPID_SUBJECT: "mailto:test@example.com"
PUSH_FIRE_TOKEN: "e2e-test-token"
depends_on:
e2e-postgres:
condition: service_healthy
e2e-redis:
condition: service_healthy
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3850/health']
interval: 5s
timeout: 5s
retries: 12
start_period: 15s
companion-web:
<<: *lan-hosts
build:
context: ../..
dockerfile: "./@tooling/e2e/Dockerfile.web.e2e"
<<: *lan-build
depends_on:
companion-api:
condition: service_healthy
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:5850/']
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
e2e-tests:
<<: *lan-hosts
build:
context: ../..
dockerfile: "./@tooling/e2e/Dockerfile.e2e"
<<: *lan-build
depends_on:
companion-api:
condition: service_healthy
companion-web:
condition: service_healthy
environment:
CI: 'true'
PLAYWRIGHT_BASE_URL: 'http://companion-web:5850'
volumes:
- ../../test-results:/app/test-results
- ../../playwright-report:/app/playwright-report
networks:
default:
name: companion-e2e-network