Skip to content

Commit

Permalink
chore: Fix OpenAPI service deployment on local docker env (#2615)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresrosenthal authored Feb 7, 2025
1 parent 5164061 commit b1192ec
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 7 deletions.
1 change: 1 addition & 0 deletions Docker/xrd-dev-stack/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CS_IMG=ghcr.io/nordic-institute/xrddev-central-server:latest
SS_IMG=ghcr.io/nordic-institute/xrddev-security-server:latest
CA_IMG=ghcr.io/nordic-institute/xrddev-testca:latest
IS_OPENAPI_IMG=ghcr.io/nordic-institute/xrddev-example-restapi:latest
IS_SOAP_IMG=niis/example-adapter:latest
COMPOSE_PROJECT_NAME=xrd-dev-stack
1 change: 1 addition & 0 deletions Docker/xrd-dev-stack/.env.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CS_IMG=xrd-centralserver-dev
SS_IMG=xrd-securityserver-dev
CA_IMG=xrd-testca
IS_OPENAPI_IMG=ghcr.io/nordic-institute/xrddev-example-restapi:latest
IS_SOAP_IMG=niis/example-adapter:latest
TELEMETRY_COMMON_PARAMS="-javaagent:/usr/share/xroad/jlib/opentelemetry-javaagent.jar -Dotel.exporter.otlp.protocol=http/protobuf -Dotel.exporter.otlp.endpoint=http://jaeger:4318"
2 changes: 2 additions & 0 deletions Docker/xrd-dev-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The Compose environment also contains a Hurl container and scripts to initialize
* **SS1** One consumer Security Server, which has the `DEV:COM:4321:TestClient` subsystem registered to it.
* **ISSOAP** The `example-adapter` container. More information regarding it is available in
[its own repository](https://github.com/nordic-institute/xrd4j/tree/develop/example-adapter).
* **ISOPENAPI** The `example-restapi` container. More information regarding it is available in
[its own repository](https://github.com/nordic-institute/x-road-example-restapi).
* **ISREST** Wiremock container with a simple predefined rest endpoint.
* **TESTCA** CA authority for dev env.

Expand Down
6 changes: 6 additions & 0 deletions Docker/xrd-dev-stack/compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ services:
- "4403:9998"
networks:
- xroad-network
isopenapi:
container_name: isopenapi
ports:
- "4700:8080"
networks:
- xroad-network
isrest:
container_name: isrest
ports:
Expand Down
14 changes: 14 additions & 0 deletions Docker/xrd-dev-stack/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ services:
MP_SMTP_TLS_CERT: /data/mailpit_cert.pem
MP_SMTP_TLS_KEY: /data/mailpit_key.pem
MP_SMTP_AUTH_FILE: /data/password_file
isopenapi:
image: ${IS_OPENAPI_IMG}
deploy:
resources:
reservations:
memory: 64M
limits:
memory: 512M
healthcheck:
interval: 5s
retries: 40
test: [ "CMD", "curl", "-f", "-k", "http://localhost:8080/v3/api-docs" ]
issoap:
image: ${IS_SOAP_IMG}
deploy:
Expand Down Expand Up @@ -115,6 +127,8 @@ services:
condition: service_healthy
ss1:
condition: service_healthy
isopenapi:
condition: service_healthy
issoap:
condition: service_healthy
isrest:
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/xroad-hurl/files/hurl.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ example_service_address=http://xrd-is:8080/example-adapter/Endpoint
is_rest_url=http://xrd-is/integration/mock_1
is_rest_service_code=mock1

is_rest_openapi_url=http://xrd-is:8081/v3/api-docs
is_rest_openapi_service_code=restapi
is_openapi_url=http://xrd-is:8081/v3/api-docs
is_openapi_service_code=restapi
6 changes: 3 additions & 3 deletions development/hurl/scenarios/setup.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -1090,9 +1090,9 @@ X-XSRF-TOKEN: {{ss0_xsrf_token}}
POST https://{{ss0_host}}:4000/api/v1/clients/{{ss0_test_service_id}}/service-descriptions
X-XSRF-TOKEN: {{ss0_xsrf_token}}
{
"url": "{{is_rest_openapi_url}}",
"url": "{{is_openapi_url}}",
"type": "OPENAPI3",
"rest_service_code": "{{is_rest_openapi_service_code}}"
"rest_service_code": "{{is_openapi_service_code}}"
}

HTTP 201
Expand All @@ -1101,7 +1101,7 @@ HTTP 201
ss0_test_rest_openapi_service_service_id: jsonpath "$.id"

# Add TestClient access to OpenAPI REST service's "GET members" endpoint
GET https://{{ss0_host}}:4000/api/v1/services/{{ss0_test_service_id}}%3A{{is_rest_openapi_service_code}}
GET https://{{ss0_host}}:4000/api/v1/services/{{ss0_test_service_id}}%3A{{is_openapi_service_code}}
X-XSRF-TOKEN: {{ss0_xsrf_token}}

HTTP 200
Expand Down
4 changes: 2 additions & 2 deletions development/hurl/scenarios/vars.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ example_service_address=http://issoap:8080/example-adapter/Endpoint
is_rest_url=http://isrest:8080/integration/mock_1
is_rest_service_code=mock1

is_rest_openapi_url=http://isrest:8081/v3/api-docs
is_rest_openapi_service_code=restapi
is_openapi_url=http://isopenapi:8080/v3/api-docs
is_openapi_service_code=restapi

is_rest_payloadgen_url=http://payloadgen:8080
is_rest_payloadgen_service_code=payloadgen
2 changes: 2 additions & 0 deletions usage_scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
image: ghcr.io/nordic-institute/xrddev-security-server:latest
testca:
image: ghcr.io/nordic-institute/xrddev-testca:latest
isopenapi:
image: ghcr.io/nordic-institute/xrddev-example-restapi:latest
issoap:
image: niis/example-adapter:latest
isrest:
Expand Down

0 comments on commit b1192ec

Please sign in to comment.