georchestra / datadir

geOrchestra configuration directory for generic wars & Debian packages (eg: /etc/georchestra)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mapstore - pluginsConfig.json missing

Gaetanbrl opened this issue · comments

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/

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

commented

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.

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.

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 ?

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

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..

ok so the word is :

use writable external dir !

I will do that and come back ;)

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 ?

commented

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

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 ?

commented

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

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 .

Thank you all for the investigation !

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.

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

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.

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