Skip to content
Open
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
4 changes: 3 additions & 1 deletion compose/bootstrap/gateway/gen-keys.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash
set -euo pipefail
for i in jwt-apps jwt-authentication jwt-authentication-encryption-keys; do
for i in jwt-apps jwt-authentication; do
mkdir -p "$i"
pushd "$i"
openssl genrsa 2048 > active-1.pem
popd
done
mkdir -p jwt-authentication-encryption
openssl rand 32 > jwt-authentication-encryption/active-1.bin
23 changes: 23 additions & 0 deletions compose/bootstrap/keycloak/realm-extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
{
"id": "extensions",
"realm": "extensions",
"enabled": true,
"clients": [
{
"clientId": "renditions",
"enabled": true,
"protocol": "openid-connect",
"publicClient": false,
"secret": "renditions_secret_key",
"standardFlowEnabled": false,
"directAccessGrantsEnabled": false,
"serviceAccountsEnabled": true
}
],
"users": [
{
"username": "service-account-renditions",
"enabled": true,
"serviceAccountClientId": "renditions",
"attributes": {
"extension-id": ["renditions"]
}
}
],
"clientScopes": [
{
"id": "33a98181-8f86-4383-bba6-cd4251a9046a",
Expand Down
127 changes: 127 additions & 0 deletions compose/bootstrap/renditions-rabbitmq/definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"rabbit_version": "3.13.3",
"rabbitmq_version": "3.13.3",
"product_name": "RabbitMQ",
"product_version": "3.13.3",
"vhosts": [
{
"name": "/"
}
],
"policies": [
{
"vhost": "/",
"name": "rendition-requests",
"pattern": "^rendition-requests$",
"apply-to": "queues",
"definition": {
"dead-letter-exchange": "renditions-dlx",
"delivery-limit": 3,
"max-length": 10000,
"message-ttl": 300000,
"overflow": "drop-head"
},
"priority": 0
},
{
"vhost": "/",
"name": "renditions-responses",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queue name is rendition(singular) -responses.

Suggested change
"name": "renditions-responses",
"name": "rendition-responses",

"pattern": "^renditions-responses$",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queue name is rendition(singular) -responses.

Suggested change
"pattern": "^renditions-responses$",
"pattern": "^rendition-responses$",

"apply-to": "queues",
"definition": {
"dead-letter-exchange": "renditions-dlx",
"delivery-limit": 3,
"max-length": 10000,
"message-ttl": 300000,
"overflow": "drop-head"
},
"priority": 0
},
{
"vhost": "/",
"name": "rendition-request-retries",
"pattern": "^rendition-request-retries$",
"apply-to": "queues",
"definition": {
"dead-letter-exchange": "directExchange",
"dead-letter-routing-key": "renditionRequest",
"message-ttl": 15000
}
}
],
"queues": [
{
"name": "rendition-requests",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {
"x-queue-type": "quorum"
}
},
{
"name": "rendition-responses",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {
"x-queue-type": "quorum"
}
},
{
"name": "rendition-request-retries",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {
"x-queue-type": "quorum"
}
}
],
"exchanges": [
{
"name": "renditions-dlx",
"vhost": "/",
"type": "fanout",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this dead letter exchange route to anything? I see no binding for this exchange.

"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
},
{
"name": "directExchange",
"vhost": "/",
"type": "direct",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
],
"bindings": [
{
"source": "directExchange",
"vhost": "/",
"destination": "rendition-requests",
"destination_type": "queue",
"routing_key": "renditionRequest",
"arguments": {}
},
{
"source": "directExchange",
"vhost": "/",
"destination": "rendition-responses",
"destination_type": "queue",
"routing_key": "renditionResponse",
"arguments": {}
},
{
"source": "directExchange",
"vhost": "/",
"destination": "rendition-request-retries",
"destination_type": "queue",
"routing_key": "renditionRequestRetry",
"arguments": {}
}
]
}
11 changes: 11 additions & 0 deletions compose/bootstrap/renditions-rabbitmq/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail

# Set up definitions
curl -u user:"$RABBITMQ_PASSWORD" \
--fail-with-body \
--silent \
-X POST \
-H "Content-Type: application/json" \
-T /tmp/rabbitmq/definitions.json \
http://renditions-rabbitmq:15672/api/definitions
9 changes: 8 additions & 1 deletion compose/compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

set -e

INCLUDE_COMPOSE_FILES=(docker-compose.*.yml)
PLATFORM_COMPOSE_FILE=docker-compose.rtp.yml
# these can contain overrides for the platform compose file
INCLUDE_COMPOSE_FILES=("${PLATFORM_COMPOSE_FILE}")
for file in docker-compose.*.yml; do
if [ "${file}" != "${PLATFORM_COMPOSE_FILE}" ]; then
INCLUDE_COMPOSE_FILES+=("${file}")
fi
done

do_all() {
local args=""
Expand Down
4 changes: 2 additions & 2 deletions compose/config/gateway/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ contentgrid.configuration.static.contentgrid-apps:
app1:
composition-key: app1
configuration:
contentgrid.routing.domains: localhost
contentgrid.routing.domains: localhost,${docker.host.ip}
contentgrid.idp.issuer-uri: http://${docker.host.ip}:8082/realms/cg-holmes
contentgrid.idp.client-id: test-client
contentgrid.idp.client-secret: JmcPOg8RFijxXFy6ozt0sYMAnmte8D0T
contentgrid.cors.origins: http://localhost:8085
contentgrid.cors.origins: http://localhost:8085,http://${docker.host.ip}:8085

servicediscovery:
static:
Expand Down
22 changes: 22 additions & 0 deletions compose/config/renditions/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: http://${docker.host.ip}:8081/authentication/external
audiences:
- contentgrid:extension:renditions
client:
provider:
identity:
issuer-uri: http://${docker.host.ip}:8082/realms/extensions
delegated-access:
issuer-uri: http://${docker.host.ip}:8081/authentication/delegated

s3:
bucket: renditions
endpoint: http://renditions-s3:9090/
region: eu-west-1

transform-service:
url: http://transformations:8088/available-transformations
10 changes: 10 additions & 0 deletions compose/config/renditions/navigator-config.js.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
window.contentGridConfig = {
v1: {
apiBaseUrl: "${API_BASE_URL}",
oidc: {
authority: "${OIDC_AUTHORITY}",
client_id: "${OIDC_CLIENT_ID}"
},
renditionUriTemplate: "${RENDITION_URI_TEMPLATE}"
}
};
6 changes: 6 additions & 0 deletions compose/config/renditions/tokenmonger-extensions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Configure tokenmonger with renditions extension
contentgrid.tokenmonger.extensions.registration.renditions:
extension-id: renditions
resource-uris:
- http://${docker.host.ip}:8086/
- http://localhost:8086/
8 changes: 8 additions & 0 deletions compose/config/transformations/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
s3:
bucket: renditions
endpoint: http://renditions-s3:9090/
region: eu-west-1

alfresco-transform-core-aio:
url: http://transformaio:8090/transform
config-url: http://transformaio:8090/transform/config
90 changes: 90 additions & 0 deletions compose/docker-compose.renditions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
services:
renditions:
image: docker.xenit.eu/contentgrid/extensions/renditions/contentgrid-rendition-service:0.0.1-SNAPSHOT@sha256:58b3a312cad4ff7824a148895a28900bfb91bd0c8010e9aa8bcafa5edeb0e34b
ports:
- "8086:8080"
environment:
SPRING_CONFIG_IMPORT: file:/etc/renditions/config/application.yml
DOCKER_HOST_IP: "${DOCKER_HOST_IP:-172.17.0.1}"

EIT_CLIENT_ID: renditions
EIT_CLIENT_SECRET: renditions_secret_key

SPRING_RABBITMQ_HOST: renditions-rabbitmq
SPRING_RABBITMQ_USERNAME: user
SPRING_RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
volumes:
- ./config/renditions:/etc/renditions/config:ro
depends_on:
renditions-rabbitmq-bootstrap:
condition: service_completed_successfully
restart: true
keycloak:
condition: service_healthy
tokenmonger:
condition: service_started
transformations:
condition: service_started

transformations:
image: docker.xenit.eu/contentgrid/extensions/renditions/contentgrid-transform-service:0.0.1-SNAPSHOT@sha256:6026b6e5cb7e4d2a2e0d9bbe2e2e9791424ca3360bb3adc52d09808338c5ed5c
environment:
SPRING_CONFIG_IMPORT: file:/etc/transformations/config/application.yml

SPRING_RABBITMQ_HOST: renditions-rabbitmq
SPRING_RABBITMQ_USERNAME: user
SPRING_RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
volumes:
- ./config/transformations:/etc/transformations/config:ro
depends_on:
renditions-rabbitmq-bootstrap:
condition: service_completed_successfully
restart: true

transformaio:
image: docker.io/alfresco/alfresco-transform-core-aio:latest
environment:
JAVA_OPTS: "-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"

renditions-rabbitmq:
image: docker.io/library/rabbitmq:4.3-management
environment:
RABBITMQ_DEFAULT_USER: user
RABBITMQ_DEFAULT_PASS: $RABBITMQ_PASSWORD
healthcheck:
test: ["CMD", "rabbitmqctl", "node_health_check"]
start_period: 1m

# Set up normal/dead letter exchange, request/response queues, bindings
renditions-rabbitmq-bootstrap:
image: ghcr.io/xenit-eu/kubectl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pin the image version?

command: ["bash", "-c", "/tmp/rabbitmq/setup.sh"]
environment:
RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD
volumes:
- ./bootstrap/renditions-rabbitmq:/tmp/rabbitmq

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this mount be ro, like the other mounts?

Suggested change
- ./bootstrap/renditions-rabbitmq:/tmp/rabbitmq
- ./bootstrap/renditions-rabbitmq:/tmp/rabbitmq:ro

depends_on:
renditions-rabbitmq:
condition: service_healthy

renditions-s3:
image: docker.io/adobe/s3mock:5.0.0
environment:
COM_ADOBE_TESTING_S3MOCK_STORE_INITIAL_BUCKETS: renditions
COM_ADOBE_TESTING_S3MOCK_STORE_REGION: eu-west-1

tokenmonger:
environment:
SPRING_CONFIG_IMPORT: file:/etc/tokenmonger/config/application.yml,file:/etc/tokenmonger/extensions/renditions.yml
DOCKER_HOST_IP: "${DOCKER_HOST_IP:-172.17.0.1}"
volumes:
- ./config/renditions/tokenmonger-extensions.yml:/etc/tokenmonger/extensions/renditions.yml

# Mount config.js.tmpl (renditionUriTemplate is not in the image) to substitute for liaison
navigator:
environment:
API_BASE_URL: http://${DOCKER_HOST_IP:-172.17.0.1}:8080
CC_CONFIGJS_TEMPLATE: /etc/navigator/config.js.tmpl
RENDITION_URI_TEMPLATE: "http://${DOCKER_HOST_IP:-172.17.0.1}:8086/renditions/get/pdf{?url}"
volumes:
- ./config/renditions/navigator-config.js.tmpl:/etc/navigator/config.js.tmpl