merged with prod

This commit is contained in:
Francesco Mangiacrapa 2026-03-12 15:37:23 +01:00
parent 62bef46ec4
commit b3944238b2
5 changed files with 63 additions and 11 deletions

View File

@ -17,7 +17,7 @@ WORKDIR ${APP_DIR}
ARG CACHEBUST
# Branch Theme argument
ARG THEME_BRANCH
ARG THEME_BRANCH=main
ENV THEME_BRANCH=${THEME_BRANCH}
# CKAN configuration & extensions
@ -44,7 +44,7 @@ RUN echo "Cache bust: ${CACHEBUST}" && \
apt-get install -y cron && \
# Install CKAN extensions
echo "ckan/ckanext-xloader" && \
pip3 install --no-cache-dir -e git+https://github.com/mjanez/ckanext-xloader.git@1.0.1-stable#egg=ckanext-xloader && \
pip3 install --no-cache-dir -e git+https://github.com/mjanez/ckanext-xloader.git@1.0.1-stable#egg=ckanext-xloader && \
pip3 install --no-cache-dir -r ${APP_DIR}/src/ckanext-xloader/requirements.txt && \
pip3 install --no-cache-dir -U requests[security] && \
echo "ckan/ckanext-harvest" && \
@ -80,7 +80,7 @@ RUN echo "Cache bust: ${CACHEBUST}" && \
echo "ckan/ckanext-geonetwork" && \
pip3 install --no-cache-dir -e git+https://code-repo.d4science.org/D4ScienceCatalogue/ckanext-geonetwork.git@main#egg=ckanext-geonetwork && \
echo "ckan/ckanext-hierarchy" && \
pip3 install --no-cache-dir -e git+https://github.com/ckan/ckanext-hierarchy.git@v1.2.2#egg=ckanext-hierarchy && \
pip3 install --no-cache-dir -e git+https://code-repo.d4science.org/D4ScienceCatalogue/hierarchy-d4science.git@d4science_custom#egg=ckanext-hierarchy && \
pip3 install --no-cache-dir -r ${APP_DIR}/src/ckanext-hierarchy/requirements.txt && \
echo "ckanext/ckanext-d4science_theme" && \
pip3 install --no-cache-dir -e git+https://code-repo.d4science.org/D4ScienceCatalogue/ckanext-d4science_theme.git@main#egg=ckanext-d4science_theme && \

View File

@ -22,6 +22,19 @@ ckan config-tool $CKAN_INI \
"ckan.tracking_enabled=${CKAN_TRACKING_ENABLED:-false}" \
"ckan.site_title=${CKAN__SITE_TITLE:-CKAN Instance}"
# ckan: tracking information: Add tracking information settings to the CKAN config file
echo "[docker-entrypoint.01_setup_ckanext_config] Loading tracking information settings in the CKAN config file"
ckan config-tool $CKAN_INI \
"ckanext.d4science_theme.tracking_info_text=$CKANEXT__D4SCIENCE_THEME__TRACKING_INFO_TEXT" \
"ckanext.d4science_theme.tracking_start_date=$CKANEXT__D4SCIENCE_THEME__TRACKING_START_DATE"
# ckan: Install language configurations
echo "[docker-entrypoint.01_setup_ckanext_config] Setting CKAN locales: (default: $CKAN__LOCALE_DEFAULT), (order: $CKAN__LOCALE_ORDER), (offered: $CKAN__LOCALES_OFFERED)"
ckan config-tool $CKAN_INI \
"ckan.locale_default=${CKAN__LOCALE_DEFAULT}" \
"ckan.locale_order=${CKAN__LOCALE_ORDER}" \
"ckan.locales_offered=${CKAN__LOCALES_OFFERED}"
# ckan: Update log levels
echo "[docker-entrypoint.01_setup_ckanext_config] Setting CKAN log levels: (logger_root: $ROOT_LOG_LEVEL), (logger_ckan: $CKAN_LOG_LEVEL), (logger_ckanext: $CKANEXT_LOG_LEVEL)"
ckan config-tool $CKAN_INI -s logger_root "level=${ROOT_LOG_LEVEL:-WARNING}"
@ -101,6 +114,13 @@ ckan config-tool $CKAN_INI \
"ckan.focused_dataset_types=$CKAN__FOCUSED_DATASET_TYPES" \
"ckan.focused_dataset_types_icons=$CKAN__FOCUSED_DATASET_TYPES_ICONS"
#ITINERIS customization: Add ckanext-custom-type settings to the CKAN config file
echo "[docker-entrypoint.01_setup_ckanext_config] Loading ckanext.custom.type settings in the CKAN config file"
ckan config-tool $CKAN_INI \
"ckanext.custom.type.titles=$CKANEXT__CUSTOM__TYPE__TITLES" \
"ckanext.custom.type.descriptions=$CKANEXT__CUSTOM__TYPE__DESCRIPTIONS" \
"ckanext.custom.type.facets=$CKANEXT__CUSTOM__TYPE__FACETS"
# ckanext-geoview: Add geoviews CKAN config file
echo "[docker-entrypoint.01_setup_ckanext_config] Loading geoviews in the CKAN config file"
ckan config-tool $CKAN_INI \

