Skip to content
Snippets Groups Projects
README.md 3.91 KiB
Newer Older
Provides several full Docker environments for running XWiki.

The following configurations are currently supported:
* Two Docker containers with one container for running latest MySQL 5.x database (configured to use UTF8 and be 
case-insensitive) and another container for running the latest Tomcat 8 + Java 8 + XWiki (the version depends on the 
branch/tag you use).

All source files are under the LGPL 2.1 license.

Vincent Massol's avatar
Vincent Massol committed
# Using
Fabio Mancinelli's avatar
Fabio Mancinelli committed

Vincent Massol's avatar
Vincent Massol committed
You should first install [Docker](https://www.docker.com/) on your machine.
Fabio Mancinelli's avatar
Fabio Mancinelli committed

Vincent Massol's avatar
Vincent Massol committed
Then there are several options:
1. Get the [sources of this project](https://github.com/xwiki-contrib/docker-xwiki) and build them.
Vincent Massol's avatar
Vincent Massol committed
2. Just pull the xwiki image from DockerHub.

## Building ##

This is the simplest solution and the one recommended. Here are the steps:

* Install Git and run `git clone https://github.com/xwiki-contrib/docker-xwiki.git` or download the sources from
Vincent Massol's avatar
Vincent Massol committed
the GitHub UI. Then choose the branch or tag that you wish to use:
  * The `master`branch will get you the latest released version of XWiki
  * The `8.x` branch will get you the latest released version of XWiki for the 8.x cycle
  * The `8.4.4` tag will get you exactly XWiki 8.4.4.
  * etc.
* Go the directory corresponding to the configuration you wish to build, for example: `cd xwiki-mysql-tomcat`.
Vincent Massol's avatar
Vincent Massol committed
* Run `docker-compose up` 
* Start a browser and point it to `http://localhost:8080`

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

## Pulling existing image ##

This is a bit more complex since you need to have 2 docker containers running: one for XWiki and one for the database.

Here's a minimal Docker Compose file using MySQL that you could use as an example (full example
Vincent Massol's avatar
Vincent Massol committed
[here](https://github.com/xwiki-contrib/xwiki-mysql-tomcat/blob/master/docker-compose-using.yml):

```
version: '2'
services:
  web:
    image: "xwiki/xwiki-mysql-tomcat:latest"
    depends_on:
      - db
    ports:
      - "8080:8080"
    volumes:
      - xwiki-data:/var/lib/xwiki
    environment:
      - MYSQL_USER=xwiki
      - MYSQL_PASSWORD=xwiki
      - MYSQL_DATABASE=xwiki
  db:
    image: "mysql:5"
    volumes:
      - ./mysql/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: {}
```

Fabio Mancinelli's avatar
Fabio Mancinelli committed

Volumes:
* Two volumes are created:
  * A volume named `<prefix>_mysql-data` that contains the database data.
  * A volume named `<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:
* To issue some mysql commands:
 * Find the container id with `docker ps` 
 * Execute bash in the mysql container: `docker exec -it <containerid> bash -l`
 * Once inside the mysql container execute the `mysql` command: `mysql --user=xwiki --password=xwiki`
Fabio Mancinelli's avatar
Fabio Mancinelli committed

Vincent Massol's avatar
Vincent Massol committed
# Future
* Setup xinit
* Configure libreoffice
* Solr as external service
Vincent Massol's avatar
Vincent Massol committed

# Credits

* Created by Vincent Massol
* Contributions from Ludovic Dubost, Jean Simard
* Some code was copied from https://github.com/ThomasSteinbach/docker_xwiki. Thank you Thomas Steinbach

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.