[MapServer-users] Getting msCGILoadMap(): Web application error. Required configuration value MS_MAP_PATTERN not set.

Rob Dennett Rob.Dennett at twdb.texas.gov
Wed Jun 5 14:42:36 PDT 2024


Here's the result of

Cat /tmp/init_env | grep MS_

MS_ERRORFILE=stderr
MS_MAP_PATTERN=/(.*?)mapfiles/(.*?).map
MS_MAPFILE=/my_mapfiles/xxxx.map
MS_DEBUGLEVEL=1

And here's the Dockerfile:

FROM camptocamp/mapserver:8.0

# overwrite apache conf for custom url routes
ADD mapserver.conf /etc/apache2/conf-enabled/mapserver.conf
RUN chown root /etc/apache2/conf-enabled/mapserver.conf
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf

# enable apache modules with symlinks
RUN ln -s /etc/apache2/mods-available/dir.load /etc/apache2/mods-enabled/dir.load
RUN ln -s /etc/apache2/mods-available/dir.conf /etc/apache2/mods-enabled/dir.conf
RUN ln -s /etc/apache2/mods-available/autoindex.load /etc/apache2/mods-enabled/autoindex.load
RUN ln -s /etc/apache2/mods-available/autoindex.conf /etc/apache2/mods-enabled/autoindex.conf
RUN ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
# re-apply disabled alias module conf for icons
RUN ln -s /etc/apache2/mods-available/alias.conf /etc/apache2/mods-enabled/alias.conf

# setup mapserver env variables
ADD mapserv.env /docker-entrypoint.d/mapserv.env

ENV MS_DEBUGLEVEL=1
ENV MS_ERRORFILE=stderr
ENV MS_MAP_PATTERN="/(.*?)mapfiles/(.*?).map"
ENV MS_MAPFILE="/my_mapfiles/xxxx.map"

EXPOSE 80

The only difference between this and the one that works is the base image is 7.6, not 8.0
________________________________
From: Seth G <sethg at geographika.co.uk>
Sent: Wednesday, June 5, 2024 4:35 PM
To: Rob Dennett <Rob.Dennett at twdb.texas.gov>; MapServer Users <mapserver-users at lists.osgeo.org>
Cc: Chris Repka <Chris.Repka at twdb.texas.gov>
Subject: Re: [MapServer-users] Getting msCGILoadMap(): Web application error. Required configuration value MS_MAP_PATTERN not set.


External: Beware of links/attachments.


Try setting MAPSERVER_CONFIG_FILE to point to a mapserver.conf in your own Dockerfile and setting MS_MAP_PATTERN in this config file.

Without seeing your custom Dockerfile it is hard to know what could be removing an environment variable - it is simpler to control things with a config file.

If you check the /tmp/init_env file you should see the variables that are passed to the Apache environment (which is different from the system environment). If you override the default CMD ["/usr/local/bin/start-server"] then these env variables won't be set.

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Wed, Jun 5, 2024, at 9:21 PM, Rob Dennett wrote:
Not sure how uncommenting something in the conf from camptocamp would help when we're actually setting MS_MAP_PATTERN in our Dockerfile which relies on the camptocamp one as a base image.  I created a github issue for this as well and they advised running

Docker run <image> env | grep MS_

And I see MS_MAP_PATTERN defined there along with MS_MAPFILE set to what I am expecting.  Wouldn't this prove that the environment variables are set correctly?

________________________________

From: Seth G <sethg at geographika.co.uk>
Sent: Tuesday, June 4, 2024 4:32 PM
To: Rob Dennett <Rob.Dennett at twdb.texas.gov>; MapServer Users <mapserver-users at lists.osgeo.org>
Cc: Chris Repka <Chris.Repka at twdb.texas.gov>
Subject: Re: [MapServer-users] Getting msCGILoadMap(): Web application error. Required configuration value MS_MAP_PATTERN not set.


External: Beware of links/attachments.


Hi Rob,

You could try uncommenting the MS_MAP_PATTERN in the mapserver.conf [1] file on your Docker image to see if that has an effect.

You should also see a log file named /tmp/init_env that lists all the environment variables used by Apache (including MS_MAP_PATTERN), similar to below:

export "MAPSERVER_CONFIG_FILE=/etc/mapserver/mapfiles/mapserver.conf"
export "MAPSERVER_CATCH_SEGV=1"
export "HOSTNAME=mapserver"
export "APACHE_CONFDIR=/etc/apache2"
export "BUSY_TIMEOUT=300"
export "MS_ERRORFILE=mapserver-8.0.log"
export "PWD=/etc/mapserver"
export "IO_TIMEOUT=40"
export "HOME=/root"
export "APACHE_LOG_DIR=/var/log/apache2"
export "MIN_PROCESSES=1"
export "APACHE_PID_FILE=/tmp/apache2/apache2.pid"
export "MS_MAP_PATTERN=^\/etc\/mapserver\/([^\.][-_A-Za-z0-9\.]+\/{1})*([-_A-Za-z0-9\.]+\.map)$"

Seth

[1] https://github.com/camptocamp/docker-mapserver/blob/cffc18f12146969ed914834b7eba4b798e9c24d9/runtime/etc/mapserver.conf#L15
[2] https://github.com/camptocamp/docker-mapserver/blob/31594debf18f091ad7ca5cf7126723bc014d9781/runtime/usr/local/bin/start-server#L8

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Tue, Jun 4, 2024, at 11:08 PM, Rob Dennett via MapServer-users wrote:
We're using the camptocamp MapServer image and I just tried changing the base image from 7.6 to 8.0, i.e.
FROM camptocamp/mapserver:7.6

To

FROM camptocamp/mapserver:8.0

in our own Dockerfile and when I try to deploy, We're seeing

"msCGILoadMap(): Web application error.  Required configuration value MS_MAP_PATTERN not set."

on some endpoints (the ones ending in .map)

The camptocamp image contains

ENV MS_MAP_PATTERN=^\\/etc\\/mapserver\\/([^\\.][-_A-Za-z0-9\\.]+\\/{1})*([-_A-Za-z0-9\\.]+\\.map)$

(https://github.com/camptocamp/docker-mapserver/blob/8.0.0/Dockerfile#L85)

and our own overwrites this env var anyway, along with MS_MAPFILE

These haven't changed and they work fine as long as the base image is 7.6. The changelog mentions MS_MAPFILE, but as mentioned, we do define it.

(https://github.com/camptocamp/docker-mapserver/blob/8.0.0/README.md#changelog)

Any idea what might be happening?
[https://opengraph.githubassets.com/89914d21a14748d29e5eb2cb7cf59e720bd216e41863d0bff2ca0e490950eddd/camptocamp/docker-mapserver]<https://github.com/camptocamp/docker-mapserver/blob/8.0.0/Dockerfile#L85>
docker-mapserver/Dockerfile at 8.0.0 · camptocamp/docker-mapserver<https://github.com/camptocamp/docker-mapserver/blob/8.0.0/Dockerfile#L85>
https://hub.docker.com/r/camptocamp/mapserver/. Contribute to camptocamp/docker-mapserver development by creating an account on GitHub.
github.com

[https://opengraph.githubassets.com/89914d21a14748d29e5eb2cb7cf59e720bd216e41863d0bff2ca0e490950eddd/camptocamp/docker-mapserver]<https://github.com/camptocamp/docker-mapserver/blob/8.0.0/Dockerfile#L85>
docker-mapserver/Dockerfile at 8.0.0 · camptocamp/docker-mapserver<https://github.com/camptocamp/docker-mapserver/blob/8.0.0/Dockerfile#L85>
https://hub.docker.com/r/camptocamp/mapserver/. Contribute to camptocamp/docker-mapserver development by creating an account on GitHub.
github.com



_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20240605/82165ce1/attachment.htm>


More information about the MapServer-users mailing list