diff --git a/deployment/.env b/deployment/.env index c686f26fb..9ecdb5e95 100644 --- a/deployment/.env +++ b/deployment/.env @@ -1,7 +1,7 @@ ###################### GENERAL ######################### #User that is used to deploy the containers -DEPLOY_USER=root - +DEPLOY_USER=1000 +DEPLOY_GROUP=1000 #version selections PROXY_TAG=mainline-alpine MAIN_APP_TAG=2.1.3 @@ -10,10 +10,11 @@ ANNOTATION_APP_TAG=2.1.3 DOCX_APP_TAG=0.0.8 JSON_APP_TAG=0.0.6 ZENODO_APP_TAG=2.0.4 +POSTGRES_TAG=16-alpine ELK_VERSION=8.13.12 KEYCLOAK_TAG=24.0.2 +RABBITMQ_TAG=3.13-management GOTENBERG_TAG=8.4.0 -POSTGRES_TAG=16-alpine #Application configuration DOCKER_REGISTRY=crepo.cite.gr/ diff --git a/deployment/docker-compose.override.yml b/deployment/docker-compose.override.yml index b9af6b701..ea6163e6b 100644 --- a/deployment/docker-compose.override.yml +++ b/deployment/docker-compose.override.yml @@ -1,153 +1,151 @@ -version: "2.4" - services: ############################## PROXY ######################################## - opendmp.proxy: - user: ${DEPLOY_USER}:${DEPLOY_USER} - restart: unless-stopped - cpus: 1 - mem_limit: 256m - ports: - - "${PROXY_APP_PORT}:8081" - - "${PROXY_MS_PORT}:8082" - env_file: - - /proxy/proxy.env - volumes: - - /proxy/nginx.conf:/etc/nginx/nginx.conf - - /proxy/ProxyNginx.conf:/etc/nginx/conf.d/default.conf - - /proxy/nginx-selfsigned.crt:/certifcates/cert.crt - - /proxy/nginx-selfsigned.key:/certifcates/key.key - - /logs/proxy:/tmp/logs - networks: - - opendmp-proxy-network + # opendmp.proxy: + # user: ${DEPLOY_USER}:${DEPLOY_GROUP} + # restart: unless-stopped + # cpus: 1 + # mem_limit: 256m + # ports: + # - "${PROXY_APP_PORT}:8081" + # - "${PROXY_MS_PORT}:8082" + # env_file: + # - proxy/proxy.env + # volumes: + # - proxy/nginx.conf:/etc/nginx/nginx.conf + # - proxy/ProxyNginx.conf:/etc/nginx/conf.d/default.conf + # - proxy/nginx-selfsigned.crt:/certifcates/cert.crt + # - proxy/nginx-selfsigned.key:/certifcates/key.key + # - logs/proxy:/tmp/logs + # networks: + # - opendmp-proxy-network ############################## OPENDMP APP ################################# - opendmp.backend: - user: ${DEPLOY_USER}:${DEPLOY_USER} - restart: unless-stopped - cpus: 1 - mem_limit: 2048m - environment: - - PROFILE=${PROFILE} - ports: - - "8080" - volumes: - - /opendmp/backend/config:/config - - /opendmp/backend/certificates:/certificates - - /opendmp/backend/i18n:/i18n - - /opendmp/backend/material:/material - - /opendmp/backend/Semantics.json:/Semantics.json - - /storage/backend:/storage - - /logs/backend:/logs - networks: - - opendmp-proxy-network - - opendmp-backend-network - - opendmp-plugins-network - - opendmp-gotenberg-shared-network - - opendmp-elastic-shared-network - - opendmp-keycloak-shared-network - - opendmp-postgres-shared-network - - opendmp-rabbitmq-shared-network +# opendmp.backend: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# restart: unless-stopped +# cpus: 1 +# mem_limit: 2048m +# environment: +# - PROFILE=${PROFILE} +# ports: +# - "8080" +# volumes: +# - opendmp/backend/config:/config +# - opendmp/backend/certificates:/certificates +# - opendmp/backend/i18n:/i18n +# - opendmp/backend/material:/material +# - opendmp/backend/Semantics.json:/Semantics.json +# - storage/backend:/storage +# - logs/backend:/logs +# networks: +# - opendmp-proxy-network +# - opendmp-backend-network +# - opendmp-plugins-network +# - opendmp-gotenberg-shared-network +# - opendmp-elastic-shared-network +# - opendmp-keycloak-shared-network +# - opendmp-postgres-shared-network +# - opendmp-rabbitmq-shared-network - opendmp.frontend: - restart: unless-stopped - cpus: 1 - mem_limit: 2048m - ports: - - "8080" - volumes: - - /opendmp/webapp/config.json:/usr/share/nginx/html/assets/config/config.json - - /opendmp/webapp/nginx.conf:/etc/nginx/nginx.conf - - /opendmp/webapp/WebAppNginx.conf:/etc/nginx/conf.d/default.conf - networks: - - opendmp-proxy-network +# opendmp.frontend: +# restart: unless-stopped +# cpus: 1 +# mem_limit: 2048m +# ports: +# - "8080" +# volumes: +# - opendmp/webapp/config.json:/usr/share/nginx/html/assets/config/config.json +# - opendmp/webapp/nginx.conf:/etc/nginx/nginx.conf +# - opendmp/webapp/WebAppNginx.conf:/etc/nginx/conf.d/default.conf +# networks: +# - opendmp-proxy-network - opendmp.notification: - user: ${DEPLOY_USER}:${DEPLOY_USER} - cpus: 1 - mem_limit: 1024m - restart: unless-stopped - ports: - - "8080" - environment: - - PROFILE=${PROFILE} - volumes: - - /opendmp/notification-api/config:/config - - /opendmp/notification-api/messages:/messages - - /opendmp/notification-api/notification_templates:/notification_templates - - /logs/notification-api:/logs - networks: - - opendmp-proxy-network - - opendmp-backend-network - - opendmp-plugins-network - - opendmp-rabbitmq-shared-network - - opendmp-keycloak-shared-network - - opendmp-postgres-shared-network +# opendmp.notification: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# cpus: 1 +# mem_limit: 1024m +# restart: unless-stopped +# ports: +# - "8080" +# environment: +# - PROFILE=${PROFILE} +# volumes: +# - opendmp/notification-api/config:/config +# - opendmp/notification-api/messages:/messages +# - opendmp/notification-api/notification_templates:/notification_templates +# - logs/notification-api:/logs +# networks: +# - opendmp-proxy-network +# - opendmp-backend-network +# - opendmp-plugins-network +# - opendmp-rabbitmq-shared-network +# - opendmp-keycloak-shared-network +# - opendmp-postgres-shared-network - opendmp.annotation: - user: ${DEPLOY_USER}:${DEPLOY_USER} - cpus: 1 - mem_limit: 1024m - restart: unless-stopped - ports: - - "8080" - environment: - - PROFILE=${PROFILE} - volumes: - - /opendmp/annotation-api/config:/config - - /opendmp/annotation-api/messages:/messages - - /logs/annotation-api:/logs - networks: - - opendmp-proxy-network - - opendmp-backend-network - - opendmp-plugins-network - - opendmp-rabbitmq-shared-network - - opendmp-keycloak-shared-network - - opendmp-postgres-shared-network +# opendmp.annotation: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# cpus: 1 +# mem_limit: 1024m +# restart: unless-stopped +# ports: +# - "8080" +# environment: +# - PROFILE=${PROFILE} +# volumes: +# - opendmp/annotation-api/config:/config +# - opendmp/annotation-api/messages:/messages +# - logs/annotation-api:/logs +# networks: +# - opendmp-proxy-network +# - opendmp-backend-network +# - opendmp-plugins-network +# - opendmp-rabbitmq-shared-network +# - opendmp-keycloak-shared-network +# - opendmp-postgres-shared-network -############################## FILE-TRANSFORMER ################################# +# ############################## FILE-TRANSFORMER ################################# - opendmp.file.transformer.docx: - user: ${DEPLOY_USER}:${DEPLOY_USER} - restart: unless-stopped - cpus: 1 - mem_limit: 1024m - expose: - - "8080" - environment: - - SERVER_PORT=${SERVER_PORT} - - PROFILE=${PROFILE} - volumes: - - /opendmp/file-transformer-docx/config:/config - - /logs/file-transformer-docx:/logs - - /storage/file-transformer-docx:/storage - networks: - - opendmp-backend-network - - opendmp-plugins-network - - opendmp-gotenberg-shared-network - - opendmp.file.transformer.rdajson: - user: ${DEPLOY_USER}:${DEPLOY_USER} - restart: unless-stopped - cpus: 1 - mem_limit: 1024m - expose: - - "8080" - environment: - - SERVER_PORT=${SERVER_PORT} - - PROFILE=${PROFILE} - volumes: - - /opendmp/file-transformer-rda-json/config:/config - - /opendmp/file-transformer-rda-json/internal:/internal - - /logs/file-transformer-rda-json:/logs - - /storage/file-transformer-rda-json:/storage - networks: - - opendmp-backend-network - - opendmp-plugins-network +# opendmp.file.transformer.docx: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# restart: unless-stopped +# cpus: 1 +# mem_limit: 1024m +# expose: +# - "8080" +# environment: +# - SERVER_PORT=${SERVER_PORT} +# - PROFILE=${PROFILE} +# volumes: +# - opendmp/file-transformer-docx/config:/config +# - logs/file-transformer-docx:/logs +# - storage/file-transformer-docx:/storage +# networks: +# - opendmp-backend-network +# - opendmp-plugins-network +# - opendmp-gotenberg-shared-network + +# opendmp.file.transformer.rdajson: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# restart: unless-stopped +# cpus: 1 +# mem_limit: 1024m +# expose: +# - "8080" +# environment: +# - SERVER_PORT=${SERVER_PORT} +# - PROFILE=${PROFILE} +# volumes: +# - opendmp/file-transformer-rda-json/config:/config +# - opendmp/file-transformer-rda-json/internal:/internal +# - logs/file-transformer-rda-json:/logs +# - storage/file-transformer-rda-json:/storage +# networks: +# - opendmp-backend-network +# - opendmp-plugins-network ############################## ZENODO ####################################### # opendmp.zenodo: - # user: ${DEPLOY_USER}:${DEPLOY_USER} + # user: ${DEPLOY_USER}:${DEPLOY_GROUP} # restart: unless-stopped # cpus: 1 # mem_limit: 1024m @@ -166,79 +164,77 @@ services: ############################## POSTGRES 16 ################################# opendmp.postgres: - user: ${DEPLOY_USER}:${DEPLOY_USER} + user: ${DEPLOY_USER}:${DEPLOY_GROUP} restart: unless-stopped mem_limit: 2048M ports: - # - "127.0.0.1:${POSTGRES_PORT}:5432" + # - "127.0.0.1:${POSTGRES_PORT}:5432" # If you want to make it accessible locally only - "${POSTGRES_PORT}:5432" env_file: - postgres/postgres.env volumes: - - /postgres/opendmp_init.sql:/docker-entrypoint-initdb.d/opendmp_init.sql - - /postgres/keycloak_init.sql:/docker-entrypoint-initdb.d/keycloak_init.sql - - /storage/postgres/data:/var/lib/postgresql/data + - ./storage/postgres/data:/var/lib/postgresql/data networks: - - opendmp-keycloak-shared-network + - opendmp-postgres-shared-network ################################# ELK ################################################# - opendmp.elasticsearch: - user: ${DEPLOY_USER}:${DEPLOY_USER} - group_add: - - 0 - restart: unless-stopped - cpus: 2 - mem_limit: 1024m - env_file: - - /elk/config-elk/elasticsearch/elastic.env - environment: - - "ES_JAVA_OPTS=-Xmx512m -Xms512m" - ulimits: - nproc: 65535 - memlock: - soft: -1 - hard: -1 - volumes: - - /elk/config-elk/elasticsearch/certificates:/usr/share/elasticsearch/config/certificates - - /elk/config-elk/elasticsearch/config/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro - - /elk/config-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro - - /elk/data-elk/elasticsearch-data:/usr/share/elasticsearch/data - - /elk/data-elk/elasticsearch-log:/usr/share/elasticsearch/logs - expose: - - "9200" - - "9300" - networks: - - opendmp-elastic-network - - opendmp-elastic-shared-network - healthcheck: - test: curl --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi - interval: 30s - timeout: 10s - retries: 5 +# opendmp.elasticsearch: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# group_add: +# - 0 +# restart: unless-stopped +# cpus: 2 +# mem_limit: 1024m +# env_file: +# - elk/config-elk/elasticsearch/elastic.env +# environment: +# - "ES_JAVA_OPTS=-Xmx512m -Xms512m" +# ulimits: +# nproc: 65535 +# memlock: +# soft: -1 +# hard: -1 +# volumes: +# - elk/config-elk/elasticsearch/certificates:/usr/share/elasticsearch/config/certificates +# - elk/config-elk/elasticsearch/config/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties:ro +# - elk/config-elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro +# - elk/data-elk/elasticsearch-data:/usr/share/elasticsearch/data +# - elk/data-elk/elasticsearch-log:/usr/share/elasticsearch/logs +# expose: +# - "9200" +# - "9300" +# networks: +# - opendmp-elastic-network +# - opendmp-elastic-shared-network +# healthcheck: +# test: curl --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi +# interval: 30s +# timeout: 10s +# retries: 5 - # opendmp.logstash: - # volumes: - # - /elk/data-elk/logstash-log:/usr/share/logstash/logs +# # opendmp.logstash: +# # volumes: +# # - /elk/data-elk/logstash-log:/usr/share/logstash/logs - opendmp.kibana: - user: ${DEPLOY_USER}:${DEPLOY_USER} - restart: unless-stopped - cpus: 2 - mem_limit: 1024m - environment: - - xpack.license.self_generated.type=basic - - xpack.security.enabled=true - volumes: - - /elk/config-elk/kibana/certificates:/usr/share/kibana/certificates - - /elk/config-elk/kibana/certificates/ca:/usr/share/kibana/certificate_authorities - - /elk/config-elk/kibana/config:/usr/share/kibana/config:ro - expose: - - "5601" - networks: - - opendmp-elastic-network +# opendmp.kibana: +# user: ${DEPLOY_USER}:${DEPLOY_GROUP} +# restart: unless-stopped +# cpus: 2 +# mem_limit: 1024m +# environment: +# - xpack.license.self_generated.type=basic +# - xpack.security.enabled=true +# volumes: +# - elk/config-elk/kibana/certificates:/usr/share/kibana/certificates +# - elk/config-elk/kibana/certificates/ca:/usr/share/kibana/certificate_authorities +# - elk/config-elk/kibana/config:/usr/share/kibana/config:ro +# expose: +# - "5601" +# networks: +# - opendmp-elastic-network + +# # opendmp.filebeat: - # opendmp.filebeat: - ############################## KEYCLOAK ############################################### opendmp.keycloak: @@ -249,66 +245,72 @@ services: security_opt: - seccomp:unconfined env_file: - - /keycloak/keycloak.env + - keycloak/keycloak.env environment: - JAVA_OPTS_APPEND="-Djava.net.preferIPv4Stack=true" volumes: - - /logs/keycloak:/tmp/logs - - /keycloak/imports/opendmp-realm.json:/opt/keycloak/data/import/opendmp-realm.json - - /keycloak/certs/keycloak-selfsigned.crt:/tmp/keycloak-selfsigned.crt:ro - - /keycloak/certs/keycloak-selfsigned.key:/tmp/keycloak-selfsigned.key:ro + - logs/keycloak:/tmp/logs + - keycloak/imports/opendmp-realm.json:/opt/keycloak/data/import/opendmp-realm.json + - keycloak/certs/keycloak-selfsigned.crt:/tmp/keycloak-selfsigned.crt:ro + - keycloak/certs/keycloak-selfsigned.key:/tmp/keycloak-selfsigned.key:ro expose: - "8443" networks: - opendmp-proxy-network + - opendmp-postgres-shared-network - opendmp-keycloak-shared-network -############################## RABBITMQ ############################################### - opendmp.rabbitmq: - labels: - NAME: "rabbitmq" - cpus: 1 - mem_limit: 512m - restart: unless-stopped - expose: - - "15672" - - "5672" - env_file: - - /rabbitmq/rabbitmq.env -# volumes: -# - /rabbitmq/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro - networks: - - opendmp-proxy-network - - opendmp-rabbitmq-shared-network +# ############################## RABBITMQ ############################################### +# opendmp.rabbitmq: +# labels: +# NAME: "rabbitmq" +# cpus: 1 +# mem_limit: 512m +# restart: unless-stopped +# expose: +# - "15672" +# - "5672" +# env_file: +# - rabbitmq/rabbitmq.env +# # volumes: +# # - /rabbitmq/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro +# networks: +# - opendmp-proxy-network +# - opendmp-rabbitmq-shared-network -############################## GOTENBERG ############################################## - opendmo.gotenberg: - mem_limit: 2048m - restart: unless-stopped - expose: - - "3000" - hostname: gotenberg - env_file: - - /gotenberg/gotenberg.env - networks: - - opendmp-gotenberg-shared-network +# ############################## GOTENBERG ############################################## +# opendmp.gotenberg: +# mem_limit: 2048m +# restart: unless-stopped +# expose: +# - "3000" +# hostname: gotenberg +# env_file: +# - gotenberg/gotenberg.env +# networks: +# - opendmp-gotenberg-shared-network networks: + opendmp-elastic-network: + name: opendmp-elastic-network opendmp-proxy-network: + name: opendmp-proxy-network opendmp-backend-network: + name: opendmp-backend-network opendmp-plugins-network: + name: opendmp-plugins-network opendmp-keycloak-shared-network: - external: - name: opendmp-keycloak-shared-network + external: true + name: opendmp-keycloak-shared-network opendmp-gotenberg-shared-network: - external: - name: opendmp-gotenberg-shared-network + external: true + name: opendmp-gotenberg-shared-network opendmp-rabbitmq-shared-network: - external: - name: opendmp-rabbitmq-shared-network + external: true + name: opendmp-rabbitmq-shared-network opendmp-elastic-shared-network: - external: - name: opendmp-elastic-shared-network + external: true + name: opendmp-elastic-shared-network opendmp-postgres-shared-network: - external: - name: opendmp-postgres-shared-network \ No newline at end of file + external: true + name: opendmp-postgres-shared-network diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 1d9db08fa..0341ada59 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -1,52 +1,50 @@ -version: "2.4" - services: ############################## PROXY ######################################## - opendmp.proxy: - container_name: opendmp.proxy - image: nginx:${PROXY_TAG} +# opendmp.proxy: +# container_name: opendmp.proxy +# image: nginx:${PROXY_TAG} -############################## OPENDMP APP ################################# +# ############################## OPENDMP APP ################################# - opendmp.frontend: - container_name: opendmp.frontend - image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG} - depends_on: - - opendmp.backend - - opendmp.notification - - opendmp.annotation +# opendmp.frontend: +# container_name: opendmp.frontend +# image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG} +# depends_on: +# - opendmp.backend +# - opendmp.notification +# - opendmp.annotation - opendmp.backend: - container_name: opendmp.backend - image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG} - depends_on: - - opendmp.postgres +# opendmp.backend: +# container_name: opendmp.backend +# image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG} +# depends_on: +# - opendmp.postgres - opendmp.notification: - container_name: opendmp.notification - image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG} - depends_on: - - opendmp.postgres +# opendmp.notification: +# container_name: opendmp.notification +# image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG} +# depends_on: +# - opendmp.postgres - opendmp.annotation: - container_name: opendmp.annotation - image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG} - depends_on: - - opendmp.postgres +# opendmp.annotation: +# container_name: opendmp.annotation +# image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG} +# depends_on: +# - opendmp.postgres -############################## FILE-TRANSFORMERS ####################################### +# ############################## FILE-TRANSFORMERS ####################################### - opendmp.file.transformer.docx: - container_name: opendmp.file.transformer.docx - image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG} - depends_on: - - opendmp.backend +# opendmp.file.transformer.docx: +# container_name: opendmp.file.transformer.docx +# image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG} +# depends_on: +# - opendmp.backend - opendmp.file.transformer.rdajson: - container_name: opendmp.file.transformer.rdajson - image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG} - depends_on: - - opendmp.backend +# opendmp.file.transformer.rdajson: +# container_name: opendmp.file.transformer.rdajson +# image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG} +# depends_on: +# - opendmp.backend ################################ ZENODO ############################################### # opendmp.zenodo: @@ -59,57 +57,61 @@ services: opendmp.postgres: container_name: opendmp.postgres image: postgres:${POSTGRES_TAG} + build: + context: ./postgres/ + args: + POSTGRES_TAG: $POSTGRES_TAG ################################# ELK ################################################# - opendmp.elasticsearch: - container_name: opendmp.elasticsearch - image: elasticsearch - build: - context: /elk/elasticsearch/ - args: - ELK_VERSION: $ELK_VERSION +# opendmp.elasticsearch: +# container_name: opendmp.elasticsearch +# image: elasticsearch +# build: +# context: /elk/elasticsearch/ +# args: +# ELK_VERSION: $ELK_VERSION - # opendmp.logstash: - # container_name: opendmp.logstash - # image: logstash - # build: - # context: /elk/logstash/ - # args: - # ELK_VERSION: $ELK_VERSION - # depends_on: - # - opendmp.elasticsearch +# # opendmp.logstash: +# # container_name: opendmp.logstash +# # image: logstash +# # build: +# # context: /elk/logstash/ +# # args: +# # ELK_VERSION: $ELK_VERSION +# # depends_on: +# # - opendmp.elasticsearch - opendmp.kibana: - container_name: opendmp.kibana - image: kibana - build: - context: /elk/kibana/ - args: - ELK_VERSION: $ELK_VERSION - depends_on: - - opendmp.elasticsearch +# opendmp.kibana: +# container_name: opendmp.kibana +# image: kibana +# build: +# context: /elk/kibana/ +# args: +# ELK_VERSION: $ELK_VERSION +# depends_on: +# - opendmp.elasticsearch - # opendmp.filebeat: - # container_name: opendmp.filebeat - # image: filebeat - # build: - # context: /elk/filebeat/ - # args: - # ELK_VERSION: $ELK_VERSION - # depends_on: - # - opendmp.logstash +# # opendmp.filebeat: +# # container_name: opendmp.filebeat +# # image: filebeat +# # build: +# # context: /elk/filebeat/ +# # args: +# # ELK_VERSION: $ELK_VERSION +# # depends_on: +# # - opendmp.logstash ############################## KEYCLOAK ############################################### opendmp.keycloak: container_name: opendmp.keycloak image: quay.io/keycloak/keycloak:${KEYCLOAK_TAG} -############################## RABBITMQ ############################################### - opendmp.rabbitmq: - container_name: opendmp.rabbitmq - image: rabbitmq:${RABBITMQ_TAG} +# ############################## RABBITMQ ############################################### +# opendmp.rabbitmq: +# container_name: opendmp.rabbitmq +# image: rabbitmq:${RABBITMQ_TAG} -############################## GOTENBERG ############################################## - opendmp.gotenberg: - image: gotenberg/gotenberg:${GOTENBERG_TAG} - container_name: opendmp.gotenberg +# ############################## GOTENBERG ############################################## +# opendmp.gotenberg: +# image: gotenberg/gotenberg:${GOTENBERG_TAG} +# container_name: opendmp.gotenberg diff --git a/deployment/postgres/Dockerfile b/deployment/postgres/Dockerfile new file mode 100644 index 000000000..9798ad94a --- /dev/null +++ b/deployment/postgres/Dockerfile @@ -0,0 +1,10 @@ +ARG POSTGRES_TAG +ARG DEPLOY_USER +ARG DEPLOY_GROUP +FROM postgres:${POSTGRES_TAG} +COPY ./opendmp_init.sql /docker-entrypoint-initdb.d/ +COPY ./keycloak_init.sql /docker-entrypoint-initdb.d/ +COPY ./user_init.sql /docker-entrypoint-initdb.d/ +ENTRYPOINT ["docker-entrypoint.sh"] +EXPOSE 5432 +CMD ["postgres"] \ No newline at end of file diff --git a/deployment/postgres/keycloak_init.sql b/deployment/postgres/keycloak_init.sql index 334cb8f66..f07c5e55f 100644 Binary files a/deployment/postgres/keycloak_init.sql and b/deployment/postgres/keycloak_init.sql differ diff --git a/deployment/postgres/opendmp_init.sql b/deployment/postgres/opendmp_init.sql index c932bc0ab..360abc878 100644 Binary files a/deployment/postgres/opendmp_init.sql and b/deployment/postgres/opendmp_init.sql differ diff --git a/deployment/postgres/postgres.env b/deployment/postgres/postgres.env index 7ec5f2c9f..abc761088 100644 --- a/deployment/postgres/postgres.env +++ b/deployment/postgres/postgres.env @@ -1,4 +1,4 @@ #################### POSTGRES ######################## -#POSTGRES_DB=keycloak -POSTGRES_USER=admin -POSTGRES_PASSWORD=changeme \ No newline at end of file +POSTGRES_USER=postgres +POSTGRES_PASSWORD=changeme +PGDATA=/var/lib/postgresql/data/ \ No newline at end of file diff --git a/deployment/postgres/user_init.sql b/deployment/postgres/user_init.sql new file mode 100644 index 000000000..fc5ed4714 --- /dev/null +++ b/deployment/postgres/user_init.sql @@ -0,0 +1,4 @@ +CREATE USER keycloak_psql WITH PASSWORD 'keycloak-admin'; +ALTER DATABASE keycloak OWNER TO keycloak_psql; +CREATE USER opendmp_psql WITH PASSWORD 'opendmp-admin'; +ALTER DATABASE "opendmp-test" OWNER TO opendmp_psql; \ No newline at end of file diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java index d11c87a4f..e3a6d5e13 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/description/DescriptionServiceImpl.java @@ -976,29 +976,63 @@ public class DescriptionServiceImpl implements DescriptionService { private @NotNull PropertyDefinitionPersist buildPropertyDefinitionPersist(PropertyDefinitionEntity data, eu.eudat.commons.types.descriptiontemplate.DefinitionEntity definition){ PropertyDefinitionPersist persist = new PropertyDefinitionPersist(); if (data == null) return persist; + + List referenceIds = this.calculateAllReferenceIdsFromData(data, definition); + List references = null; + if (!this.conventionService.isListNullOrEmpty(referenceIds)){ + references = this.queryFactory.query(ReferenceQuery.class).ids(referenceIds).collect(); + } if (data.getFieldSets() != null && !data.getFieldSets().isEmpty()){ persist.setFieldSets(new HashMap<>()); for (String key: data.getFieldSets().keySet()) { FieldSetEntity fieldSetEntity = definition != null ? definition.getFieldSetById(key).stream().findFirst().orElse(null) : null; - persist.getFieldSets().put(key, this.buildPropertyDefinitionFieldSetPersist(data.getFieldSets().get(key), fieldSetEntity)); + persist.getFieldSets().put(key, this.buildPropertyDefinitionFieldSetPersist(data.getFieldSets().get(key), fieldSetEntity, references)); } } return persist; } - private @NotNull PropertyDefinitionFieldSetPersist buildPropertyDefinitionFieldSetPersist(PropertyDefinitionFieldSetEntity data, FieldSetEntity fieldSetEntity){ + private List calculateAllReferenceIdsFromData(PropertyDefinitionEntity data, eu.eudat.commons.types.descriptiontemplate.DefinitionEntity definition){ + List referenceIds = new ArrayList<>(); + + if (data.getFieldSets() != null && !data.getFieldSets().isEmpty()){ + for (PropertyDefinitionFieldSetEntity fieldSet: data.getFieldSets().values()) { + if (!this.conventionService.isListNullOrEmpty(fieldSet.getItems())); + for (PropertyDefinitionFieldSetItemEntity item: fieldSet.getItems()) { + if (item.getFields() != null && !item.getFields().isEmpty()); + for (String key: item.getFields().keySet()) { + if (definition.getFieldById(key).getFirst() != null && FieldType.isReferenceType(definition.getFieldById(key).getFirst().getData().getFieldType())){ + if (!this.conventionService.isListNullOrEmpty(item.getFields().get(key).getTextListValue())){ + referenceIds.addAll(item.getFields().get(key).getTextListValue()); + } + } + } + } + } + } + + if (!this.conventionService.isListNullOrEmpty(referenceIds)) { + referenceIds = referenceIds.stream().distinct().collect(Collectors.toList()); + return referenceIds.stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).collect(Collectors.toList()).stream().map(x -> UUID.fromString(x)).collect(Collectors.toList()); + + } + + return null; + } + + private @NotNull PropertyDefinitionFieldSetPersist buildPropertyDefinitionFieldSetPersist(PropertyDefinitionFieldSetEntity data, FieldSetEntity fieldSetEntity, List references){ PropertyDefinitionFieldSetPersist persist = new PropertyDefinitionFieldSetPersist(); if (data == null) return persist; if (!this.conventionService.isListNullOrEmpty(data.getItems())){ persist.setItems(new ArrayList<>()); for (PropertyDefinitionFieldSetItemEntity itemsPersist: data.getItems()) { - persist.getItems().add(this.buildPropertyDefinitionFieldSetItemPersist(itemsPersist, fieldSetEntity)); + persist.getItems().add(this.buildPropertyDefinitionFieldSetItemPersist(itemsPersist, fieldSetEntity, references)); } } return persist; } - private @NotNull PropertyDefinitionFieldSetItemPersist buildPropertyDefinitionFieldSetItemPersist(PropertyDefinitionFieldSetItemEntity data, FieldSetEntity fieldSetEntity){ + private @NotNull PropertyDefinitionFieldSetItemPersist buildPropertyDefinitionFieldSetItemPersist(PropertyDefinitionFieldSetItemEntity data, FieldSetEntity fieldSetEntity, List references){ PropertyDefinitionFieldSetItemPersist persist = new PropertyDefinitionFieldSetItemPersist(); if (data == null) return persist; if (data.getFields() != null && !data.getFields().isEmpty()){ @@ -1006,14 +1040,14 @@ public class DescriptionServiceImpl implements DescriptionService { persist.setComment(data.getComment()); persist.setFields(new HashMap<>()); for (String key: data.getFields().keySet()) { - eu.eudat.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getAllField().stream().findFirst().orElse(null) : null; - persist.getFields().put(key, this.buildFieldPersist(data.getFields().get(key), fieldEntity)); + eu.eudat.commons.types.descriptiontemplate.FieldEntity fieldEntity = fieldSetEntity != null ? fieldSetEntity.getFieldById(key).stream().findFirst().orElse(null) : null; + persist.getFields().put(key, this.buildFieldPersist(data.getFields().get(key), fieldEntity, references)); } } return persist; } - private @NotNull FieldPersist buildFieldPersist(FieldEntity data, eu.eudat.commons.types.descriptiontemplate.FieldEntity fieldEntity) { + private @NotNull FieldPersist buildFieldPersist(FieldEntity data, eu.eudat.commons.types.descriptiontemplate.FieldEntity fieldEntity, List references) { FieldType fieldType = fieldEntity != null && fieldEntity.getData() != null ? fieldEntity.getData().getFieldType() : FieldType.FREE_TEXT; FieldPersist persist = new FieldPersist(); @@ -1023,7 +1057,17 @@ public class DescriptionServiceImpl implements DescriptionService { else if (FieldType.isTextListType(fieldType)) persist.setTextListValue(data.getTextListValue()); else if (FieldType.isDateType(fieldType)) persist.setDateValue(persist.getDateValue()); else if (FieldType.isExternalIdentifierType(fieldType) && data.getExternalIdentifier() != null) persist.setExternalIdentifier(this.buildExternalIdentifierPersist(data.getExternalIdentifier())); - else if (FieldType.isReferenceType(fieldType) && fieldEntity != null ) persist.setTextListValue(data.getTextListValue()); + else if (FieldType.isReferenceType(fieldType) && fieldEntity != null ) { + if (!this.conventionService.isListNullOrEmpty(data.getTextListValue()) && !this.conventionService.isListNullOrEmpty(references)){ + List referenceIdsInField = data.getTextListValue().stream().filter(x -> this.conventionService.isValidGuid(UUID.fromString(x))).collect(Collectors.toList()).stream().map(x -> UUID.fromString(x)).collect(Collectors.toList()); + if (!this.conventionService.isListNullOrEmpty(referenceIdsInField)){ + List referencesInField = references.stream().filter(x -> referenceIdsInField.contains(x.getId())).collect(Collectors.toList()); + if (!this.conventionService.isListNullOrEmpty(referencesInField)){ + persist.setReferences(this.buildReferencePersist(referencesInField)); + } + } + } + } return persist; } @@ -1036,4 +1080,25 @@ public class DescriptionServiceImpl implements DescriptionService { persist.setType(data.getType()); return persist; } + + private @NotNull List buildReferencePersist(List referenceEntities){ + List referencesPersist = new ArrayList<>(); + if (this.conventionService.isListNullOrEmpty(referenceEntities)) return referencesPersist; + + for (ReferenceEntity entity: referenceEntities) { + ReferencePersist persist = new ReferencePersist(); + persist.setId(entity.getId()); + persist.setLabel(entity.getLabel()); + persist.setDescription(entity.getDescription()); + persist.setReference(entity.getReference()); + persist.setSource(entity.getSource()); + persist.setSourceType(entity.getSourceType()); + persist.setTypeId(entity.getTypeId()); + persist.setAbbreviation(entity.getAbbreviation()); + + referencesPersist.add(persist); + } + + return referencesPersist; + } } diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index 7c59fea12..8d2a40aa1 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -78,48 +78,64 @@
-
-
-
+
+
+
chevron_left {{'DESCRIPTION-EDITOR.ACTIONS.BACK-TO' | translate}}
-
{{'DESCRIPTION-EDITOR.DMP' | translate}}
+
{{'DESCRIPTION-EDITOR.DMP' | translate}}
-
{{'DESCRIPTION-EDITOR.TOC.TITLE' | translate}}
-
-
-
{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} ({{ countErrorsOfBaseInfoPage }})
-
{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} (done)
+
{{'DESCRIPTION-EDITOR.TOC.TITLE' | translate}}
+
+
+
+
{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} ({{ countErrorsOfBaseInfoPage }})
+
+
+
{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} (done)
+
- +
+ +
-
-