Wikijs
Setting Up WikiJS on Docker Compose
Wiki.js or WikiJS is an open source project based on NodeJS. The below is example is based on WikiJS V2, there is a V3 in development. However V3 has been in development for over a year i believe at this point (2024). The official documentation / Github has more information.
WikiJS Github - https://github.com/requarks/wiki
WikiJS Docs V2 - https://js.wiki/
WikiJS Docs V3 - https://beta.js.wiki/
Why Choose WikiJS
WikiJS offers a variety of editors depending on what type of content it is that needs to be written, as well as a simple user interface.
The editors available are:
- AsciiDoc - Plain Text Formatting
- Code Raw HTML
- Markdown - Plain Text Formatting
- Visual Editor - Rich-Text WYSIWYG
Primarily the Markdown Editor is used to write documentation on other services such as Github and GitLab, so is a lot more familiar to Developers due to Markdown being used for Git Repository Documentation.
Docker Compose Example
Below is an example docker-compose file with additional configurations used to start WikiJS behind a Traefik Reverse Proxy. An example docker-compose configuration from WikiJS can be found here https://docs.requarks.io/install/docker#using-docker-compose where none of the additional configuration is specified.
networks: frontend: external: true backend: external: trueservices: db: image: postgres:16-alpine3.19 container_name: wikijs-db environment: POSTGRES_DB: wiki POSTGRES_PASSWORD: <password> POSTGRES_USER: wikijs logging: driver: "none" restart: unless-stopped networks: - frontend - backend volumes: - ./data/postgres:/var/lib/postgresql/data wiki: image: requarks/wiki:2.5.303 depends_on: - db environment: DB_TYPE: postgres DB_HOST: wikijs_db DB_PORT: 5432 DB_USER: <username> DB_PASS: <password> DB_NAME: wiki labels: - traefik.enable=true - traefik.http.routers.wiki.rule=Host(`wiki.<domain>`) - traefik.http.routers.wiki.entrypoints=https - traefik.http.services.wiki.loadbalancer.server.port=3000 - traefik.http.routers.wiki.service=wiki - traefik.http.services.wiki.loadbalancer.server.scheme=http - traefik.http.routers.tls=true - traefik.http.routers.wiki.tls.certresolver=myresolver - "--certificatesresolvers.myresolver.acme.dnschallenge=true" - "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare" restart: unless-stopped networks: - frontend - backend ports: - "3000:3000"volumes: db-data:
Start WikiJS
Now start the docker compose file above has had the relevent configuration updated, start WikiJS using the folliowing command:
docker compose up -d
Key Components of Docker Compose Configuration Explained
- Image - Specifies the WikiJS server image and tag
- Ports - Exposes WikiJS on specified port
- Volumes - For media files and custom templates
- Environment - Configures database credentials
- Labels - Used by Traefik to provide external access to the service, once the service all its dependancies have been started are
"healthy" and Accessible
, Public Service Name and what provider to use to check and obtain for an SSL Certificate
Volumes
- Persistent Storage - Defined for PostgreSQL (
Database
) and Redis(redis
)