Skip to content

Commit c5a9244

Browse files
author
Dennis Labordus
committed
First steps in adding the Validator Service to Docker Compose.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent e4f42c0 commit c5a9244

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

compas/docker-compose-basex.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ services:
108108
depends_on:
109109
- keycloak
110110

111+
scl-validator:
112+
labels:
113+
compas: true
114+
image: "lfenergy/compas-scl-validator:local-SNAPSHOT"
115+
ports:
116+
- "9093:8080"
117+
environment:
118+
- JWT_VERIFY_KEY=http://keycloak:8080/auth/realms/compas/protocol/openid-connect/certs
119+
- JWT_VERIFY_ISSUER=http://${COMPAS_HOSTNAME}/auth/realms/compas
120+
- JWT_VERIFY_CLIENT_ID=scl-validator
121+
- JWT_GROUPS_PATH=resource_access/scl-validator/roles
122+
- USERINFO_WHO_CLAIMNAME=name
123+
deploy:
124+
restart_policy:
125+
condition: on-failure
126+
max_attempts: 3
127+
healthcheck:
128+
test: ["CMD", "curl", "-f", "http://localhost:8080/compas-scl-validator/q/health/ready"]
129+
interval: 15s
130+
timeout: 10s
131+
retries: 5
132+
depends_on:
133+
- keycloak
134+
111135
open-scd:
112136
labels:
113137
compas: true

compas/docker-compose-postgresql.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,30 @@ services:
115115
depends_on:
116116
- keycloak
117117

118+
scl-validator:
119+
labels:
120+
compas: true
121+
image: "lfenergy/compas-scl-validator:local-SNAPSHOT"
122+
ports:
123+
- "9093:8080"
124+
environment:
125+
- JWT_VERIFY_KEY=http://keycloak:8080/auth/realms/compas/protocol/openid-connect/certs
126+
- JWT_VERIFY_ISSUER=http://${COMPAS_HOSTNAME}/auth/realms/compas
127+
- JWT_VERIFY_CLIENT_ID=scl-validator
128+
- JWT_GROUPS_PATH=resource_access/scl-validator/roles
129+
- USERINFO_WHO_CLAIMNAME=name
130+
deploy:
131+
restart_policy:
132+
condition: on-failure
133+
max_attempts: 3
134+
healthcheck:
135+
test: ["CMD", "curl", "-f", "http://localhost:8080/compas-scl-validator/q/health/ready"]
136+
interval: 15s
137+
timeout: 10s
138+
retries: 5
139+
depends_on:
140+
- keycloak
141+
118142
open-scd:
119143
labels:
120144
compas: true
@@ -127,6 +151,8 @@ services:
127151
depends_on:
128152
- scl-data-service
129153
- cim-mapping
154+
- scl-auto-alignment
155+
- scl-validator
130156

131157
reverse-proxy:
132158
labels:
@@ -146,6 +172,8 @@ services:
146172
- keycloak
147173
- scl-data-service
148174
- cim-mapping
175+
- scl-auto-alignment
176+
- scl-validator
149177
- open-scd
150178

151179
volumes:

compas/reverse-proxy/nginx.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ http {
126126
proxy_redirect off;
127127
}
128128

129+
# Forwarding to the SCL Auto Alignment Service container.
130+
location /compas-scl-validator/ {
131+
include /etc/nginx/include/authenticate.include;
132+
133+
proxy_set_header X-Real-IP $remote_addr;
134+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
135+
proxy_set_header X-Forwarded-Proto $scheme;
136+
proxy_set_header X-Forwarded-Port $server_port;
137+
proxy_set_header Authorization "Bearer ${access_token}";
138+
139+
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
140+
add_header X-Debug-Bearer "Bearer ${access_token}" always;
141+
142+
proxy_pass http://scl-validator:8080/compas-scl-validator/;
143+
144+
proxy_set_header Host $http_host;
145+
proxy_cache_bypass $http_upgrade;
146+
proxy_redirect off;
147+
}
148+
129149
# redirect server error pages to the static page /40x.html
130150
error_page 404 /404.html;
131151
location = /40x.html {

0 commit comments

Comments
 (0)