-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
209 lines (186 loc) · 6.11 KB
/
Copy pathdocker-compose.yml
File metadata and controls
209 lines (186 loc) · 6.11 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: authentication
services:
auth-api:
container_name: auth-api
image: ghcr.io/viwenkepu/authentication:latest
hostname: auth-api
restart: on-failure
build:
context: src/
dockerfile: Authentication/Dockerfile
environment:
ASPNETCORE_ENVIRONMENT: Development
# JWT
JsonWebTokenOption__Secret: ${AUTH__JWT_SECRET}
JsonWebTokenOption__ValidIssuers__0: auth-api
JsonWebTokenOption__ValidIssuers__1: http://localhost:5056
JsonWebTokenOption__ValidAudiences__0: http://localhost:5109
JsonWebTokenOption__ValidAudiences__1: http://localhost:5056
# Token validation
TokenValidationParameterOption__Secret: ${AUTH__JWT_SECRET}
TokenValidationParameterOption__ValidIssuers__0: auth-api
TokenValidationParameterOption__ValidIssuers__1: http://localhost:5056
TokenValidationParameterOption__ValidAudiences__0: http://localhost:5109
TokenValidationParameterOption__ValidAudiences__1: http://localhost:5056
# API key
ApiKeyAuthenticationOption__ApiKeyHeaderValue: ${AUTH__API_KEY}
# Database
DatabaseConfigurationOption__DatabaseProviderConfiguration__ConnectionString: server=postgres;port=5432;user id=${POSTGRES_USER};password=${POSTGRES_PASSWORD};database=${POSTGRES_DB}
# CORS
CorsPolicyOption__AllowedCorsOrigins__0: http://localhost:5109
# OTel
OpenTelemetryConfigurationOption__Endpoint: http://otel-collector:4317
# Passkey origins
PassKeyAuthenticationOption__AllowedOrigins__0: http://localhost:5109
PassKeyAuthenticationOption__AllowedOrigins__1: http://localhost:5056
ports:
- "5056:8080"
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1" ]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
depends_on:
postgres:
condition: service_healthy
##################################
# Database
postgres:
image: postgres:16.3-alpine
hostname: postgres
container_name: postgres
restart: on-failure
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgresqlsystem:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 5s
timeout: 5s
retries: 5
##################################
# Observability
otel-collector:
image: otel/opentelemetry-collector-contrib:0.116.1
hostname: otel-collector
container_name: otel-collector
environment:
DEPLOY_ENV: dev
OTEL_COL_VERSION: "0.116.1"
HOSTNAME: otel-collector
volumes:
- ./config/otel-collector/otel-collector-config.yaml:/etc/otel-collector-config.yaml
command: [ "--config=/etc/otel-collector-config.yaml" ]
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
- "55679:55679" # zpages extension
depends_on:
- loki
- tempo
- prometheus
loki:
image: grafana/loki:3.7.3
hostname: loki
container_name: loki
command:
- -config.file=/etc/loki/loki-config.yml
volumes:
- ./config/loki/loki-config.yml:/etc/loki/loki-config.yml:ro
- loki-data:/loki
ports:
- "3100:3100"
tempo:
image: grafana/tempo:3.0.2
hostname: tempo
container_name: tempo
command:
- -config.file=/etc/tempo/tempo.yml
volumes:
- ./config/tempo/tempo.yml:/etc/tempo/tempo.yml:ro
- tempo-data:/var/tempo
ports:
- "3200:3200"
prometheus:
image: prom/prometheus:v3.13.1
hostname: prometheus
container_name: prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --web.enable-remote-write-receiver
- --enable-feature=exemplar-storage
volumes:
- ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
ports:
- "9090:9090"
grafana:
image: grafana/grafana:12.3.8
hostname: grafana
container_name: grafana
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
volumes:
- ./config/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./config/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- grafana-data:/var/lib/grafana
ports:
- "3000:3000"
depends_on:
- loki
- tempo
- prometheus
##################################
# Tests
k6:
image: grafana/k6:latest
container_name: k6-telemetry
restart: unless-stopped
depends_on:
auth-api:
condition: service_healthy
environment:
# Use the Compose service name and container port—not localhost:5056.
BASE_URL: http://auth-api:8080
# Keep this value because it is sent as the HTTP Origin header,
# and the API currently allows this origin.
ORIGIN: http://localhost:5109
EXPECTED_ISSUERS: auth-api,http://localhost:5056
EXPECTED_AUDIENCES: http://localhost:5109,http://localhost:5056
VUS: "2"
DURATION: 30s
PAUSE_SECONDS: "0.5"
# Delay after each completed k6 run.
K6_INTERVAL_SECONDS: "60"
volumes:
- ./scripts/telemetry-smoke-test.js:/scripts/telemetry-smoke-test.js:ro
- k6-results:/results
working_dir: /results
entrypoint: [ "/bin/sh", "-c" ]
command:
- |
while true; do
echo "Starting k6 telemetry run at $$(date -Iseconds)"
k6 run /scripts/telemetry-smoke-test.js || true
echo "Next telemetry run in $${K6_INTERVAL_SECONDS}s"
sleep "$${K6_INTERVAL_SECONDS}"
done
##################################
# Volume
volumes:
postgresqlsystem:
grafana-data:
loki-data:
tempo-data:
prometheus-data:
k6-results: