From fbe8ea62c23ef82c5975297c7db257a1fa8734a4 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Tue, 11 Feb 2025 00:11:52 +0000 Subject: [PATCH] Working deployment of invenio backend --- caddy/Caddyfile | 4 ---- docker-compose.yaml | 6 +++--- invenio_setup.sh | 39 +++++++++++++++++++++++++++++++++++++++ justfile | 5 +++++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 invenio_setup.sh diff --git a/caddy/Caddyfile b/caddy/Caddyfile index d422a8d..f57f413 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -1,9 +1,5 @@ { admin off - debug - log { - level DEBUG - } } am-d-model.eu { diff --git a/docker-compose.yaml b/docker-compose.yaml index 010c2c2..08a24f8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -128,7 +128,7 @@ services: volumes: - uploaded_data:/opt/invenio/var/instance/data environment: - - INVENIO_SQLALCHEMY_DATABASE_URI=${INVENIO_SQLALCHEMY_DATABASE_URI:-postgresql+psycopg2://inveniordm:inveniordm@db/inveniordm} + - INVENIO_SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://${POSTGRES_USER:-inveniordm}:${POSTGRES_PASSWORD:-inveniordm}@db/${POSTGRES_DB:-inveniordm} - INVENIO_SEARCH_HOSTS=${INVENIO_SEARCH_HOSTS:-['search:9200']} - INVENIO_SEARCH_INDEX_PREFIX=${INVENIO_SEARCH_INDEX_PREFIX:-invenio-rdm-} @@ -192,7 +192,7 @@ services: restart: "unless-stopped" environment: - bootstrap.memory_lock=true - - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m + - OPENSEARCH_JAVA_OPTS=-Xms256m -Xmx256m - DISABLE_INSTALL_DEMO_CONFIG=true - DISABLE_SECURITY_PLUGIN=true - discovery.type=single-node @@ -203,7 +203,7 @@ services: nofile: soft: 65536 hard: 65536 - mem_limit: 2g + mem_limit: 1g ports: - "9200:9200" - "9600:9600" diff --git a/invenio_setup.sh b/invenio_setup.sh new file mode 100644 index 0000000..8839613 --- /dev/null +++ b/invenio_setup.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "-- Setup InvenioRDM --" + +# Creating database... +invenio db init create + +# Creating files location... +invenio files location create --default s3-default "s3://${INVENIO_S3_BUCKET_NAME}" + +# Creating admin role... +invenio roles create admin + +# Assigning superuser access to admin role... +invenio access allow superuser-access role admin + +# Dropping and re-reating indices... +invenio index destroy --force --yes-i-know +invenio index init + +# Creating custom fields for records... +invenio rdm-records custom-fields init + +# Creating custom fields for communities... +invenio communities custom-fields init + +# Creating rdm fixtures... +invenio rdm-records fixtures + +# Creating demo records... +# invenio rdm-records demo records --user user@demo.org + +# Creating demo communities +# invenio rdm-records demo communities --user community@demo.org + +# Declaring queues... +invenio queues declare + +echo "-- Setup completed --" diff --git a/justfile b/justfile index fb51e85..8750bfe 100644 --- a/justfile +++ b/justfile @@ -83,3 +83,8 @@ cleanup-versions: git tag -d $tag rm -f "versions/${tag#backup-}.txt" done + +deploy: + #!/usr/bin/env bash + docker compose up -d --wait + docker exec -it am-d-modeleu-worker-1 setup.sh