Deployment

Last modified by chrisby on 2024/03/03 14:54

docker-compose.yml
version: "3.3"

volumes:
  traefik:
  xwiki:
  postgres:

services:
  traefik:
    image: "traefik:v2.10.4"
    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:15.7.0-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"
Instructions
  • 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.