malaskowski / aet-docker

Docker support for AET - easy to set up local/developer environment with example Docker Swarm configuration.
Apache License 2.0
8 stars 9 forks source link

Permission denied messages for configs provided via configs volume #25

Closed jwadolowski closed 4 years ago

jwadolowski commented 4 years ago

Steps to reproduce

Current state

00:03:52.399 INFO  [activator-1-thread-2] Binding bundle: [org.apache.karaf.webconsole.http [63]] to http service
00:03:53.416 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.queues.DefaultJmsConnection.cfg
00:03:53.418 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.cleaner.CleanerScheduler-main.cfg
00:03:53.420 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.proxy.RestProxyManager.cfg
00:03:53.425 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.vs.mongodb.MongoDBClient.cfg
00:03:53.426 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.queues.DefaultJmsConnection.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.427 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.runner.MessagesManager.cfg
00:03:53.446 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.runner.RunnerConfiguration.cfg
00:03:53.448 INFO  [fileinstall-/aet/custom/bundles] Installing bundle aet-lighthouse-extension / 0.1.0
00:03:53.448 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.rest.helpers.ReportConfigurationManager.cfg
00:03:53.450 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.worker.listeners.WorkersListenersService.cfg
00:03:53.445 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.cleaner.CleanerScheduler-main.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.472 INFO  [fileinstall-/aet/custom/configs] Creating configuration from com.cognifide.aet.worker.drivers.chrome.ChromeWebDriverFactory.cfg
00:03:53.480 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.proxy.RestProxyManager.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.481 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.vs.mongodb.MongoDBClient.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.482 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.runner.MessagesManager.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.494 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.runner.RunnerConfiguration.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.495 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.rest.helpers.ReportConfigurationManager.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.496 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.worker.listeners.WorkersListenersService.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.505 INFO  [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.cognifide.aet.queues.DefaultJmsConnection)] Unable to save configuration
java.io.FileNotFoundException: /aet/custom/configs/com.cognifide.aet.worker.drivers.chrome.ChromeWebDriverFactory.cfg (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.doConfigurationEvent(ConfigInstaller.java:186)
    at org.apache.felix.fileinstall.internal.ConfigInstaller.configurationEvent(ConfigInstaller.java:129)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058)
    at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
    at java.lang.Thread.run(Thread.java:748)
00:03:53.514 INFO  [fileinstall-/aet/core/bundles] Installing bundle com.cognifide.aet.test-executor / 3.3.0
00:03:53.527 INFO  [fileinstall-/aet/core/bundles] Installing bundle com.cognifide.aet.validation / 3.3.0
00:03:53.529 INFO  [fileinstall-/aet/core/bundles] Installing bundle com.cognifide.aet.cleaner / 3.3.0
00:03:53.533 INFO  [fileinstall-/aet/core/bundles] Installing bundle com.cognifide.aet.datastorage-api / 3.3.0
00:03:53.559 INFO  [fileinstall-/aet/core/bundles] Installing bundle com.cognifide.aet.jobs / 3.3.0

Expected state

Noteworthy facts

That's most likely related to the fact configs directory at host machine is owned by a different user than the one defined within the container to run Apache Karaf (karaf:karaf with UID 8181 specified in Karaf's Dockerfile).

Host machine:

$ ls -ld configs/
drwxr-xr-x. 2 whatever whatever 4096 Jul 30 10:29 configs/

Container perspective:

$ docker exec -it 7645aa44d54e /bin/bash
bash-4.4$ id
uid=8181(karaf) gid=65533(nogroup) groups=65533(nogroup)
malaskowski commented 4 years ago

Hi @jwadolowski

I am not able to reproduce the behaviour you described but it looks that the directory you try to mount from your host and the container's Karaf user do not match.

Have you tried to modify configs directory ownership on the host machine? skejven/aet_karaf image uses non-root Karaf 8181 user. There a lot of ways to handle proper files ownership for non-root users in Docker (please refer e.g. to this list of articles). Unfortunately there is not much I can do on the image side.

Let me know if you have any further questions.