Skip to content

Commit 515b820

Browse files
committed
fix(docker): resolve prod profile routing and config issues
- Fix Caddyfile SPA fallback to use base route prefix for index.html - Add admin API reverse proxy rules matching the Helm chart template - Mount server/config into backend container for keycloak.json - Add KEYCLOAK_INTERNAL_URL to backend for in-container JWKS fetch - Include keycloak and keycloak-db in prod profile Signed-off-by: Emiliano Suñé <2395873+esune@users.noreply.github.com>
1 parent 7466cb7 commit 515b820

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ services:
5959
build:
6060
context: ./
6161
dockerfile: ./server/Dockerfile
62+
volumes:
63+
- ./server/config:/app/server/config:ro
6264
ports:
6365
- '5000:5000'
6466
env_file:
@@ -68,6 +70,7 @@ services:
6870
MONGODB_PORT: '27017'
6971
MONGODB_DB_NAME: bc_wallet_showcase
7072
MONGODB_URI: mongodb://mongodb:27017/bc_wallet_showcase
73+
KEYCLOAK_INTERNAL_URL: http://keycloak:8080
7174
depends_on:
7275
mongodb:
7376
condition: service_healthy
@@ -137,6 +140,7 @@ services:
137140
command: start-dev --import-realm
138141
profiles:
139142
- dev
143+
- prod
140144
ports:
141145
- '8080:8080'
142146
volumes:
@@ -161,6 +165,7 @@ services:
161165
image: postgres:15-alpine
162166
profiles:
163167
- dev
168+
- prod
164169
environment:
165170
POSTGRES_DB: keycloak
166171
POSTGRES_USER: keycloak

frontend/Caddyfile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,29 @@
5555

5656
reverse_proxy @websockets backend:5000
5757

58+
# Admin API: proxy /admin/* to backend, except SPA sub-paths (callback, creator)
59+
@admin_api {
60+
path {$VITE_BASE_ROUTE}/admin/*
61+
not path {$VITE_BASE_ROUTE}/admin/callback {$VITE_BASE_ROUTE}/admin/callback/*
62+
not path {$VITE_BASE_ROUTE}/admin/creator {$VITE_BASE_ROUTE}/admin/creator/*
63+
}
64+
65+
reverse_proxy @admin_api backend:5000 {
66+
trusted_proxies 0.0.0.0/0
67+
header_up Host {upstream_hostport}
68+
header_up X-Forwarded-Host {host}
69+
}
70+
5871
# Required for SPA router to work
5972
@spa_router {
6073
not path {$VITE_BASE_ROUTE}/demo/* {$VITE_BASE_ROUTE}/server/* {$VITE_BASE_ROUTE}/agent/ready {$VITE_BASE_ROUTE}/public/* {$VITE_BASE_ROUTE}/qr
74+
not {
75+
path {$VITE_BASE_ROUTE}/admin/*
76+
not path {$VITE_BASE_ROUTE}/admin/callback {$VITE_BASE_ROUTE}/admin/callback/*
77+
not path {$VITE_BASE_ROUTE}/admin/creator {$VITE_BASE_ROUTE}/admin/creator/*
78+
}
6179
file {
62-
try_files {path} /index.html
80+
try_files {path} {$VITE_BASE_ROUTE}/index.html
6381
}
6482
}
6583
rewrite @spa_router {http.matchers.file.relative}

0 commit comments

Comments
 (0)