merged with dev branch

This commit is contained in:
Francesco Mangiacrapa 2026-02-03 13:42:20 +01:00
parent b6a7e0b857
commit 381fd76b63
7 changed files with 96 additions and 29 deletions

36
Jenkinsfile vendored
View File

@ -13,20 +13,27 @@ pipeline {
CKAN_REPO = "gitea@code-repo.d4science.org:D4ScienceCatalogue/docker-ckan.git"
//CATALOG RELATED VARIABLES
CKAN_CORE_VERSION = "dev_ckan_2.10.5"
CKAN_IMAGE_NAME = "ckan210"
CKAN_THEME_BRANCH = "ckan-dev"
CKAN_IMAGE_BRANCH = "dev_ckan_2.10.5"
CKAN_IMAGE_TAG = "latest"
}
stages {
stage('Set IMAGE NAME') {
steps {
script {
env.CKAN_IMAGE_NAME = "${CKAN_IMAGE_BRANCH}-${env.CKAN_THEME_BRANCH}"
echo "IMAGE NAME = ${env.CKAN_IMAGE_NAME}"
}
}
}
stage('Build Docker Image') {
steps {
script {
sh """
docker build -t $hubname/$projectname/${env.CKAN_IMAGE_NAME}-${env.CKAN_CORE_VERSION}:${env.CKAN_IMAGE_TAG} ./ckan --build-arg CACHEBUST=\$(date +%s)
docker build -t $hubname/$projectname/${env.CKAN_IMAGE_NAME}:${env.CKAN_IMAGE_TAG} ./ckan --build-arg CACHEBUST=\$(date +%s) --build-arg THEME_BRANCH=${env.CKAN_THEME_NAME}
"""
}
@ -46,7 +53,7 @@ pipeline {
stage('Push Image') {
steps{
script {
sh "docker push $hubname/$projectname/${env.CKAN_IMAGE_NAME}-${env.CKAN_CORE_VERSION}:${env.CKAN_IMAGE_TAG}"
sh "docker push $hubname/$projectname/${env.CKAN_IMAGE_NAME}:${env.CKAN_IMAGE_TAG}"
}
}
}
@ -56,16 +63,21 @@ pipeline {
post {
success {
echo 'The docker pipeline worked!'
// emailext to: 'jenkinsbuilds@d4science.org',
// subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} worked",
// body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
slackSend channel: '#notifications_jenkins_prod',
color: '#36a64f',
message: "SUCCESS: *${env.JOB_NAME}* build #${env.BUILD_NUMBER} completed successfully. URL: ${env.BUILD_URL}"
}
failure {
echo 'The docker pipeline has failed'
// emailext attachLog: true,
/// to: 'jenkinsbuilds@d4science.org',
// subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} failed for image ${imagename}",
// body: "Something is wrong with ${env.BUILD_URL}"
slackSend channel: '#notifications_jenkins_prod',
color: '#d90000',
message: "FAILURE: *${env.JOB_NAME}* build #${env.BUILD_NUMBER} failed. URL: ${env.BUILD_URL}"
}
aborted {
slackSend channel: '#notifications_jenkins_prod',
color: '#FFD700',
message: "ABORTED: *${env.JOB_NAME}* build #${env.BUILD_NUMBER} was aborted. URL: ${env.BUILD_URL}"
}
}

View File

@ -1,4 +1,4 @@
FROM ghcr.io/mjanez/ckan-spatial-base:2.10.5-py3.10
FROM harbor.d4science.org/d4science-ckan/ckan-spatial-base:2.10.5-py3.10
LABEL maintainer="mnl.janez@gmail.com"
# Set up environment variables
@ -21,15 +21,12 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ARG CATALOGUE_REPOSITORY=https://code-repo.d4science.org/D4ScienceCatalogue/ckanext-d4science_theme.git
# Branch Theme argument
# e.g.: main
ARG CACHEBUST
ARG THEME_BRANCH
# Convert ARG to ENV so it's available in RUN commands
ENV CATALOGUE_REPOSITORY=${CATALOGUE_REPOSITORY}
ENV THEME_BRANCH=${THEME_BRANCH}
# Set working directory
WORKDIR ${APP_DIR}
@ -51,6 +48,12 @@ COPY req_fixes req_fixes
## PDFView - 0.0.8 ##
## Fluent - v1.0.1 (mjanez/Forked stable version) ##
## Scheming DCAT - v4.0.0 (mjanez/GeoDCAT-AP/NTI-RISP extended version) ##
# RUN git clone -b ${THEME_BRANCH} https://code-repo.d4science.org/D4ScienceCatalogue/ckanext-d4science_theme.git /tmp/ckanext-d4science_theme_custom && \
# cp -r /tmp/ckanext-d4science_theme_custom/* ${APP_DIR}/src/ckanext-d4science_theme/ && \
# echo "Theme branch: ${THEME_BRANCH}"
RUN echo "Cache bust: ${CACHEBUST}" && \
# echo ${TZ} > /etc/timezone && \
# if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then cp /usr/share/zoneinfo/${TZ} /etc/localtime; fi && \
@ -102,6 +105,7 @@ RUN echo "Cache bust: ${CACHEBUST}" && \
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 && \
git clone -b ${THEME_BRANCH} https://code-repo.d4science.org/D4ScienceCatalogue/ckanext-d4science_theme.git /tmp/ckanext-d4science_theme_custom && \
pip3 install --no-cache-dir -r ${APP_DIR}/src/ckanext-d4science-theme/requirements.txt && \
# #echo "NaturalHistoryMuseum/ckanext-doi" && \
# #pip3 install --no-cache-dir ckanext-doi && \
@ -131,9 +135,9 @@ RUN for d in $APP_DIR/patches/*; do \
done
# Fix ownership of /srv/app/src once during build (instead of at every container startup)
RUN chown -R ckan:ckan /srv/app/src
RUN chown -R ckan:ckan /srv/app/src && \
rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/lib/apt/lists/*
# Workers
## Update prerun.py with custom version
COPY setup/prerun.py.override ${APP_DIR}/prerun.py

View File

@ -8,7 +8,15 @@ ckan -c $CKAN_INI search-index clear
echo "[docker-entrypoint.01_setup_ckanext_config] Loading CKAN core settings in the CKAN config file"
ckan config-tool $CKAN_INI \
"search.facets.default=$SEARCH__FACETS__DEFAULT" \
"ckan.datastore.sqlsearch.enabled=$CKAN__DATASTORE__SQLSEARCH__ENABLED"
"ckan.datastore.sqlsearch.enabled=$CKAN__DATASTORE__SQLSEARCH__ENABLED" \
"ckan_tracking_enabled=${CKAN_TRACKING_ENABLED:-false}"
# 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 \
"logger_root.level=${ROOT_LOG_LEVEL:-WARNING}" \
"logger_ckan.level=${CKAN_LOG_LEVEL:-WARNING}" \
"logger_ckanext.level=${CKANEXT_LOG_LEVEL:-WARNING}"
# Add SMTP settings if CKAN__SMTP_ENABLED is true
if [ "$CKAN__SMTP_ENABLED" = "true" ]; then

View File

@ -0,0 +1,36 @@
#!/bin/bash
echo "Starting D4Science CKAN theme customizations installation."
CKAN_APP_DIR=/srv/app/src
#GCUBE_LANG_NAME=en_gcube
GCUBE_SOURCE_THEME_DIR=/tmp/ckanext-d4science_theme_custom
GCUBE_DEST_THEME_DIR=${CKAN_APP_DIR}/src/ckanext-d4science_theme
# install_gcube_lang - Installs and configures G-Cube language localization for CKAN
#
# This function sets up language localization by:
# 1. Creating the destination directory for language files if it doesn't exist
# 2. Compiling the language catalog for the specified locale
# Returns: No explicit return value
#
install_gcube_theme() {
# Install GCube theme for CKAN
echo -e "\n*** Install_gcube_theme called"
if [ ! -d ${GCUBE_DEST_THEME_DIR} ] ; then
echo "Destination theme directory ${GCUBE_DEST_THEME_DIR} does not exist. Exiting."
exit 1 # Destination theme directory does not exist
#GCUBE_INIT_LANG=0
fi
# Copy theme files to destination
if [ -d "${GCUBE_SOURCE_THEME_DIR}" ] ; then
cp -r "${GCUBE_SOURCE_THEME_DIR}"/* "${GCUBE_DEST_THEME_DIR}"
rm -rf "${GCUBE_SOURCE_THEME_DIR}"
echo -e "\n*** Install_gcube_theme finished"
fi
}
echo "Finished D4Science CKAN theme customizations installation."

View File

@ -111,15 +111,15 @@ fi
CKAN_RUN="ckan -c $CKAN_INI run -H 0.0.0.0"
CKAN_OPTIONS=""
# if [ "$USE_DEBUGPY_FOR_DEV" = true ] ; then
# pip3 install debugpy
# CKAN_RUN="/usr/bin/python3 -m debugpy --listen 0.0.0.0:5678 $CKAN_RUN"
# CKAN_OPTIONS="$CKAN_OPTIONS --disable-reloader"
# fi
if [ "$USE_DEBUGPY_FOR_DEV" = true ] ; then
pip install debugpy
CKAN_RUN="/usr/bin/python -m debugpy --listen 0.0.0.0:5678 $CKAN_RUN"
CKAN_OPTIONS="$CKAN_OPTIONS --disable-reloader"
fi
# if [ "$USE_HTTPS_FOR_DEV" = true ] ; then
# CKAN_OPTIONS="$CKAN_OPTIONS -C unsafe.cert -K unsafe.key"
# fi
if [ "$USE_HTTPS_FOR_DEV" = true ] ; then
CKAN_OPTIONS="$CKAN_OPTIONS -C unsafe.cert -K unsafe.key"
fi
# Create Harvester logs directory and change its ownership
mkdir -p $CKAN_LOGS_PATH/harvester

View File

@ -125,6 +125,9 @@ CKAN_SYSADMIN_PASSWORD=test1234
CKAN_SYSADMIN_EMAIL=your_email@example.com
CKAN_STORAGE_PATH=/var/lib/ckan
CKAN_LOGS_PATH=/var/log
ROOT_LOG_LEVEL=WARNING
CKAN_LOG_LEVEL=WARNING
CKANEXT_LOG_LEVEL=WARNING
# SMTP settings
CKAN__SMTP_ENABLED=False
CKAN_SMTP_SERVER=smtp.corporateict.domain:25

View File

@ -252,3 +252,7 @@ CSW_INSPIRE_CONTACT_NAME=${CSW_CONTACT_NAME}
CSW_INSPIRE_CONTACT_EMAIL=${CKAN_SYSADMIN_EMAIL}
# Temporal extent of the service (in ISO 8601 format). Either a single date (i.e. YYYY-MM-DD), or an extent (i.e. YYYY-MM-DD/YYYY-MM-DD)
CSW_INSPIRE_TEMP_EXTENT="2024-01-01"
ROOT_LOG_LEVEL=WARNING
CKAN_LOG_LEVEL=WARNING
CKANEXT_LOG_LEVEL=WARNING