From a8d3811afe55651944155487774ede439a06b3bd Mon Sep 17 00:00:00 2001 From: Kevin Ngai Date: Mon, 25 Nov 2024 16:47:15 -0800 Subject: [PATCH] Docker changes for dev-31 and MapServer 8: (#98) - Testing with wmo-staging PPA - Check to ensure required ENVs are set - Add SSL ceritficate volume mounts for dev-31 --- Dockerfile | 6 +++++- docker/docker-compose.override.yml | 1 - docker/docker-compose.yml | 1 - docker/entrypoint.sh | 25 +++++++++++++++++++++++++ geomet-climate.env | 1 + tests/geomet-climate-test.env | 1 + 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7791e06..9f1a572 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,12 +15,16 @@ ENV BASEDIR=/data/web/geomet-climate-nightly \ GEOMET_CLIMATE_ES_URL=https://${GEOMET_CLIMATE_ES_USERNAME}:${GEOMET_CLIMATE_ES_PASSWORD}@localhost:9200 \ GEOMET_CLIMATE_OWS_DEBUG=5 # GEOMET_CLIMATE_OWS_LOG=/tmp/geomet-climate-ows.log +ENV DEBIAN_FRONTEND=noninteractive +ENV MAPSERVER_CONFIG_FILE=${GEOMET_CLIMATE_BASEDIR}/mapserver.conf WORKDIR $BASEDIR # Install system dependencies RUN apt update && apt install -y software-properties-common && \ - ## Add this WMO PPA + ## Add this UbuntuGIS PPA (mappyfile) + add-apt-repository ppa:ubuntugis/ppa && apt update && \ + ## Add this WMO PPA (mapserver) add-apt-repository ppa:gcpp-kalxas/wmo-staging && apt update && \ ## Install dependencies from debian/control apt install -y mapserver-bin python3-all python3-pip python3-click python3-gdal python3-mappyfile python3-mapscript python3-matplotlib python3-numpy python3-pyproj python3-yaml proj-bin proj-data python3-certifi && \ diff --git a/docker/docker-compose.override.yml b/docker/docker-compose.override.yml index 96b90f2..de39119 100644 --- a/docker/docker-compose.override.yml +++ b/docker/docker-compose.override.yml @@ -3,7 +3,6 @@ services: build: args: GEOMET_CLIMATE_URL: https://geomet-dev-31-nightly.edc-mtl.ec.gc.ca/geomet-climate - # GEOMET_CLIMATE_URL: http://geomet-dev-31.edc-mtl.ec.gc.ca:8099 environment: GEOMET_CLIMATE_OWS_DEBUG: 5 GEOMET_CLIMATE_ES_URL: http://${GEOMET_CLIMATE_ES_USERNAME}:${GEOMET_CLIMATE_ES_PASSWORD}@localhost:9200 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d419781..ca9c150 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,7 +15,6 @@ services: # for SSL-enabled connections to internal hosts (geomet-dev-xx.edc-mtl.ec.gc.ca) - "/etc/ssl/certs:/etc/ssl/certs:ro" # mount host ssl certs - "/usr/local/share/ca-certificates/:/usr/local/share/ca-certificates/:ro" # mount host ca-certificates - networks: default: name: geomet_default diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index ec3e51c..7ceb673 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -3,6 +3,8 @@ BASEDIR=/data/web/geomet-climate-nightly GEOMET_CLIMATE_BASEDIR=$BASEDIR/build GEOMET_CLIMATE_ES_URL=${GEOMET_CLIMATE_ES_URL} +MAPSERVER_CONFIG_FILE=${MAPSERVER_CONFIG_FILE} +MS_MAP_PATTERN=$GEOMET_CLIMATE_BASEDIR/mapfile/.* # replace localhost ES URL with docker-host URL to ES if [ $GEOMET_CLIMATE_ES_URL != "" ] @@ -13,6 +15,26 @@ fi cd $BASEDIR +# Ensure the directory for MAPSERVER_CONFIG_FILE exists +mkdir -p "$(dirname "$MAPSERVER_CONFIG_FILE")" + +# Ensure MAPSERVER_CONFIG_FILE exists; create it if it doesn't +if [ ! -f "$MAPSERVER_CONFIG_FILE" ]; then + cat > "$MAPSERVER_CONFIG_FILE" < $GEOMET_CLIMATE_BASEDIR/geomet-climate-WCS-2.0.1-capabilities-fr.xml && mv -f $GEOMET_CLIMATE_BASEDIR/geomet-climate-WCS-2.0.1-capabilities-fr.xml $GEOMET_CLIMATE_BASEDIR/mapfile + + + echo "Done." # server runs diff --git a/geomet-climate.env b/geomet-climate.env index 1dffbaa..8060e47 100644 --- a/geomet-climate.env +++ b/geomet-climate.env @@ -8,3 +8,4 @@ export GEOMET_CLIMATE_URL=https://geo.weather.gc.ca/geomet-climate #export GEOMET_CLIMATE_ES_USERNAME=foo #export GEOMET_CLIMATE_ES_PASSWORD=bar export GEOMET_CLIMATE_ES_URL=http://${GEOMET_CLIMATE_ES_USERNAME}:${GEOMET_CLIMATE_ES_PASSWORD}@localhost:9200 +export MAPSERVER_CONFIG_FILE=${GEOMET_CLIMATE_BASEDIR}/mapserver.conf diff --git a/tests/geomet-climate-test.env b/tests/geomet-climate-test.env index bbdbb41..8567854 100644 --- a/tests/geomet-climate-test.env +++ b/tests/geomet-climate-test.env @@ -2,3 +2,4 @@ export GEOMET_CLIMATE_BASEDIR=. export GEOMET_CLIMATE_DATADIR=tests/data/climate export GEOMET_CLIMATE_CONFIG=./tests/geomet-climate-test.yml export GEOMET_CLIMATE_URL=http://localhost:8099 +export MAPSERVER_CONFIG_FILE=${GEOMET_CLIMATE_BASEDIR}/mapserver.conf