docker.recipes

Wiki.js Knowledge Base

intermediate

Modern wiki platform with Wiki.js, Git sync, and full-text search.

Overview

Wiki.js is a modern, lightweight wiki engine built on Node.js that revolutionizes knowledge management with its Git-native approach to content versioning and sleek, responsive interface. Originally created by Nicolas Giard in 2017, Wiki.js addresses the limitations of traditional wiki platforms by offering native Markdown support, extensive authentication integrations, and powerful search capabilities while maintaining simplicity for content creators. This production stack combines Wiki.js with PostgreSQL for robust relational data storage and Elasticsearch for enterprise-grade full-text search functionality. PostgreSQL serves as the primary database, storing user accounts, page metadata, and configuration data with ACID compliance, while Elasticsearch indexes all wiki content to provide lightning-fast search results with relevance scoring and advanced query capabilities. The synergy between these components creates a knowledge base platform that scales from small team documentation to enterprise-wide knowledge repositories. This configuration is ideal for organizations that need professional documentation management with Git workflow integration, teams requiring advanced search across large content volumes, and businesses wanting to migrate from legacy wiki platforms while maintaining data integrity and search performance.

Key Features

  • Native Git synchronization for content versioning and backup with support for GitHub, GitLab, and Bitbucket repositories
  • Advanced full-text search powered by Elasticsearch with relevance scoring, faceted search, and content highlighting
  • WYSIWYG and Markdown editors with real-time preview and collaborative editing capabilities
  • PostgreSQL JSONB storage for flexible page metadata and custom field management
  • Multi-authentication support including LDAP, SAML, OAuth2, and local authentication with role-based access control
  • Elasticsearch aggregations for content analytics including page views, search trends, and user activity metrics
  • Automated page tree management with PostgreSQL hierarchical queries for complex documentation structures
  • Real-time content indexing with Elasticsearch bulk operations for immediate search availability

Common Use Cases

  • 1Software development teams needing technical documentation with Git workflow integration and code snippet management
  • 2Enterprise organizations migrating from Confluence or SharePoint while maintaining advanced search capabilities
  • 3Educational institutions creating searchable knowledge bases for course materials and research documentation
  • 4Customer support teams building comprehensive help centers with fast content retrieval and user feedback tracking
  • 5Open source projects requiring collaborative documentation with public access and contributor management
  • 6IT departments creating internal runbooks and procedures with role-based access and audit trails
  • 7Consulting firms managing client documentation with project-based access control and content versioning

Prerequisites

  • Minimum 4GB RAM available (2GB for Elasticsearch, 1GB for PostgreSQL, 1GB for Wiki.js and system overhead)
  • Docker and Docker Compose installed with support for named volumes and custom networks
  • Port 3000 available for Wiki.js web interface access
  • Basic understanding of PostgreSQL administration for backup and maintenance procedures
  • Git repository access if planning to use Git synchronization features for content versioning
  • SSL certificate and reverse proxy knowledge for production HTTPS deployment

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 postgres:
3 image: postgres:15-alpine
4 environment:
5 - POSTGRES_USER=wiki
6 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
7 - POSTGRES_DB=wiki
8 volumes:
9 - postgres_data:/var/lib/postgresql/data
10 networks:
11 - wiki_net
12
13 elasticsearch:
14 image: docker.elastic.co/elasticsearch/elasticsearch:7.17.15
15 environment:
16 - discovery.type=single-node
17 - xpack.security.enabled=false
18 - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
19 volumes:
20 - es_data:/usr/share/elasticsearch/data
21 networks:
22 - wiki_net
23
24 wiki:
25 image: ghcr.io/requarks/wiki:2
26 ports:
27 - "3000:3000"
28 environment:
29 - DB_TYPE=postgres
30 - DB_HOST=postgres
31 - DB_PORT=5432
32 - DB_USER=wiki
33 - DB_PASS=${POSTGRES_PASSWORD}
34 - DB_NAME=wiki
35 depends_on:
36 - postgres
37 - elasticsearch
38 networks:
39 - wiki_net
40
41volumes:
42 postgres_data:
43 es_data:
44
45networks:
46 wiki_net:

