Jo's Wiki

A Random Collection of Information

User Tools

Site Tools


webdev:wikijs

Wiki.js

Installation

Steps:

  • Make sure Docker CE is installed
  • Create a directory for Wiki.js
  • Create a directory for the TLS certificate files
  • Create the Docker compose file
  • Create the Wiki.js config file
  • Create the TLS certificate files
  • Start up Wiki.js and run through the installation and configuration process

Create a directory for Wiki.js

mkdir ~/wikijs

Create a directory for the TLS certificate files

mkdir ~/wikijs/certs

Create the Docker compose file

docker-compose.yml
version: "3"
services:

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: "none"
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data

  wiki:
    image: ghcr.io/requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      HTTP_PORT: 3000
      SSL_ACTIVE: true
      SSL_PORT: 3443
      SSL_PROVIDER: custom
      SSL_CERT_FORMAT: pem
      SSL_KEY_FILE: "/certs/key.pem"
      SSL_CERT_FILE: "/certs/cert.pem"
    restart: unless-stopped
    ports:
      - "80:3000"
      - "443:3443"
    volumes:
      - ./config.yml:/wiki/config.yml
      - ./certs:/certs:ro

volumes:
  db-data:

Create the Wiki.js config file

config.yml
port: $(HTTP_PORT:3000)
bindIP: 0.0.0.0
db:
 type: $(DB_TYPE)
 host: '$(DB_HOST)'
 port: $(DB_PORT)
 user: '$(DB_USER)'
 pass: '$(DB_PASS)'
 db: $(DB_NAME)
 storage: $(DB_FILEPATH)
 ssl: $(DB_SSL)
ssl:
 enabled: $(SSL_ACTIVE:false)
 port: $(SSL_PORT:3443)
 provider: $(SSL_PROVIDER:letsencrypt)
 format: $(SSL_CERT_FORMAT:pem)
 domain: $(SSL_DOMAIN:null)
 subscriberEmail: $(LETSENCRYPT_EMAIL:null)
 key: $(SSL_KEY_FILE:null)
 cert: $(SSL_CERT_FILE:null)
 passphrase: $(SSL_PASSPHRASE:null)
 dhparam: $(SSL_DHPARAM:null)
logLevel: $(LOG_LEVEL:info)
logFormat: $(LOG_FORMAT:default)
ha: $(HA_ACTIVE)

Create the TLS certificate files

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ~/certs/key.pem -out ~/certs/cert.pem

Start up Wiki.js and run through the installation and configuration process

docker-compose up -d

Afterwards:

  • Open the HTTP version of the wiki
  • Create an account and set the URL to the HTTP domain
  • Open the HTTPS version of the wiki
  • Go to Administration > SSL > Redirect HTTP requests to HTTPS and choose Turn on
webdev/wikijs.txt · Last modified: 14 January 2024 by 127.0.0.1