-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
150 lines (144 loc) · 4.81 KB
/
docker-compose.yml
File metadata and controls
150 lines (144 loc) · 4.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Docker Compose configuration for SOAR E2E testing
#
# This configuration is specifically designed for running end-to-end tests.
# It is NOT used for production deployment (which uses systemd services)
# or daily development (which uses `cargo run` directly).
#
# Key features:
# - Source code is mounted from the host for live editing
# - Cargo build artifacts are cached for fast rebuilds
# - Initial compile takes ~10 minutes, subsequent builds are much faster
#
# Services:
# - postgres: PostgreSQL with PostGIS and pg_partman extensions
# - nats: NATS messaging server
# - mailpit: Email testing service (SMTP + web UI)
# - soar: Main application container (builds from source)
#
# Usage:
# ./scripts/run-acceptance-tests # Run E2E tests
# ./scripts/run-acceptance-tests --update-snapshots # Update screenshot baselines
# docker compose up postgres nats mailpit # Start infrastructure only
# docker compose down # Stop all services
services:
# PostgreSQL database with PostGIS and pg_partman extensions
postgres:
build:
context: .
dockerfile: .github/postgis-partman.Dockerfile
image: postgis-partman:test
container_name: soar-postgres-test
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: soar_test
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
networks:
- soar-network
# NATS messaging server
nats:
image: nats:2.10-alpine
container_name: soar-nats-test
command:
- "-m" # Enable monitoring
- "8222" # Monitoring port
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8222/healthz"]
interval: 5s
timeout: 3s
retries: 5
networks:
- soar-network
# Mailpit email testing server
mailpit:
image: axllent/mailpit:v1.20
container_name: soar-mailpit-test
# Ports are not exposed to host - containers communicate via soar-network
# For local debugging, access via: docker exec -it soar-mailpit-test wget -qO- http://localhost:8025
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8025/api/v1/info"]
interval: 5s
timeout: 3s
retries: 5
networks:
- soar-network
# SOAR backend application
# Uses base Rust image and builds from mounted source code.
# This allows live code editing while maintaining build artifact caching.
soar:
# Use base Rust image instead of building a Docker image
image: rust:1-slim-bookworm
container_name: soar-app-test
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_healthy
mailpit:
condition: service_healthy
volumes:
# Mount source code from host (enables live editing)
- .:/workspace
# Cache cargo dependencies and build artifacts (enables fast rebuilds)
- cargo-cache:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
- target-cache:/workspace/target
working_dir: /workspace
environment:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/soar_test
NATS_URL: nats://nats:4222
JWT_SECRET: test-jwt-secret-for-e2e-tests
SOAR_ENV: test
SENTRY_DSN: ""
RUST_LOG: info
# SMTP configuration (Mailpit)
SMTP_SERVER: mailpit
SMTP_PORT: 1025
SMTP_USERNAME: test
SMTP_PASSWORD: test
FROM_EMAIL: test@soar.local
FROM_NAME: SOAR Test
BASE_URL: http://localhost:4173
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:61226/"]
interval: 10s
timeout: 3s
retries: 5
# Extended start period for initial cargo build (can take 10+ minutes)
start_period: 600s
networks:
- soar-network
# Install build dependencies and compile on startup
command: >
sh -c "
echo 'Installing build dependencies...' &&
apt-get update > /dev/null 2>&1 &&
apt-get install -y --no-install-recommends clang build-essential pkg-config libssl-dev libpq-dev curl > /dev/null 2>&1 &&
echo 'Building application (using cached artifacts)...' &&
SKIP_WEB_BUILD=1 cargo build --release &&
echo 'Running migrations...' &&
./target/release/soar migrate &&
echo 'Seeding test data...' &&
./target/release/soar seed-test-data &&
echo 'Starting web server...' &&
./target/release/soar web --port 61226 --interface 0.0.0.0 --test-mode
"
volumes:
postgres-data:
driver: local
# Persist Rust build cache between runs for fast rebuilds
cargo-cache:
driver: local
cargo-git:
driver: local
target-cache:
driver: local
networks:
soar-network:
driver: bridge