Docker swarm - how to provide custom configuration?

According to the xwiki-docker/README the three main configuration files

    • xwiki.cfg: $WEB-INF/xwiki.cfg
    • xwiki.properties: $WEB-INF/xwiki.properties
    • hibernate.cfg.xml: $WEB-INF/hibernate.cfg.xml

are copied over from the permanent directory /usr/local/xwiki to the $WEB-INF folder when the container is starting (due to backward compatibility reasons, also discussed here Improve XWiki docker image configuration strategy.

However, this seems not to be the case (anymore?), at least not for v17.

Here you can see that xwiki.cfg has different size on the permanent directory compared to the runtime directory:

root@a51afa88f2b9:/usr/local/tomcat# ls -al webapps/ROOT/WEB-INF/xwiki*
-rw-r--r-- 1 root root 25650 Feb 11 15:12 webapps/ROOT/WEB-INF/xwiki.cfg
-rw-r--r-- 1 root root   119 Jan 28 08:58 webapps/ROOT/WEB-INF/xwiki-locales.txt
-rw-r--r-- 1 root root 80468 Feb 11 15:12 webapps/ROOT/WEB-INF/xwiki.properties
root@a51afa88f2b9:/usr/local/tomcat# ls -al /usr/local/xwiki/xwiki*
-rw-r--r-- 1 root root 25656 Feb 11 15:12 /usr/local/xwiki/xwiki.cfg
-rw-r--r-- 1 root root 80468 Feb 11 14:37 /usr/local/xwiki/xwiki.properties
root@a51afa88f2b9:/usr/local/tomcat#

The problem is that I am using Docker Swarm and cannot map directly a file from an NFS-mount into the container service (in the docs, it’s proposed to do something like -v /local/path/to/xwiki.cfg:/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.cfg but this does not work in Swarm mode).

I tried using docker configs but Docker cannot map the config files during container start because the volume is mounted read-only.

I am wondering how to provide custom configuration to the XWiki instance when running on Docker Swarm. Any ideas?

It should still be the case, see xwiki-docker/template/xwiki/docker-entrypoint.sh at cdae3071f5aca70660cfab91fba1385b07b183c7 · xwiki/xwiki-docker · GitHub and below.

Your issue seems more related to NFS than docker swarm, no? (since you cannot map a volume).

I don’t understand why you couldn’t do a docker cp to copy the files (as it’s done at xwiki-docker/template/xwiki/docker-entrypoint.sh at cdae3071f5aca70660cfab91fba1385b07b183c7 · xwiki/xwiki-docker · GitHub

Now, it would be interesting to understand why xwiki-docker/template/xwiki/docker-entrypoint.sh at cdae3071f5aca70660cfab91fba1385b07b183c7 · xwiki/xwiki-docker · GitHub is not working for you? What’s your console logs?

thx

Thanks for the reply, I figure out the problem was that the files need to be in the data/ subfolder of the “permanent folder”. That’s a bit confusing in the readme I guess.
It works now!

This was the line which got me to that: xwiki-docker/template/xwiki/docker-entrypoint.sh at cdae3071f5aca70660cfab91fba1385b07b183c7 · xwiki/xwiki-docker · GitHub

:wink:

ok cool, note that this location has not changed and was like this since day 1 back in 2017: XDOCKER-20: Allow configuring XWiki outside of the container · xwiki/xwiki-docker@fbc0fe3 · GitHub

Glad that you solved it!

Yes I understand. I still think the documentation is a bit misleading since if you look at xwiki-docker/README.md at master · xwiki/xwiki-docker · GitHub it seems that the three configuration files are expected to be placed in /usr/local/xwiki and not in the (only) subfolder /usr/local/xwiki/data. I’ll try to find a few minutes and make a PR to improve the docs :smiley:

When it did not work, I just assumed that this behaviour might have been abandoned and then reached the dead end with the Swarm docker config thing, which in fact does not work on read-only volumes. That’s a quite annoying issue in some image layouts.

Never mind, thanks for the feedback as well!

great, thx