From 9d737a8fe05f5fd3368abbe5ae108f482c9e9485 Mon Sep 17 00:00:00 2001 From: amandilaras Date: Thu, 16 May 2024 17:32:46 +0300 Subject: [PATCH] more deployment fixes. finalize keycloak auto initialization --- deployment/deploy_opencdmp.sh | 1 + deployment/docker-compose.override.yml | 3 ++- deployment/docker-compose.yml | 8 -------- deployment/elk/elasticsearch/elasticsearch.yml | 1 + deployment/keycloak/imports/opencdmp-realm.json | 3 +-- deployment/keycloak/user_init.sh | 4 ++++ deployment/opencdmp/backend/config/deposit-test.yml | 3 ++- deployment/opencdmp/zenodo/config/zenodo-test.yml | 3 ++- 8 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 deployment/keycloak/user_init.sh diff --git a/deployment/deploy_opencdmp.sh b/deployment/deploy_opencdmp.sh index c5c486bb0..2fbfe88dc 100644 --- a/deployment/deploy_opencdmp.sh +++ b/deployment/deploy_opencdmp.sh @@ -71,6 +71,7 @@ loading_icon 20 "Waiting for PostgreSQL to Initialize!" docker-compose up -d opencdmp.keycloak loading_icon 90 "Waiting for Keycloak to Startup!" +docker exec -it opencdmp.keycloak /tmp/user_init.sh docker-compose up -d diff --git a/deployment/docker-compose.override.yml b/deployment/docker-compose.override.yml index cbeea1677..511585c3c 100644 --- a/deployment/docker-compose.override.yml +++ b/deployment/docker-compose.override.yml @@ -164,7 +164,7 @@ services: test: ["CMD-SHELL", "sh -c 'pg_isready -U postgres -d opencdmp'"] interval: 15s timeout: 60s - retries: 5 + retries: 5 ################################# ELASTICSEARCH ################################################# @@ -210,6 +210,7 @@ services: - JAVA_OPTS_APPEND="-Djava.net.preferIPv4Stack=true" volumes: - ./logs/keycloak:/tmp/logs + - ./keycloak/user_init.sh:/tmp/user_init.sh - ./keycloak/imports/opencdmp-realm.json:/opt/keycloak/data/import/opencdmp-realm.json expose: - "8080" diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 6b9e139a3..b8565d7b1 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -13,8 +13,6 @@ services: condition: service_started opencdmp.annotation: condition: service_started - opencdmp.keycloak: - condition: service_started ############################## OPENDMP APP ################################# @@ -35,8 +33,6 @@ services: depends_on: opencdmp.postgres: condition: service_started - opencdmp.keycloak: - condition: service_started opencdmp.notification: container_name: opencdmp.notification @@ -44,8 +40,6 @@ services: depends_on: opencdmp.postgres: condition: service_started - opencdmp.keycloak: - condition: service_started opencdmp.annotation: container_name: opencdmp.annotation @@ -53,8 +47,6 @@ services: depends_on: opencdmp.postgres: condition: service_started - opencdmp.keycloak: - condition: service_started opencdmp.backend: condition: service_started diff --git a/deployment/elk/elasticsearch/elasticsearch.yml b/deployment/elk/elasticsearch/elasticsearch.yml index fda54bb06..36d0f9d57 100644 --- a/deployment/elk/elasticsearch/elasticsearch.yml +++ b/deployment/elk/elasticsearch/elasticsearch.yml @@ -5,6 +5,7 @@ network.host: 0.0.0.0 discovery.type: single-node node.name: elasticsearch +ingest.geoip.downloader.enabled: false xpack.license.self_generated.type: trial xpack.security.enabled: true xpack.security.authc.api_key.enabled: true diff --git a/deployment/keycloak/imports/opencdmp-realm.json b/deployment/keycloak/imports/opencdmp-realm.json index 92477d269..f43a81897 100644 --- a/deployment/keycloak/imports/opencdmp-realm.json +++ b/deployment/keycloak/imports/opencdmp-realm.json @@ -809,8 +809,7 @@ } ], "realmRoles": [ - "default-roles-dmp-staging", - "realm-admin" + "default-roles-dmp-staging" ], "groups": [ "/opencdmp-app/role-user", diff --git a/deployment/keycloak/user_init.sh b/deployment/keycloak/user_init.sh new file mode 100644 index 000000000..4202b15ea --- /dev/null +++ b/deployment/keycloak/user_init.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080/keycloak --realm master --user keycloak-admin --password admin --client admin-cli +/opt/keycloak/bin/kcadm.sh add-roles -r OpenCDMP --uusername dmp-keycloak-api --cclientid realm-management --rolename realm-admin diff --git a/deployment/opencdmp/backend/config/deposit-test.yml b/deployment/opencdmp/backend/config/deposit-test.yml index 5f7355538..40e20da46 100644 --- a/deployment/opencdmp/backend/config/deposit-test.yml +++ b/deployment/opencdmp/backend/config/deposit-test.yml @@ -7,4 +7,5 @@ deposit: issuer-url: ${IDP_ISSUER_URI_TOKEN} client-id: ${IDP_APIKEY_CLIENT_ID} client-secret: ${IDP_APIKEY_CLIENT_SECRET} - scope: ${IDP_APIKEY_SCOPE} \ No newline at end of file + scope: ${IDP_APIKEY_SCOPE} + maxInMemorySizeInBytes: 6554000 diff --git a/deployment/opencdmp/zenodo/config/zenodo-test.yml b/deployment/opencdmp/zenodo/config/zenodo-test.yml index 7bcfc58c8..bb31a2ba6 100644 --- a/deployment/opencdmp/zenodo/config/zenodo-test.yml +++ b/deployment/opencdmp/zenodo/config/zenodo-test.yml @@ -4,4 +4,5 @@ zenodo: domain: https://argos.openaire.eu/ logo: /zenodo.jpg depositConfiguration: - has-logo: false \ No newline at end of file + has-logo: false + useSharedStorage: false