.env Template

.env
1# Wiki.js
2POSTGRES_PASSWORD=secure_postgres_password
3
4# Wiki.js at http://localhost:3000
5# Complete setup wizard on first access

Usage Notes

  1. 1Wiki.js at http://localhost:3000
  2. 2Complete setup wizard first
  3. 3Git storage for version control
  4. 4Elasticsearch for full-text search
  5. 5Multiple auth providers

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

postgres
postgres:
  image: postgres:15-alpine
  environment:
    - POSTGRES_USER=wiki
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=wiki
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - wiki_net
elasticsearch
elasticsearch:
  image: docker.elastic.co/elasticsearch/elasticsearch:7.17.15
  environment:
    - discovery.type=single-node
    - xpack.security.enabled=false
    - ES_JAVA_OPTS=-Xms512m -Xmx512m
  volumes:
    - es_data:/usr/share/elasticsearch/data
  networks:
    - wiki_net
wiki
wiki:
  image: ghcr.io/requarks/wiki:2
  ports:
    - "3000:3000"
  environment:
    - DB_TYPE=postgres
    - DB_HOST=postgres
    - DB_PORT=5432
    - DB_USER=wiki
    - DB_PASS=${POSTGRES_PASSWORD}
    - DB_NAME=wiki
  depends_on:
    - postgres
    - elasticsearch
  networks:
    - wiki_net

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 postgres:
5 image: postgres:15-alpine
6 environment:
7 - POSTGRES_USER=wiki
8 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
9 - POSTGRES_DB=wiki
10 volumes:
11 - postgres_data:/var/lib/postgresql/data
12 networks:
13 - wiki_net
14
15 elasticsearch:
16 image: docker.elastic.co/elasticsearch/elasticsearch:7.17.15
17 environment:
18 - discovery.type=single-node
19 - xpack.security.enabled=false
20 - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
21 volumes:
22 - es_data:/usr/share/elasticsearch/data
23 networks:
24 - wiki_net
25
26 wiki:
27 image: ghcr.io/requarks/wiki:2
28 ports:
29 - "3000:3000"
30 environment:
31 - DB_TYPE=postgres
32 - DB_HOST=postgres
33 - DB_PORT=5432
34 - DB_USER=wiki
35 - DB_PASS=${POSTGRES_PASSWORD}
36 - DB_NAME=wiki
37 depends_on:
38 - postgres
39 - elasticsearch
40 networks:
41 - wiki_net
42
43volumes:
44 postgres_data:
45 es_data:
46
47networks:
48 wiki_net:
49EOF
50
51# 2. Create the .env file
52cat > .env << 'EOF'
53# Wiki.js
54POSTGRES_PASSWORD=secure_postgres_password
55
56# Wiki.js at http://localhost:3000
57# Complete setup wizard on first access
58EOF
59
60# 3. Start the services
61docker compose up -d
62
63# 4. View logs
64docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/wiki-js-complete/run | bash

Troubleshooting

  • Wiki.js shows 'Database connection failed': Verify POSTGRES_PASSWORD environment variable matches between postgres and wiki services, and ensure postgres container is fully started before wiki container attempts connection
  • Elasticsearch container exits with 'max virtual memory areas vm.max_map_count too low': Run 'sysctl -w vm.max_map_count=262144' on Docker host and add 'vm.max_map_count=262144' to /etc/sysctl.conf for persistence
  • Search functionality returns no results: Check Elasticsearch container logs for indexing errors and verify ES_JAVA_OPTS memory allocation doesn't exceed available container memory
  • Wiki.js setup wizard shows database error: Ensure PostgreSQL container has completed initialization by checking logs for 'database system is ready to accept connections' message before accessing Wiki.js
  • High memory usage from Elasticsearch: Reduce ES_JAVA_OPTS heap size from 512m to 256m for smaller deployments, but expect slower search performance with large content volumes

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space