Deployment

Version 3.4 by chrisby on 2023/09/03 22:26

docker-compose.yml

version: "3.3"

volumes:
 traefik:
 xwiki:
 postgres:

services:
 traefik:
   image: "traefik:latest"
   container_name: "traefik"
   restart: unless-stopped
   command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
     # - "--certificatesresolvers.myresolver.acme.email=<email>"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
     # Uncomment for test mode. This allows detailed logging and creation of a fake certificate.
     # - "--log.level=DEBUG"
     # - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
   ports:
      - "443:443"
   volumes:
      - "traefik:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

 xwiki:
   image: "xwiki:stable-postgres-tomcat"
   container_name: xwiki-web
   restart: unless-stopped
   depends_on:
      - db
   environment:
      - DB_USER=xwiki
      - DB_PASSWORD=<DB_USER_PASSWORD>
      - DB_HOST=xwiki-postgres-db
   volumes:
      - xwiki:/usr/local/xwiki
   labels:
      - "traefik.enable=true"
      - "traefik.http.routers.xwiki.rule=Host(`<subdomain>`)"
      - "traefik.http.routers.xwiki.entrypoints=websecure"
      - "traefik.http.routers.xwiki.tls.certresolver=myresolver"

 db:
   image: "postgres:13.9"
   container_name: xwiki-postgres-db
   restart: unless-stopped
   volumes:
      - postgres:/var/lib/postgresql/data
   environment:
      - POSTGRES_ROOT_PASSWORD=<DB_ROOT_PASSWORD>
      - POSTGRES_PASSWORD=<DB_USER_PASSWORD>
      - POSTGRES_USER=xwiki
      - POSTGRES_DB=xwiki
      - POSTGRES_INITDB_ARGS="--encoding=UTF8"
  • Execute docker-compose up -d
  • Go to https://subdomain>. XWiki may take a few minutes to set up.
  • Once initialization is complete, simply follow the instructions, including creating an admin account.

After deploying XWiki, you should configure it through the GUI to customize the website to your needs. I have written an article about the most important configurations that I had applied for this website.