[PATCH] Add MapServer to Docker setup
Wald Commits
scm-commit at wald.intevation.org
Fri Jul 22 17:56:42 CEST 2022
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1658505371 -7200
# Fri Jul 22 17:56:11 2022 +0200
# Branch 3.2.x
# Node ID 95496d21b4da7592e8a8e949f3aeba3778082ab0
# Parent 93b9034613bca49c5c5ea92684c5acb25bb47ffd
Add MapServer to Docker setup
diff -r 93b9034613bc -r 95496d21b4da docker/Dockerfile.db
--- a/docker/Dockerfile.db Fri Jul 22 13:07:07 2022 +0200
+++ b/docker/Dockerfile.db Fri Jul 22 17:56:11 2022 +0200
@@ -1,5 +1,4 @@
-# Docker file for postgresql 9.4 on debain
-
+# Dockerfile providing a PostgreSQL database with example data for D4E River
FROM debian:bullseye
LABEL maintainer tom.gottfried at intevation.de
@@ -61,9 +60,12 @@
RUN curl -sf "https://wald.intevation.org/frs/download.php/2282/$DATA_ARCH" | \
tar -C $HOME --wildcards -xz 'demodaten/*.dump.sql'
+# Initialize database
+# Note that PostGIS legacy.sql is needed to support the outdated MapServer 6
RUN $PGBIN/pg_ctl start -wo "--config_file=$PGCONF" && \
/opt/d4eriver_db/postgresql-setup.sh && \
psql -f ~/demodaten/d4e_demodata.dump.sql d4e && \
+ psql -d d4e -f /usr/share/postgresql/$PG_VERSION/contrib/postgis-3.1/legacy.sql && \
createuser -S -D -R seddb && \
psql -c "ALTER USER seddb WITH PASSWORD 'seddb'" && \
createdb seddb && \
diff -r 93b9034613bc -r 95496d21b4da docker/Dockerfile.mapserv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/Dockerfile.mapserv Fri Jul 22 17:56:11 2022 +0200
@@ -0,0 +1,52 @@
+# Docker file for D4E River MapServer
+# with support for PostgreSQL and Oracle databases
+
+FROM centos:7
+MAINTAINER tom at intevation.de
+
+# Necessary to run further yum-installs inside Docker container,
+# if not already part of the base image:
+RUN yum -q -y install yum-plugin-ovl && rpm --rebuilddb
+
+# Install prerequisites
+RUN yum -q -y install curl ca-certificates epel-release \
+ gnu-free-sans-fonts httpd
+RUN yum -q -y install gcc-c++ postgresql-devel gd-devel giflib-devel proj-devel \
+ proj-epsg prelink make
+
+# Install Oracle client
+RUN curl -s https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 \
+ -o /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
+ADD ol7-temp.repo /etc/yum.repos.d/
+RUN yum -q -y install oraclelinux-release-el7
+RUN mv /etc/yum.repos.d/ol7-temp.repo /etc/yum.repos.d/ol7-temp.repo.disabled
+RUN yum -q -y install oracle-release-el7
+RUN yum -q -y install oracle-instantclient19.9-basic \
+ oracle-instantclient19.9-devel
+RUN yum-config-manager --disable oracle*,ol7*
+
+# Install MapServer
+WORKDIR /opt/mapserver
+RUN curl -s https://download.osgeo.org/mapserver/mapserver-6.0.6.tar.gz | tar xz
+WORKDIR mapserver-6.0.6
+RUN sed -i "s at oracle/10\*/client at oracle/19.9/client64 at g" configure
+RUN ./configure -q --with-proj --with-postgis --with-oraclespatial=/usr \
+ CFLAGS=-w CXXFLAGS=-w
+RUN make -s
+WORKDIR /opt/mapserver
+RUN ln -s mapserver-6.0.6/mapserv
+
+# Volume to share mapfiles with artifact server.
+# Has to be the same path as in artifact server container because mapfiles
+# contain absolute paths.
+VOLUME /opt/d4e/bin
+
+# CGI scripts
+ADD river-wms /var/www/cgi-bin/
+ADD user-wms /var/www/cgi-bin/
+
+# httpd config
+ADD httpd-mapserver.conf /etc/httpd/conf.d/
+
+EXPOSE 80
+CMD ["/usr/sbin/httpd", "-DFOREGROUND"]
diff -r 93b9034613bc -r 95496d21b4da docker/README
--- a/docker/README Fri Jul 22 13:07:07 2022 +0200
+++ b/docker/README Fri Jul 22 17:56:11 2022 +0200
@@ -4,6 +4,8 @@
_ Change 'localhost' to '0.0.0.0' in artifacts/doc/conf/rest-server.xml
_ Change 'localhost' to 'd4eriver-artifacts' in the server-url parameter in
gwt-client/src/main/webapp/WEB-INF/web.xml
+_ Change 'localhost' to the hostname of your docker host in
+ artifacts/doc/conf/floodmap.xml and artifacts/doc/conf/rivermap.xml
Build and run:
diff -r 93b9034613bc -r 95496d21b4da docker/docker-compose.yml
--- a/docker/docker-compose.yml Fri Jul 22 13:07:07 2022 +0200
+++ b/docker/docker-compose.yml Fri Jul 22 17:56:11 2022 +0200
@@ -18,6 +18,24 @@
- d4e_river
depends_on:
- db
+ volumes:
+ - ../artifacts/doc/conf:/opt/d4e/bin/conf
+ - mapfiles:/opt/d4e/bin
+ mapserv:
+ container_name: "d4eriver-mapserv"
+ build:
+ context: ./
+ dockerfile: ./Dockerfile.mapserv
+ image: "d4e/river_mapserv"
+ networks:
+ - d4e_river
+ depends_on:
+ - db
+ - server
+ volumes:
+ - mapfiles:/opt/d4e/bin
+ ports:
+ - 8081:80
client:
container_name: "d4eriver-client"
build:
@@ -28,6 +46,7 @@
- d4e_river
depends_on:
- server
+ - mapserv
volumes:
- ../:/opt/d4e/river
ports:
@@ -35,3 +54,5 @@
networks:
d4e_river:
name: d4e_river
+volumes:
+ mapfiles:
diff -r 93b9034613bc -r 95496d21b4da docker/httpd-mapserver.conf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/httpd-mapserver.conf Fri Jul 22 17:56:11 2022 +0200
@@ -0,0 +1,4 @@
+<VirtualHost *:80>
+ ErrorLog /dev/stderr
+ CustomLog /dev/stdout combined
+</VirtualHost>
diff -r 93b9034613bc -r 95496d21b4da docker/ol7-temp.repo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/ol7-temp.repo Fri Jul 22 17:56:11 2022 +0200
@@ -0,0 +1,6 @@
+[ol7_latest]
+name=Oracle Linux 7 Latest (x86_64)
+baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
+gpgcheck=1
+enabled=1
diff -r 93b9034613bc -r 95496d21b4da docker/river-wms
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/river-wms Fri Jul 22 17:56:11 2022 +0200
@@ -0,0 +1,5 @@
+#!/bin/sh
+export LC_ALL="de_DE.UTF-8"
+export NLS_LANG=".AL32UTF8"
+export MS_MAPFILE=/opt/d4e/bin/rivers.map
+/opt/mapserver/mapserv
diff -r 93b9034613bc -r 95496d21b4da docker/user-wms
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/user-wms Fri Jul 22 17:56:11 2022 +0200
@@ -0,0 +1,5 @@
+#!/bin/sh
+export LC_ALL="de_DE.UTF-8"
+export NLS_LANG=".AL32UTF8"
+export MS_MAPFILE=/opt/d4e/bin/flys.map
+/opt/mapserver/mapserv
More information about the Dive4Elements-commits
mailing list