-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.e2e.yml
More file actions
178 lines (168 loc) · 5.27 KB
/
Copy pathdocker-compose.e2e.yml
File metadata and controls
178 lines (168 loc) · 5.27 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Full-stack E2E test environment.
#
# Usage:
# docker compose -f docker-compose.e2e.yml up --build -d
# E2E_SERVER_URL=http://127.0.0.1:3000 E2E_DATABASE_URL=postgres://postgres:password@127.0.0.1:5433/broccoli cargo test -p server --test e2e
# docker compose -f docker-compose.e2e.yml down -v
#
# China mirrors:
# docker compose -f docker-compose.e2e.yml build --build-arg USE_CN_MIRRORS=true
#
x-worker-common: &worker-common
build:
context: .
dockerfile: Dockerfile.worker
# Pin to host architecture so libseccomp inside isolate matches the kernel.
# Apple Silicon hosts with DOCKER_DEFAULT_PLATFORM=linux/amd64 in their
# shell would otherwise produce x86_64 images that run under Rosetta and
# break isolate's seccomp_load. Override with WORKER_PLATFORM=linux/amd64
# on native amd64 hosts.
platforms:
- ${WORKER_PLATFORM:-linux/arm64}
platform: ${WORKER_PLATFORM:-linux/arm64}
privileged: true
security_opt:
- seccomp=unconfined
- apparmor=unconfined
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
seaweedfs:
condition: service_healthy
seaweedfs-init:
condition: service_completed_successfully
environment: &worker-env
BROCCOLI__DATABASE__URL: "postgres://postgres:password@db:5432/broccoli"
BROCCOLI__MQ__URL: "redis://redis:6379"
BROCCOLI__MQ__ENABLED: "true"
BROCCOLI__WORKER__SANDBOX_BACKEND: "isolate"
BROCCOLI__WORKER__ISOLATE_BIN: "isolate"
BROCCOLI__WORKER__ENABLE_CGROUPS: "true"
BROCCOLI__STORAGE__BACKEND: "object_storage"
BROCCOLI__STORAGE__OBJECT_STORAGE__BUCKET: "broccoli-blobs"
BROCCOLI__STORAGE__OBJECT_STORAGE__REGION: "us-east-1"
BROCCOLI__STORAGE__OBJECT_STORAGE__ENDPOINT: "http://seaweedfs:8333"
BROCCOLI__STORAGE__OBJECT_STORAGE__ACCESS_KEY: "broccoli_s3_access"
BROCCOLI__STORAGE__OBJECT_STORAGE__SECRET_KEY: "broccoli_s3_secret"
BROCCOLI__STORAGE__OBJECT_STORAGE__PATH_STYLE: "true"
BROCCOLI__STORAGE__DATA_DIR: "/data"
RUST_LOG: "info"
restart: unless-stopped
services:
db:
image: postgres:17-alpine
ports:
- "127.0.0.1:5433:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: broccoli
volumes:
- e2e_pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d broccoli"]
interval: 3s
timeout: 3s
retries: 10
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6380:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 3s
retries: 10
seaweedfs:
image: chrislusf/seaweedfs:4.15
command:
[
"server",
"-dir=/data",
"-s3",
"-s3.config=/etc/seaweedfs/s3.json",
"-ip=seaweedfs",
]
ports:
- "127.0.0.1:9333:9333"
- "127.0.0.1:8333:8333"
volumes:
- e2e_seaweed_data:/data
- ./config/seaweedfs-s3.json:/etc/seaweedfs/s3.json:ro
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9333/"]
interval: 3s
timeout: 3s
retries: 20
seaweedfs-init:
image: chrislusf/seaweedfs:4.15
depends_on:
seaweedfs:
condition: service_healthy
entrypoint: ["sh", "-c"]
command:
[
"printf 's3.bucket.create -name broccoli-blobs\\n' | weed shell -master=seaweedfs:9333 -filer=seaweedfs:8888",
]
restart: "no"
server:
build:
context: .
dockerfile: Dockerfile.server
ports:
- "127.0.0.1:3000:3000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
seaweedfs:
condition: service_healthy
seaweedfs-init:
condition: service_completed_successfully
environment:
BROCCOLI__SERVER__HOST: "0.0.0.0"
BROCCOLI__SERVER__PORT: "3000"
BROCCOLI__DATABASE__URL: "postgres://postgres:password@db:5432/broccoli"
BROCCOLI__MQ__URL: "redis://redis:6379"
BROCCOLI__MQ__ENABLED: "true"
BROCCOLI__AUTH__JWT_SECRET: "e2e-docker-jwt-secret"
BROCCOLI__PLUGIN__PLUGINS_DIR: "/plugins"
BROCCOLI__STORAGE__BACKEND: "object_storage"
BROCCOLI__STORAGE__OBJECT_STORAGE__BUCKET: "broccoli-blobs"
BROCCOLI__STORAGE__OBJECT_STORAGE__REGION: "us-east-1"
BROCCOLI__STORAGE__OBJECT_STORAGE__ENDPOINT: "http://seaweedfs:8333"
BROCCOLI__STORAGE__OBJECT_STORAGE__ACCESS_KEY: "broccoli_s3_access"
BROCCOLI__STORAGE__OBJECT_STORAGE__SECRET_KEY: "broccoli_s3_secret"
BROCCOLI__STORAGE__OBJECT_STORAGE__PATH_STYLE: "true"
BROCCOLI__SUBMISSION__RATE_LIMIT_PER_MINUTE: "10000"
RUST_LOG: "info"
volumes:
- ./plugins:/plugins:ro
healthcheck:
test: ["CMD", "/usr/local/bin/broccoli-server", "--healthcheck"]
interval: 5s
timeout: 5s
retries: 30
start_period: 15s
restart: unless-stopped
worker-1:
<<: *worker-common
environment:
<<: *worker-env
BROCCOLI__WORKER__ID: "worker-1"
worker-2:
<<: *worker-common
environment:
<<: *worker-env
BROCCOLI__WORKER__ID: "worker-2"
worker-3:
<<: *worker-common
environment:
<<: *worker-env
BROCCOLI__WORKER__ID: "worker-3"
volumes:
e2e_pg_data:
e2e_seaweed_data: