Skip to content

Commit

Permalink
Improve the ckan-pycsw service
Browse files Browse the repository at this point in the history
- Add ckan-pycsw envvars.
- Add SSL_UNVERIFIED_MODE for use in development with NGINX self-hosted SSL certificate.
  • Loading branch information
mjanez committed Sep 24, 2024
1 parent ef26520 commit bc37291
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ index.html.*
!.env.example
!.env.codespaces
!.env.es.example
!.env.localhost
!.env.dev.example
samples/api/*

# docker compose files
Expand Down
22 changes: 1 addition & 21 deletions ckan-pycsw/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,7 @@ ENV DEV_MODE=False
ENV TIMEOUT=300
ENV PYCSW_CRON_DAYS_INTERVAL=2
ENV PYCSW_CRON_HOUR_START=4

# 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"
ENV SSL_UNVERIFIED_MODE=False

WORKDIR ${APP_DIR}

Expand Down
24 changes: 22 additions & 2 deletions ckan-pycsw/docker-entrypoint.d/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@ set -xeuo pipefail

envsubst < pycsw.conf.template > pycsw.conf

#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
# TODO: -Xfrozen_modules=off from: https://bugs.python.org/issue1666807

# 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 "$@"

0 comments on commit bc37291

Please sign in to comment.