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

mapstore - pluginsConfig.json missing #261

Closed
Gaetanbrl opened this issue Jan 23, 2023 · 17 comments
Closed

mapstore - pluginsConfig.json missing #261

Gaetanbrl opened this issue Jan 23, 2023 · 17 comments
Assignees

Comments

@Gaetanbrl
Copy link
Contributor

I get an error 500 :

mapstore/rest/config/uploadPlugin 500

java.io.FileNotFoundException: /etc/georchestra/mapstore/configs/pluginsConfig.json.patch (Permission denied)

Indeed, i have no file /etc/georchestra/mapstore/configs/pluginsConfig.json.patch.

Indeed, this doc show configs/pluginsConfig.json path but seems missing in the datadir :

https://docs.mapstore.geosolutionsgroup.com/en/latest/developer-guide/context-editor-config/

@fvanderbiest
Copy link
Member

Thanks for the report !
@tkohr what would you suggest ? Thanks !

@tkohr
Copy link
Collaborator

tkohr commented Jan 24, 2023

Hum, good point. I think we need to differentiate between the pluginsConfig.json (which defines the list of plugins proposed in the graphical context manager, when creating/modifying a map context) and the pluginsConfig.json.patch (which allows to "extend" this list via json patch syntax for example to propose custom extensions in the context manager).

Indeed, we do not have a pluginsConfig.json in the datadir, but the context manager proposes a list of plugins. In my understanding, this is due to the pluginsConfig.json coming from the webapp. Using this file from the webapp, facilitates maintenance of the datadir in my opinion.

What I'm very surprised about is, that the pluginsConfig.json.patch seems mandatory, as it's supposed to (optionally patch the pluginsConfig.json). Any idea why the error is "permission denied"? This might need some further investigation.

@landryb
Copy link
Member

landryb commented Jan 24, 2023

permission denied probably because the webapp runs as tomcat, while the datadir is owned by root ?

cf also #238 (comment) and #240 for previous discussions.

@Gaetanbrl
Copy link
Contributor Author

permission denied probably because the webapp runs as tomcat, while the datadir is owned by root ?

Ya this is "permission denied" point, but my question si more about do you thing this file is missing or this is MS2 stuff and have to manage it alone ?

@Gaetanbrl
Copy link
Contributor Author

What I'm very surprised about is, that the pluginsConfig.json.patch seems mandatory, as it's supposed to (optionally patch the pluginsConfig.json)

This is the point @tkohr

@landryb
Copy link
Member

landryb commented Jan 24, 2023

to me, if you want tomcat to be able to write files, you have to use the specific mapstore-datadir which is writable by tomcat user and overrides whats in etc/georchestra- and dont let it mess with the files in the georchestra datadir, which are defaults..

@Gaetanbrl
Copy link
Contributor Author

Gaetanbrl commented Jan 24, 2023

ok so the word is :

use writable external dir !

I will do that and come back ;)

@Gaetanbrl
Copy link
Contributor Author

ok classy mistake : change root by tomcat and this works...

But we have 2 folder concerned :

  • configs/extensions directory have 1 extensions folder by extension impored + extensions.json update -> classic behavior
  • configs/pluginsConfig.json.patch -> Why not in configs/extensions ? -> MS2 config behavior.... ok

@tkohr @fvanderbiest keep i open this issue ?

@tkohr
Copy link
Collaborator

tkohr commented Jan 24, 2023

Sorry, I think I lost you on your last comment @Gaetanbrl

@Gaetanbrl
Copy link
Contributor Author

What I'm very surprised about is, that the pluginsConfig.json.patch seems mandatory, as it's supposed to (optionally patch the pluginsConfig.json). Any idea why the error is "permission denied"? This might need some further investigation.

Do you think this issue should be kept open? Or i could close ?

@tkohr
Copy link
Collaborator

tkohr commented Jan 24, 2023

So apart from the rights, the problem is that mapstore looks for a pluginsConfig.json.patch which is not present in the datadir ?

@Gaetanbrl
Copy link
Contributor Author

As i said, after change permissions in datadir, MS2 is able to write tthe famous .patch file.
Next, my surprise was to found pluginsConfig.json.patch in configs/ directory, not in /extensions.

So, all works fine after set correct config and permissions. So i understand that .patch file is correctly created by MS2 system and he is not mandatory to by default in the georchestra /datadir .

@fvanderbiest
Copy link
Member

Thank you all for the investigation !

@landryb
Copy link
Member

landryb commented Jan 24, 2023

i think you're not supposed to change ownership for tomcat in /etc/georchestra, but rather use a dedicated distinct datadir for mapstore where tomcat can write ... oh well.

@fvanderbiest
Copy link
Member

You mean this issue should not have been closed ? What would you propose ?

@Gaetanbrl
Copy link
Contributor Author

Gaetanbrl commented Jan 25, 2023

Thank you all for the investigation !

Just have to get back with ms2... i just forget many infos about config ^^

You mean this issue should not have been closed ? What would you propose ?

Just to be more specific about my fix (if others people read this issue in the futur) :

Changing datadir permissions to allow MS2 to write in default datadir could be a solution, but it's not the "correct" fix. We do that here in sandbox env, not in production env.

Follow @landryb suggestion seems more better (and secure). So, we have an external config in other instances to force MS2 to write .patch files in other directoy (not in default georchestra/datadir) .

Doc ref :

With this external config, .patch files will not be in default georchestra/datadir but well in external config directory.

@fvanderbiest
Copy link
Member

OK, I think this is correctly handled in the docker composition with -Dgeorchestra.extensions=/mnt/mapstore_extensions:
https://github.com/georchestra/docker/blob/3a8aad71e9e9b15a261193733ca31f896c328361/docker-compose.yml#L154

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

4 participants