Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Deploy Your Own Wiki With XWiki

Steps

Create Docker Compose File

Create a docker-compose.yml file with the following content:

version: '3.4'

services:
  wikijs:
    container_name: xwiki
    image: xwiki:lts-mysql-tomcat
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - '80:8080'
    environment:
      - DB_USER=${DB_USER}
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_DATABASE=${DB_NAME}
      - DB_HOST=db
    volumes:
      - xwiki:/usr/local/xwiki

  db:
    image: mysql:5.7
    container_name: db
    restart: always
    command: --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1
    volumes:
      - mysql-data:/var/lib/mysql
    healthcheck:
      test: mysqladmin status -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
      start_period: 5s
      interval: 5s
      timeout: 5s
      retries: 55
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=1
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_NAME}

volumes:
  xwiki:
    driver: local
  mysql-data:
    driver: local

Create Environment File

Now create a .env file at the same folder level as your docker-compose.yml file with the following content. Be sure to fill DB_PASSWORD with strong random alphanumeric password.

COMPOSE_PROJECT_NAME=xwiki


# Database connection details
DB_USER="xwiki"
DB_PASSWORD=""
DB_NAME="xwiki"

Don't forget to fill in DB_PASSWORD.

Deploy

Deploy by running:

docker-compose up

You should now see your wiki if you navigate to your host's IP address or hostname. Setting up through the web interface is pretty self-explanatory.

SSL

Please use a reverse proxy with SSL termination in order to implement an HTTPS connection from the user's browser to your network.

References

Last updated: 20th March 2023
First published: 19th March 2023

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch