From 32f3f6fe4797d037c6a0fda3357f7d18c1ced365 Mon Sep 17 00:00:00 2001 From: Awang Date: Thu, 11 Jan 2024 08:08:55 +0700 Subject: [PATCH] [BIO-6368] configured DOI (#7) * [BIO-6368] configured DOI * [BIO-6368] - Updated doi extension to latest tag - Fixed `02_setup-dbca.sh` to get CKAN plugins from the dbca.ini config file and use this file in init db commands - Updated dbca.ini to use new config value `ckanext.doi.language` and revert back to `en_AU` as the ckan locale default --------- Co-authored-by: Mark Calvert --- .env.dbca | 4 ++++ ckan/config/dbca.ini | 8 +++++++- ckan/docker-entrypoint.d/02_setup_dbca.sh | 13 ++++++++++++- ckan/setup/dbca_requirements.sh | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.env.dbca b/.env.dbca index df09a41c..23c45fad 100644 --- a/.env.dbca +++ b/.env.dbca @@ -74,6 +74,10 @@ NGINX_SSLPORT=443 # Extensions +## ckanext-doi ## +CKANEXT__DOI__ACCOUNT_NAME= +CKANEXT__DOI__ACCOUNT_PASSWORD= + ## WA DBCA Config ## # Docker compose project name COMPOSE_PROJECT_NAME=dbca diff --git a/ckan/config/dbca.ini b/ckan/config/dbca.ini index 91dca1ac..488196ac 100644 --- a/ckan/config/dbca.ini +++ b/ckan/config/dbca.ini @@ -10,7 +10,7 @@ use = config:/srv/app/ckan.ini ckan.devserver.watch_patterns = /srv/app/ckan.ini ## Plugins Settings ############################################################ -ckan.plugins = image_view text_view datatables_view pdf_view datastore xloader pages showcase hierarchy_display hierarchy_form hierarchy_group_form dcat dbca scheming_datasets spatial_metadata spatial_query envvars +ckan.plugins = image_view text_view datatables_view pdf_view datastore xloader pages showcase hierarchy_display hierarchy_form hierarchy_group_form dcat dbca scheming_datasets spatial_metadata spatial_query doi envvars ## Resource Views Settings ##################################################### ckan.views.default_views = text_view datatables_view pdf_view @@ -30,6 +30,12 @@ ckanext.spatial.common_map.type = custom # ckanext-scheming scheming.dataset_schemas = ckanext.dbca:dbca_dataset.yaml +# ckanext-doi +ckanext.doi.publisher = Department of Biodiversity, Conservation and Attractions +ckanext.doi.prefix = 10.82800 +ckanext.doi.test_mode = True +ckanext.doi.language = en + ## CKAN Extensions configuration ############################################### ## Logging configuration diff --git a/ckan/docker-entrypoint.d/02_setup_dbca.sh b/ckan/docker-entrypoint.d/02_setup_dbca.sh index eb5cb320..2e3f5158 100644 --- a/ckan/docker-entrypoint.d/02_setup_dbca.sh +++ b/ckan/docker-entrypoint.d/02_setup_dbca.sh @@ -1,11 +1,18 @@ #!/bin/bash +# Get the ckan plugins values from the DBCA CKAN config file +CKAN__PLUGINS=$(grep '^ckan\.plugins' $APP_DIR/config/dbca.ini | cut -d'=' -f2) +echo "CKAN__PLUGINS: $CKAN__PLUGINS" + if [[ $CKAN__PLUGINS == *"xloader"* ]]; then # Add ckan.xloader.api_token to the CKAN config file (updated with corrected value later) echo "Setting a temporary value for ckanext.xloader.api_token" ckan config-tool $CKAN_INI "ckanext.xloader.api_token=$(ckan -c $CKAN_INI user token add $CKAN_SYSADMIN_NAME xloader | tail -n 1 | tr -d '\t')" fi +# Use the DBCA CKAN config file for the CKAN config file +CKAN_INI=$APP_DIR/config/dbca.ini + ## Examples of how to initialise DB for the extensions # if [[ $CKAN__PLUGINS == *"archiver"* ]]; then # ckan -c $CKAN_INI archiver init @@ -21,4 +28,8 @@ fi if [[ $CKAN__PLUGINS == *"pages"* ]]; then ckan -c $CKAN_INI pages initdb -fi \ No newline at end of file +fi + +if [[ $CKAN__PLUGINS == *"doi"* ]]; then + ckan -c $CKAN_INI doi initdb +fi diff --git a/ckan/setup/dbca_requirements.sh b/ckan/setup/dbca_requirements.sh index db41274c..d10db905 100644 --- a/ckan/setup/dbca_requirements.sh +++ b/ckan/setup/dbca_requirements.sh @@ -51,4 +51,4 @@ pip3 install -r ${SRC_DIR}/ckanext-xloader/requirements.txt # 3rd Party # # DOI -pip3 install -e git+https://github.com/NaturalHistoryMuseum/ckanext-doi@v3.1.9#egg=ckanext-doi \ No newline at end of file +pip3 install -e git+https://github.com/NaturalHistoryMuseum/ckanext-doi@v3.1.10#egg=ckanext-doi \ No newline at end of file