View File

@ -19,19 +19,51 @@ GCUBE_LANG_DEST_DIR=${CKAN_APP_DIR}/ckan/ckan/i18n/${GCUBE_LANG_NAME}/LC_MESSAGE
install_gcube_lang() {
# Install GCube language localization for CKAN
echo -e "\n*** Install_gcube_lang called"
if [ ! -d ${GCUBE_LANG_DEST_DIR} ] ; then
mkdir -p ${GCUBE_LANG_DEST_DIR}
if [ ! -d "${GCUBE_LANG_DEST_DIR}" ] ; then
if mkdir -p "${GCUBE_LANG_DEST_DIR}" 2>/dev/null ; then
echo "Created destination directory: ${GCUBE_LANG_DEST_DIR}"
fi
#GCUBE_INIT_LANG=0
fi
if [ ! -w "${GCUBE_LANG_DEST_DIR}" ] ; then
# chown may have failed at startup (rootless Docker / no CAP_CHOWN); try chmod as fallback
chmod ug+w "${GCUBE_LANG_DEST_DIR}" 2>/dev/null || true
fi
if [ ! -w "${GCUBE_LANG_DEST_DIR}" ] ; then
echo "${GCUBE_LANG_DEST_DIR} is not writable. Skipping language override/compile for locale ${GCUBE_LANG_NAME}."
echo -e "\n*** Install_gcube_lang finished with warnings: not writable destination directory."
return 0
fi
echo "Destination directory is writable: ${GCUBE_LANG_DEST_DIR}"
# Copy language files to destination
if [ -d "${GCUBE_SOURCE_LANG_DIR}" ] ; then
cp -f "${GCUBE_SOURCE_LANG_DIR}/${GCUBE_LANG_NAME}/LC_MESSAGES/ckan.po" "${GCUBE_LANG_DEST_DIR}"
#cp -f "${GCUBE_SOURCE_LANG_DIR}/i18n.py" "${GCUBE_I18N_DEST_DIR}/i18n.py"
echo "Source language directory found: ${GCUBE_SOURCE_LANG_DIR}"
if cp -f "${GCUBE_SOURCE_LANG_DIR}/${GCUBE_LANG_NAME}/LC_MESSAGES/ckan.po" "${GCUBE_LANG_DEST_DIR}" ; then
echo "Copied ckan.po to ${GCUBE_LANG_DEST_DIR}"
#cp -f "${GCUBE_SOURCE_LANG_DIR}/i18n.py" "${GCUBE_I18N_DEST_DIR}/i18n.py"
else
echo "Unable to copy ckan.po to ${GCUBE_LANG_DEST_DIR}. Skipping language override for locale ${GCUBE_LANG_NAME}."
echo -e "\n*** Install_gcube_lang finished with warnings: unable to copy language files."
return 0
fi
else
echo "${GCUBE_SOURCE_LANG_DIR} not found. Skipping language override for locale ${GCUBE_LANG_NAME}."
echo -e "\n*** Install_gcube_lang finished with warnings: source directory not found."
return 0
fi
cd "${CKAN_APP_DIR}/ckan"
# Use --use-fuzzy flag to compile even if catalog is marked as fuzzy
python setup.py compile_catalog --locale ${GCUBE_LANG_NAME} --use-fuzzy
if python setup.py compile_catalog --locale ${GCUBE_LANG_NAME} --use-fuzzy ; then
echo "Catalog compiled successfully for locale ${GCUBE_LANG_NAME}."
else
echo "Unable to compile catalog for locale ${GCUBE_LANG_NAME} due to filesystem permissions. Skipping."
echo -e "\n*** Install_gcube_lang finished with warnings: unable to compile catalog."
return 0
fi
# INSTALL ONLY DURING INIT
#if [ $GCUBE_INIT_LANG -eq 0 ] ; then
@ -39,7 +71,7 @@ install_gcube_lang() {
# cd "${CKAN_APP_DIR}/ckan"
# python setup.py compile_catalog --locale ${GCUBE_LANG_NAME}
#fi
echo -e "\n*** Install_gcube_lang finished"
echo -e "\n*** Install_gcube_lang finished successfully"
}
# License installation

View File

@ -58,7 +58,7 @@ services:
- pip_cache:/root/.cache/pip
- site_packages:/usr/lib/python3.9/site-packages
- vscode_server:/root/.vscode-server
- ./ckan_translations:/srv/app/src/ckan/ckan/i18n
#- ./ckan_translations:/srv/app/src/ckan/ckan/i18n
- ./resources/Namespaces_Catalogue_Categories.csv:/tmp/namespaces_for_catalogue/Namespaces_Catalogue_Categories.csv
restart: unless-stopped
healthcheck:

View File

@ -58,7 +58,7 @@ services:
- pip_cache:/root/.cache/pip
- site_packages:/usr/lib/python3.9/site-packages
- ./resources/Namespaces_Catalogue_Categories.csv:/tmp/namespaces_for_catalogue/Namespaces_Catalogue_Categories.csv
- ./ckan_translations:/srv/app/src/ckan/ckan/i18n
#-./ckan_translations:/srv/app/src/ckan/ckan/i18n
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"]