-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yaml
193 lines (174 loc) · 5.01 KB
/
docker-compose.yaml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
services:
postgres:
image: postgres:15.6
restart: unless-stopped
environment:
POSTGRES_PASSWORD: postgres
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d task-svc -q"]
interval: 10s
timeout: 2s
retries: 5
eventstore:
image: eventstore/eventstore:23.10.2-jammy
restart: unless-stopped
environment:
EVENTSTORE_TELEMETRY_OPTOUT: "true"
EVENTSTORE_LOG_LEVEL: "Warning"
EVENTSTORE_INSECURE: "true"
EVENTSTORE_RUN_PROJECTIONS: "All"
EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: "true"
ports:
- "2113:2113"
spicedb:
image: authzed/spicedb:v1.31.0
ports:
- "50051:50051"
command: [
"serve",
"--grpc-preshared-key", "helpwave",
"--otel-endpoint", "jaeger:4317",
"--otel-insecure",
"--otel-sample-ratio", "1",
"--otel-provider", "otlpgrpc"
]
redis:
image: redis:6
restart: unless-stopped
ports:
- "6379:6379"
jaeger:
image: jaegertracing/all-in-one:1.60
environment:
COLLECTOR_OTLP_ENABLED: "true"
ports:
- "16686:16686" # api and UI
- "4317:4317" # OTLP (grpc)
# dapr by default uses mDNS for service discovery,
# unfortunately multicast IP and docker networks don't play nice together,
# so we use consul for service discovery
consul:
image: consul:1.15.4
restart: unless-stopped
command: "agent -dev -client 0.0.0.0 -log-level error"
apisix:
build:
context: ..
dockerfile: Dockerfile.apisix
restart: unless-stopped
depends_on:
- services
volumes:
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
- ../apisix/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro
environment:
NO_DAPR: true
ports:
- "9080:9080"
# dapr sidecar for apisix
apisix-dapr:
image: "daprio/daprd:1.14.1"
restart: unless-stopped
depends_on:
- apisix
volumes:
- ./dapr.yaml:/dapr.yaml:ro
command: [
"./daprd",
"--app-id", "gateway",
"--dapr-http-read-buffer-size", "8",
"--config", "/dapr.yaml",
"--log-level", "debug",
"--app-port", "9080",
"--metrics-port", "9099",
"--dapr-internal-grpc-port", "35001"
]
network_mode: "service:apisix"
# services compiles and runs all services using dapr_run.yaml
# also runs initial migrations for all services
services:
build:
context: ../images/dev-go-custom
args:
# renovate: dev-tag
TAG: '15'
UID: ${UID:-1000}
GID: ${GID:-1000}
volumes:
# we currently don't mount (i.e. persist) the go module cache
# this increases consistency in builds and dependencies, in trade for increased initial startup time
# mounts the whole repo
- ../:/helpwave
# shared go cache with devcontainer
- gomodcache:/go/pkg # $GOMODCACHE
- gocache:/home/helpwave/.cache/go-build # $GOCACHE
working_dir: /helpwave
user: "helpwave"
depends_on:
postgres:
condition: service_healthy
consul:
condition: service_started
spicedb:
condition: service_started
environment:
SECRETSTORE_REDIS_HOST: "redis:6379"
ZED_ENDPOINT: spicedb:50051
ZED_TOKEN: helpwave
ZED_INSECURE: true
command:
- /usr/bin/bash
- -c
- |
bash migrate.sh
go run cmd/spice/spice.go migrate
dapr run --run-file dev/dapr_run.yaml --config dev/dapr.yaml
restart: unless-stopped
network_mode: "service:devcontainer" # share ports with devcontainer
# devcontainer is where the developer should do their development in
devcontainer:
build:
context: ../images/dev-go-custom
args:
# renovate: dev-tag
TAG: '15'
UID: ${UID:-1000}
GID: ${GID:-1000}
volumes:
# mounts the whole repo
- ../:/helpwave
# shared go cache with services
- gomodcache:/go/pkg # $GOMODCACHE
- gocache:/home/helpwave/.cache/go-build # $GOCACHE
# mounts the docker socket (allows DooD)
- ${DOCKER_SOCK:-/var/run/docker.sock}:/var/run/docker.sock
working_dir: /helpwave
user: "helpwave"
environment:
# psql variables, allows easy management / debugging of postgres using `psql -d <database>`
PGHOST: postgres
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
# zed variables
ZED_ENDPOINT: spicedb:50051
ZED_TOKEN: helpwave
ZED_INSECURE: true
COMPOSE_FILE: "/helpwave/dev/docker-compose.yaml" # allows us to use `docker compose` in any directory
restart: unless-stopped
command: sleep infinity
ports:
# all of these ports are bound to in services
- "3001:3001" # task-svc
- "3002:3002" # user-svc
- "3004:3004" # tasks-svc
- "3005:3005" # property-svc
- "3006:3006" # updates-svc
volumes:
gocache: {}
gomodcache: {}