Improve the ckan-pycsw service

- Add ckan-pycsw envvars.
- Add SSL_UNVERIFIED_MODE for use in development with NGINX self-hosted SSL certificate.
This commit is contained in:
mjanez 2024-09-24 15:13:59 +02:00
parent ef26520e2b
commit bc3729167b
No known key found for this signature in database
GPG Key ID: 7A62FDE17C5A4929
3 changed files with 24 additions and 24 deletions

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ index.html.*
!.env.example !.env.example
!.env.codespaces !.env.codespaces
!.env.es.example !.env.es.example
!.env.localhost !.env.dev.example
samples/api/* samples/api/*
# docker compose files # docker compose files

View File

@ -14,27 +14,7 @@ ENV DEV_MODE=False
ENV TIMEOUT=300 ENV TIMEOUT=300
ENV PYCSW_CRON_DAYS_INTERVAL=2 ENV PYCSW_CRON_DAYS_INTERVAL=2
ENV PYCSW_CRON_HOUR_START=4 ENV PYCSW_CRON_HOUR_START=4
ENV SSL_UNVERIFIED_MODE=False
# PYCSW Catalog configuration
ENV CSW_IDENTIFICATION_TITLE="Sample Geospatial Catalogue" \
CSW_IDENTIFICATION_ABSTRACT="OGC CSW server powered by pycsw" \
CSW_PROVIDER_NAME="ckan-docker development team" \
CSW_PROVIDER_URL="https://github.com/mjanez/ckan-docker" \
CSW_CONTACT_NAME="ckan-docker development team" \
CSW_CONTACT_POSITION="Site Administrator" \
CSW_CONTACT_ADDRESS="ckan-docker development team" \
CSW_CONTACT_CITY="Madrid" \
CSW_CONTACT_STATE_OR_PROVINCE="Madrid" \
CSW_CONTACT_POSTAL_CODE="28001" \
CSW_CONTACT_COUNTRY="Spain" \
CSW_CONTACT_EMAIL=${CKAN_SYSADMIN_EMAIL} \
CSW_CONTACT_URL=${CKAN_URL} \
CSW_INSPIRE_DATE="2024-01-01" \
CSW_INSPIRE_GEMET_KEYWORDS="Utility and governmental services" \
CSW_INSPIRE_CONFORMITY="notEvaluated" \
CSW_INSPIRE_CONTACT_NAME=${CSW_CONTACT_NAME} \
CSW_INSPIRE_CONTACT_EMAIL=${CKAN_SYSADMIN_EMAIL} \
CSW_INSPIRE_TEMP_EXTENT="2024-01-01/2024-12-31"
WORKDIR ${APP_DIR} WORKDIR ${APP_DIR}

View File

@ -5,6 +5,26 @@ set -xeuo pipefail
envsubst < pycsw.conf.template > pycsw.conf envsubst < pycsw.conf.template > pycsw.conf
# TODO: -Xfrozen_modules=off from: https://bugs.python.org/issue1666807 # TODO: -Xfrozen_modules=off from: https://bugs.python.org/issue1666807
/wait-for --timeout "$TIMEOUT" "$CKAN_URL" -- pdm run python3 -Xfrozen_modules=off ckan2pycsw/ckan2pycsw.py
# Check if SSL_UNVERIFIED_MODE is enabled
if [ "${SSL_UNVERIFIED_MODE:-false}" = "true" ] || [ "${SSL_UNVERIFIED_MODE:-false}" = "True" ]; then
export REQUESTS_CA_BUNDLE=""
export CURL_CA_BUNDLE=""
SSL_FLAGS="--insecure" # Add SSL ignore flag
echo "[INSECURE] SSL_UNVERIFIED_MODE is enabled. SSL certificate verification is disabled."
else
SSL_FLAGS=""
fi
# Use curl directly instead of wait-for if necessary
echo 'Waiting for $CKAN_URL to become available...'
until curl $SSL_FLAGS --output /dev/null --silent --head --fail "$CKAN_URL"; do
printf '.'
sleep 30
done
echo 'CKAN is available.'
# Ejecutar el comando Python
pdm run python3 -Xfrozen_modules=off ckan2pycsw/ckan2pycsw.py
exec "$@" exec "$@"