This guide details the setup and configuration of Wiki.js, a powerful open-source wiki platform, using Docker in a home lab environment. The setup involves two containers managed via Docker Compose: one for the MariaDB database and another for the Wiki.js application.
This configuration employs Docker Compose to manage two services:
db-data) is used to retain MariaDB data across container restarts or recreations.logging.driver: "none") to avoid exposing sensitive information.3002 of the host, while internally using port 3000, allowing flexibility to avoid conflicts.db:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: secure_root_password
MYSQL_DATABASE: wikijs
MYSQL_USER: wikijs
MYSQL_PASSWORD: secure_user_password
logging:
driver: "none"
restart: unless-stopped
volumes:
- db-data:/var/lib/mysql
MYSQL_ROOT_PASSWORD: Secures administrative access to the database.MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD: Creates a dedicated database and user for Wiki.js with limited privileges.db-data volume for persistence.wiki:
image: ghcr.io/requarks/wiki:2
depends_on:
- db
environment:
DB_TYPE: mariadb
DB_HOST: db
DB_PORT: 3306
DB_USER: wikijs
DB_PASS: secure_user_password
DB_NAME: wikijs
restart: unless-stopped
ports:
- "3002:3000"
DB_TYPE, DB_HOST, and DB_PORT: Specify the database type (MariaDB), hostname (db), and port (3306).DB_USER, DB_PASS, and DB_NAME: Ensure these match the MariaDB container settings for seamless communication.3000 to host port 3002 for external access.depends_on directive ensures that the database starts before Wiki.js.volumes:
db-data:
db-data: Stores MariaDB’s data files to ensure persistence across container restarts or updates.Prerequisites:
3002 is available on the host.Create the docker-compose.yml:
docker-compose.yml file.Start the Containers:
docker-compose up -d
Access Wiki.js:
http://<your-server-ip>:3002
Monitor Services:
docker ps
MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD..env File:
.env file and reference them in docker-compose.yml:environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
3002 if Wiki.js is intended for internal use only.This setup provides a reliable and secure foundation for hosting Wiki.js in a home lab. With modularity and persistence, it’s easy to maintain and expand as your needs grow.