Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ target
# IDE specific
.idea
*.iml

# Data Directories for Docker Compose
# Ignore all files, except the README.md
compas/data/**/*.*
!compas/data/**/README.md
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,21 @@ docker-compose -f compas/docker-compose-postgresql.yml down -v

The option '-v' also removes the volumes created, so all data is lost with this option.

## Docker Compose (Common)

### Custom files

The SCL Validator Service can be extended with custom OCL and NSDOC Files. These can be placed in specific directories,
see [OCL Files](compas/data/ocl/README.md) and [NSDOC Files](compas/data/nsdoc/README.md).

### Known issue with Docker Compose

Using the current configuration with Keycloak and OpenResty (lua-resty-session) sometimes gives an error
"**state from argument does not match state restored from session**".
This mostly happens after using logout or the session is expired. The login page is shown, but after login this error is shown.
Just open the url [http://localhost/](http://localhost/) again and OpenSCD is shown again, also being logged in.

## Keycloak Demo Configuration
### Keycloak Demo Configuration
For demo purposes, a [demo Keycloak configuration](compas/keycloak/keycloak_compas_realm.json) is created which can be imported when
running a Keycloak instance.

Expand Down
15 changes: 15 additions & 0 deletions compas/data/nsdoc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
SPDX-FileCopyrightText: 2021 Alliander N.V.

SPDX-License-Identifier: Apache-2.0
-->

This directory can be used to add NSDOC Files to be served by the SCL Validator Service for the frontend application.

For instance
```
compas/data
└── nsdoc
├── Official-File73.nsdoc
└── README.md
```
25 changes: 25 additions & 0 deletions compas/data/ocl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
SPDX-FileCopyrightText: 2021 Alliander N.V.

SPDX-License-Identifier: Apache-2.0
-->

This directory can be used to add custom OCL Files to the validation process.

You can use subdirectories like `SemanticConstraints` as RiseClipse is doing.
And there is a special filter that when you create a directory `FileSpecifics`.
In this directory you can create for instance a directory `CID` to put constraints specific for an SCL File Type.
Known types are `SSD`, `IID`, `ICD`, `SCD`, `CID`, `SED`, `ISD`, `STD`.

For instance,

```
compas/data
└── ocl
├── FileSpecifics
│ └── CID
│ └── Busbar.ocl
├── README.md
└── SemanticConstraints
└── Busbar.ocl
```
29 changes: 28 additions & 1 deletion compas/docker-compose-basex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,37 @@ services:
depends_on:
- keycloak

scl-validator:
labels:
compas: true
image: "lfenergy/compas-scl-validator:0.1.0"
ports:
- "9093:8080"
environment:
- JWT_VERIFY_KEY=http://keycloak:8080/auth/realms/compas/protocol/openid-connect/certs
- JWT_VERIFY_ISSUER=http://${COMPAS_HOSTNAME}/auth/realms/compas
- JWT_VERIFY_CLIENT_ID=scl-validator
- JWT_GROUPS_PATH=resource_access/scl-validator/roles
- USERINFO_WHO_CLAIMNAME=name
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/compas-scl-validator/q/health/ready"]
interval: 15s
timeout: 10s
retries: 5
volumes:
- ./data/ocl:/data/ocl
- ./data/nsdoc:/data/nsdoc
depends_on:
- keycloak

open-scd:
labels:
compas: true
image: "lfenergy/compas-open-scd:v0.12.0.0"
image: "lfenergy/compas-open-scd:v0.12.0.1"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 30s
Expand Down
33 changes: 32 additions & 1 deletion compas/docker-compose-postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,37 @@ services:
depends_on:
- keycloak

scl-validator:
labels:
compas: true
image: "lfenergy/compas-scl-validator:0.1.0"
ports:
- "9093:8080"
environment:
- JWT_VERIFY_KEY=http://keycloak:8080/auth/realms/compas/protocol/openid-connect/certs
- JWT_VERIFY_ISSUER=http://${COMPAS_HOSTNAME}/auth/realms/compas
- JWT_VERIFY_CLIENT_ID=scl-validator
- JWT_GROUPS_PATH=resource_access/scl-validator/roles
- USERINFO_WHO_CLAIMNAME=name
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/compas-scl-validator/q/health/ready"]
interval: 15s
timeout: 10s
retries: 5
volumes:
- ./data/ocl:/data/ocl
- ./data/nsdoc:/data/nsdoc
depends_on:
- keycloak

open-scd:
labels:
compas: true
image: "lfenergy/compas-open-scd:v0.12.0.0"
image: "lfenergy/compas-open-scd:v0.12.0.1"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 30s
Expand All @@ -127,6 +154,8 @@ services:
depends_on:
- scl-data-service
- cim-mapping
- scl-auto-alignment
- scl-validator

reverse-proxy:
labels:
Expand All @@ -146,6 +175,8 @@ services:
- keycloak
- scl-data-service
- cim-mapping
- scl-auto-alignment
- scl-validator
- open-scd

volumes:
Expand Down
20 changes: 20 additions & 0 deletions compas/reverse-proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ http {
proxy_redirect off;
}

# Forwarding to the SCL Auto Alignment Service container.
location /compas-scl-validator/ {
include /etc/nginx/include/authenticate.include;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";

# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
add_header X-Debug-Bearer "Bearer ${access_token}" always;

proxy_pass http://scl-validator:8080/compas-scl-validator/;

proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

# redirect server error pages to the static page /40x.html
error_page 404 /404.html;
location = /40x.html {
Expand Down