How can I deploy XWiki with Docker not as ROOT application?

Hello everyone,

I am a french developer in a company and I want to deploy a wiki on a virtual machine with Docker.

I also want to do a redirection from an other virtual machine with an Apache reverse proxy.

To do so, I want to deploy xwiki not as ROOT but as something else, anything else, for example : wiki.

So that, when an url is beggining with wiki, I can say that it’s a xwiki route, and the Apache redirection is just working fine.

For now, I just used the Docker image and I have changed the webapppath in xwiki.cfg file. Just like that : xwiki.webapppath=wiki. I restart the container and boom everything is working except, url with /resources or /webjars.

I have no idea how to fix that. Or maybe the solution is to deploy as something else than ROOT, but how ? Do I have to build a custom Dockerfile ?

Thank you so much for your help ! :slight_smile:

Please do not hesitate to ask any question because I may be not perfectly clear :smiley:

Hi @lougou. Seems this corresponds to this jira issue: https://jira.xwiki.org/browse/XDOCKER-74

Related thread:

Hi @vmassol,

It’s exactly what I want to do. Do you have any idea when this feature could be added in the docker command ? Or if there is an other temporary solution to overcome that ? :slight_smile:

Thanks

Hi everyone,

While waiting the feature is added, we have decided to create our own docker image. But I am a beginner with Docker and I can’t have a container working.
I have a github repo with my code : https://github.com/lgourain/docker-xwiki-postgres-tomcat

I first changed “RUN rm -rf /usr/local/tomcat/webapps/wiki/" insted of "RUN rm -rf /usr/local/tomcat/webapps/” because I had "Directory not empty errors when bulding the image.
And I then changed every “ROOT” for “wiki” because I want all my urls prefixed with “wiki”. And I also changed the part where webapppath is assigned to empty string.

What I have so far is :

  1. upload these files on the server
  2. in this directory : $ docker build -t customxwiki_image .
  3. create directory : $ mkdir -p /var/customxwiki
  4. change rights of the script : $ chmod +x docker-entrypoint.sh
  5. build the container : $ docker run --name customxwiki -tid -p 80:8080 -v /var/customxwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=172.16.228.47 customxwiki_image

And here I get an error saying that the script “docker-entrypoint.sh” can’t be found because it is not in $PATH.

Thanks for any help :slight_smile:

Hello,

For anyone who is having the same problem, I am giving some updates.
The issue is that I am trying to build a docker image on CentOS 7.
With this command : $ docker info
We can see that I have a warning :
warning
To solve this, you need to reformat your XFS filesystem with ftype=1.
You can follow these steps to fix that : https://superuser.com/questions/1321926/recreating-an-xfs-file-system-with-ftype-1

I hope it can help someone :slight_smile:

Hi! I also want to deploy XWiki as a normal webapp (not ROOT) to use it with a reverse proxy. Has anyone found a solution to this? Thanks.

Hi, see https://jira.xwiki.org/browse/XDOCKER-74

For now, as a workaround, you’d just need to go into your servlet container docker container and move webapps/ROOT into webapps/xwiki for example and adjust the context.xml (for tomcat). XWiki is using standard webapps deployment from your servlet container.

Now re reverse proxy with ROOT, I think someone reported a solution not long ago on this forum.

Hi jordiori,

Not sure this is the perfect solution but from my github repo you can build a custom image with a webapp called wiki.

Thanks to this line in the Dockerfile :
ENV XWIKI_WEBAPP_BASEPATH “/usr/local/tomcat/webapps/wiki”

Good luck :slight_smile:

@lougou Can you please share your github repo. I am in need of xwiki as non Root app

Hi @GaneshKumar, here is my repo : https://github.com/lgourain/docker-xwiki-postgres-tomcat

Good luck :slight_smile:

1 Like

Thank you :slight_smile: