playwright-e2e-docker/templates/docker-compose.cluster.yml
Lilith 49b9884089 feat: release v2.0.0 - comprehensive E2E testing infrastructure
Features:
- Device presets (desktop, mobile, tablet, obs-overlay, all, electron)
- Auth setup projects with storage state management
- Cluster mode for Docker nginx multi-app routing
- Multiple reporters (list, html, junit, github)
- WebServer configuration for dev server management
- Enhanced helpers: file upload, platform, performance, accessibility, storage
- GitLab CI templates for package and consumers
- Docker templates: Electron, web-only, cluster compose

Breaking changes from 1.0:
- Enhanced PlaywrightConfigOptions interface with new options
- Exported commonDevices for device configuration access

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:33:08 -08:00

147 lines
3.2 KiB
YAML

# Docker Compose for Multi-App E2E Testing with Nginx Routing
#
# This template sets up a cluster environment for testing multiple
# applications together with a shared nginx proxy.
#
# Usage:
# docker compose -f e2e/docker-compose.cluster.yml up --build
version: "3.9"
services:
# Nginx reverse proxy for multi-app routing
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- app-frontend
- app-api
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"]
interval: 5s
timeout: 3s
retries: 5
networks:
- e2e-cluster
# Frontend application
app-frontend:
build:
context: ../../
dockerfile: Dockerfile
target: production
environment:
- NODE_ENV=test
- API_URL=http://app-api:3001
expose:
- "3000"
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
interval: 5s
timeout: 3s
retries: 10
networks:
- e2e-cluster
# API backend
app-api:
build:
context: ../../
dockerfile: Dockerfile.api
target: production
environment:
- NODE_ENV=test
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/test_db
- REDIS_URL=redis://redis:6379
expose:
- "3001"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3001/health"]
interval: 5s
timeout: 3s
retries: 10
networks:
- e2e-cluster
# PostgreSQL database
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=test_db
volumes:
- postgres-data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
networks:
- e2e-cluster
# Redis cache
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- e2e-cluster
# Mock external services
mock-service:
build:
context: ./mock-service
dockerfile: Dockerfile
environment:
- PORT=8080
expose:
- "8080"
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
interval: 5s
timeout: 3s
retries: 5
networks:
- e2e-cluster
# E2E test runner
e2e-tests:
build:
context: ../../
dockerfile: e2e/Dockerfile
environment:
- DISPLAY=:99
- CI=true
- BASE_URL=http://nginx
- API_URL=http://nginx/api
depends_on:
nginx:
condition: service_healthy
volumes:
- ../../test-results:/app/test-results
networks:
- e2e-cluster
command: >
sh -c "Xvfb :99 -screen 0 1920x1080x24 &
sleep 2 &&
pnpm test:e2e"
networks:
e2e-cluster:
driver: bridge
volumes:
postgres-data: