Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Required configuration value MS_MAP_PATTERN not set when we changed our base image from 7.6 to 8.0 #805

Open
TWDBrob opened this issue Jun 4, 2024 · 6 comments

Comments

@TWDBrob
Copy link

TWDBrob commented Jun 4, 2024

We modified the base image in our Dockerfile from 7.6 to 8.0

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

Our Dockerfile sets both MS_MAP_PATTERN and MS_MAPFILE, btw.

What causes this?

@sbrunner
Copy link
Member

sbrunner commented Jun 5, 2024

It's more a MapServer issue than a Docker packaging issue, but ar you sure that the MS_MAP_PATTERN is set?
What about:

docker run <your_image> env | grep MS_

@TWDBrob
Copy link
Author

TWDBrob commented Jun 5, 2024

Here's the result of that:

[email protected]@RDENN-LNX-19235:~$ docker run 2616358f20b4 env | grep MS_
2024-06-05T13:05:18Z a2de404c0ca8 /bin/confd[11]: INFO Backend set to env
2024-06-05T13:05:18Z a2de404c0ca8 /bin/confd[11]: INFO Starting confd
2024-06-05T13:05:18Z a2de404c0ca8 /bin/confd[11]: INFO Backend source(s) set to
2024-06-05T13:05:18Z a2de404c0ca8 /bin/confd[11]: WARNING Found no templates
MS_ERRORFILE=stderr
MS_MAP_PATTERN=/(.?)mapfiles/(.?).map
MS_MAPFILE=/xxxxx_mapfiles/xxxxx.map
MS_DEBUGLEVEL=1

The WARNING is due to the fact that I executed that command on my local machine. In reality, the image is run using AWS ECS and the templates are found in S3.

@sbrunner
Copy link
Member

sbrunner commented Jun 5, 2024

The error message didn't say that, but your MS_MAP_PATTERN looks wrong, shouldn't it be /.*mapfiles/.*\.map?

@TWDBrob
Copy link
Author

TWDBrob commented Jun 5, 2024

Well, it's supposed to match both

/my_mapfiles/xxx.map and /mapfiles/xxx.map

That said, I am not quite sure why it currently works with

/(.?)mapfiles/(.?).map

instead of

/(.?)+mapfiles/(.?)+.map

also, I am running this locally with bind mounts to some local directories and all I did was change the base image from 7.6 to 8.0 and it's working fine. We're looking into that and will close this if appropriate.

@TWDBrob
Copy link
Author

TWDBrob commented Jun 5, 2024

My template links were pointed back at production instead of my local environment which is why it was working. I fixed it to use localhost and now I am getting the expected error

@TWDBrob
Copy link
Author

TWDBrob commented Jun 5, 2024

My C is kind of rusty, but the MapServer code appears to throw the error I see when ms_map_pattern is null. It's retrieved in mapservutil.c at this line:

const char *ms_map_pattern = CPLGetConfigOption("MS_MAP_PATTERN", NULL);

From https://gdal.org/api/cpl.html#_CPPv418CPLGetConfigOptionPKcPKc, we see that function searches for a key/value pair set with CPLSetConfigOption() or in the list of environment variables.

when I exec into my local docker container and run

env | grep MS_

I get

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants