Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
165 lines (156 loc) · 5.55 KB
/
Copy pathcompose.yaml
File metadata and controls
165 lines (156 loc) · 5.55 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
---
# StudyDeck AI — Docker Compose (core profile)
# Profiles:
# core → postgres + backend (default)
# dev → enables Swagger UI / openapi endpoint in backend
# mcp-http → exposes a dedicated MCP port (9090→8080) for MCP client tooling
# obs → otel-collector, prometheus, grafana (Phase 7+)
# idp → local OIDC provider for dev (Phase 1+)
# e2e → Playwright test runner (Phase 1+)
# cli → studydeck-cli image (Phase 4+)
name: studydeck
volumes:
postgres_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
services:
postgres:
image: pgvector/pgvector:pg17
container_name: studydeck-postgres
restart: unless-stopped
environment:
POSTGRES_DB: studydeck
POSTGRES_USER: ${DB_USER:-studydeck}
POSTGRES_PASSWORD: ${DB_PASS:-studydeck}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-studydeck} -d studydeck"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
backend:
build:
context: .
dockerfile: Dockerfile
container_name: studydeck-backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DB_URL: jdbc:postgresql://postgres:5432/studydeck
DB_USER: ${DB_USER:-studydeck}
DB_PASS: ${DB_PASS:-studydeck}
# Local/demo stack defaults to the dev profile: a static HS256 JWT decoder (no real IdP
# required) and dev-only OpenAPI exposure. For a real deployment set
# SPRING_PROFILES_ACTIVE=prod AND SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI — the
# prod profile disables the dev decoder and refuses to start without a real issuer (fail-fast).
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-dev}
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: ${SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI:-}
JAVA_TOOL_OPTIONS: "-Djava.security.egd=file:/dev/./urandom"
ports:
- "${BACKEND_PORT:-8080}:8080"
healthcheck:
test:
[
"CMD-SHELL",
"curl -f http://localhost:8080/actuator/health || exit 1",
]
interval: 15s
timeout: 5s
retries: 5
start_period: 45s
# mcp-http profile — exposes a second host port (9090) bound to the backend's
# MCP transport (/mcp, JSON-RPC 2.0) so MCP clients can discover the server
# without sharing the main API port. The backend must be running (no healthcheck
# on the alias service itself — it piggybacks on the backend container).
#
# Usage: docker compose --profile mcp-http up
# MCP endpoint: http://localhost:9090/mcp
mcp-http:
profiles: [mcp-http]
image: alpine/socat:latest
container_name: studydeck-mcp-http
restart: unless-stopped
command: TCP-LISTEN:9090,fork,reuseaddr TCP:studydeck-backend:8080
ports:
- "${MCP_PORT:-9090}:9090"
depends_on:
backend:
condition: service_healthy
# obs profile — observability stack: Prometheus scrapes the backend's
# /actuator/prometheus endpoint; Grafana visualizes it with a provisioned
# datasource + dashboard; the OTEL collector accepts OTLP for future tracing.
#
# Usage: docker compose --profile obs up -d
# Prometheus → http://localhost:9091 Grafana → http://localhost:3001 (admin/admin)
prometheus:
profiles: [obs]
image: prom/prometheus:v3.1.0
container_name: studydeck-prometheus
restart: unless-stopped
volumes:
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
ports:
- "${PROMETHEUS_PORT:-9091}:9090"
depends_on:
backend:
condition: service_healthy
grafana:
profiles: [obs]
image: grafana/grafana:11.5.1
container_name: studydeck-grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- ./observability/grafana/provisioning:/etc/grafana/provisioning:ro
- ./observability/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
ports:
- "${GRAFANA_PORT:-3001}:3000"
depends_on:
- prometheus
otel-collector:
profiles: [obs]
image: otel/opentelemetry-collector-contrib:0.119.0
container_name: studydeck-otel-collector
restart: unless-stopped
command: ["--config=/etc/otel/config.yaml"]
volumes:
- ./observability/otel-collector/config.yaml:/etc/otel/config.yaml:ro
ports:
- "${OTEL_GRPC_PORT:-4317}:4317"
- "${OTEL_HTTP_PORT:-4318}:4318"
# cli profile — studydeck CLI image; attach to backend network so it can reach
# the backend service by hostname. Pass STUDYDECK_TOKEN from the host env.
cli:
profiles: [cli]
build:
context: .
dockerfile: Dockerfile.cli
container_name: studydeck-cli
environment:
STUDYDECK_BASE_URL: http://studydeck-backend:8080
STUDYDECK_TOKEN: ${STUDYDECK_TOKEN:-}
depends_on:
backend:
condition: service_healthy
# CLI is a one-shot tool; no restart policy needed
restart: "no"
# Default: show help. Override CMD at runtime with the subcommand to run.
# Example: docker compose --profile cli run --rm cli deck ls
command: ["--help"]