XWiki is a free wiki software platform written in Java with a design emphasis on extensibility. XWiki is an enterprise wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management.
As an application wiki, XWiki allows for the storing of structured data and the execution of server side script within the wiki interface. Scripting languages including Velocity, Groovy, Python, Ruby and PHP can be written directly into wiki pages using wiki macros. User-created data structures can be defined in wiki documents and instances of those structures can be attached to wiki documents, stored in a database, and queried using either Hibernate query language or XWiki's own query language.
XWiki.org's extension wiki is home to XWiki extensions ranging from code snippets which can be pasted into wiki pages to loadable core modules. Many of XWiki Enterprise's features are provided by extensions which are bundled with it.
%%LOGO%%
The goal is to provide a production-ready XWiki system running in Docker. This is why:
You should first install Docker on your machine.
Then there are several options:
You need to run 2 containers:
Start by running a MySQL container and ensure you configure MySQL to use UTF8. The command below will also configure the MySQL container to save its data on your localhost in a /my/own/mysql directory:
docker run --name mysql-xwiki -v /my/own/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1
You should adapt the command line to use the passwords that you wish for the MySQL root password and for the xwiki user password.
Then run XWiki in another container by issuing the following command:
docker run --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki --link mysql-xwiki:db xwiki:mysql-tomcat
Be careful to use the same MySQL username, password and database names that you've used on the first command to start the MySQL container.
Another solution is to use the Docker Compose file we provide. Run the following steps:
wget https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/xwiki-mysql-tomcat/mysql/xwiki.cnf: This will download the MySQL configuration (UTF8, etc)
wget or prefer to use curl: curl -fSL https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/xwiki-mysql-tomcat/mysql/xwiki.cnf -o xwiki.cnflatest tag then use the corresponding GitHub branch/tag. For example for the 8.x branch: wget https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/8.x/xwiki-mysql-tomcat/mysql/xwiki.cnfwget -O docker-compose.yml https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/xwiki-mysql-tomcat/docker-compose-using.yml
wget or prefer to use curl: curl -fSL https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/xwiki-mysql-tomcat/docker-compose-using.yml -o docker-compose.ymllatest tag then use the corresponding GitHub branch/tag. For example for the 8.x branch: wget -O docker-compose.yml https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/8.x/xwiki-mysql-tomcat/docker-compose-using.ymldocker-compose upFor reference here's a minimal Docker Compose file using MySQL that you could use as an example (full example here):
version: '2'
services:
web:
image: "xwiki:mysql-tomcat"
depends_on:
- db
ports:
- "8080:8080"
environment:
- MYSQL_USER=xwiki
- MYSQL_PASSWORD=xwiki
volumes:
- xwiki-data:/usr/local/xwiki
db:
image: "mysql:5.7"
volumes:
- ./xwiki.cnf:/etc/mysql/conf.d/xwiki.cnf
- mysql-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xwiki
- MYSQL_USER=xwiki
- MYSQL_PASSWORD=xwiki
- MYSQL_DATABASE=xwiki
volumes:
mysql-data: {}
xwiki-data: {}
This allows you to rebuild the XWiki docker image locally. Here are the steps:
git clone https://github.com/xwiki-contrib/docker-xwiki.git or download the sources from the GitHub UI. Then choose the branch or tag that you wish to use:
masterbranch will get you the latest released version of XWiki8.x branch will get you the latest released version of XWiki for the 8.x cycle8.4.4 tag will get you exactly XWiki 8.4.4.cd xwiki-mysql-tomcat.docker-compose uphttp://localhost:8080Note that if you want to set a custom version of XWiki you can checkout master and edit the env file and set the values you need in there. It's also possible to override them on the command line with docker-compose run -e "XWIKI_VERSION=8.4.4".
Note that docker-compose up will automatically build the XWiki image on the first run. If you need to rebuild it you can issue docker-compose up --build. You can also build the image with docker build . -t xwiki-mysql-tomcat:latest for example.
The first time you create a container out of the xwiki image, a shell script (/usr/local/bin/start_xwiki.sh) is executed in the container to setup some configuration. The following environment variables can be passed:
MYSQL_USER: The MySQL user name used by XWiki to read/write to the DB.MYSQL_PASSWORD: The MySQL user password used by XWiki to read/write to the DB.Volumes:
If you don't map any volume when using docker run or if you use docker-compose then Docker will create some internal volumes attached to your containers as follows.
<prefix>_mysql-data that contains the database data.<prefix>_xwiki-data that contains XWiki's permanent directory.To find out where those volumes are located on your local host machine you can inspect them with docker volume inspect <volume name>. To find the volume name, you can list all volumes with docker volume ls.
Note that on Mac OSX, Docker runs inside the xhyve VM and thus the paths you get when inspecting the volumes are relative to this. Thus, you need to get into that VM if you need to access the volume data.
MySQL:
docker psdocker exec -it <containerid> bash -lmysql command: mysql --user=xwiki --password=xwiki