Professional Wikantik Deployment with Docker

🌐 Product overview: Self-hosting & backup on wikantik.com — a plain-language walkthrough for readers and AI agents.

This guide provides a comprehensive walkthrough for deploying a production-ready Wikantik instance using Docker, with a focus on configuration, data persistence, and automated backups.

1. Configuration

Wikantik's Docker container is highly configurable through environment variables. This allows you to customize your installation without modifying the core application files.

Environment Variables

The following environment variables are available to configure your Wikantik instance. You can set them in your docker-compose.yml file or directly with the docker run command.

2. Data Persistence and Backup Strategy

To ensure that your wiki's data persists across container restarts and to facilitate backups, it is crucial to use Docker volumes.

Critical Data Directories

The following directories contain all of Wikantik's critical data and should be mounted as volumes:

Automated Backups

Our recommended backup strategy involves a dedicated backup container that has read-only access to the Wikantik data volume. This container runs a cron job to create compressed archives of the data at regular intervals.

3. Example Docker Compose Deployment

This example uses docker-compose to define and run a multi-container Wikantik application with an automated backup service.

Project Structure

.
├── docker-compose.yml
└── backup/
    ├── backup.sh
    └── crontab

docker-compose.yml

version: '3.7'

services:
  jspwiki:
    build: .
    container_name: jspwiki
    restart: always
    ports:
      - "8080:8080"
    volumes:
      - jspwiki-data:/var/jspwiki

  backup:
    image: alpine
    container_name: jspwiki-backup
    restart: always
    volumes:
      - jspwiki-data:/var/jspwiki:ro
      - ./backups:/backups
      - ./backup:/etc/periodic/daily
    command: ["crond", "-f", "-d", "8"]

volumes:
  jspwiki-data:

backup/backup.sh

#!/bin/sh

set -e

# Create a compressed archive of the wikantik data
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
BACKUP_FILE="/backups/jspwiki-backup-${TIMESTAMP}.tar.gz"

tar -czf "${BACKUP_FILE}" -C /var/jspwiki .

# Prune old backups (keep the last 7)
find /backups -name "jspwiki-backup-*.tar.gz" -type f -mtime +7 -delete

backup/crontab

# Run the backup script daily at 2:00 AM
0 2 * * * /etc/periodic/daily/backup.sh

Deployment Steps

  1. Create the necessary files and directories as shown in the project structure above.

  2. Make the backup.sh script executable:

    chmod +x backup/backup.sh
    
  3. Start the application:

    docker-compose up -d
    
  4. Verify the deployment:

    • Access Wikantik at http://localhost:8080.

    • Check the logs of the backup container to ensure that the cron job is running:

      docker logs jspwiki-backup
      

Restoring from a Backup

To restore your Wikantik instance from a backup:

  1. Stop the jspwiki container:

    docker-compose stop jspwiki
    
  2. Extract the backup archive to the jspwiki-data volume:

    docker run --rm -v jspwiki-data:/var/jspwiki -v $(pwd)/backups:/backups alpine tar -xzf /backups/jspwiki-backup-<TIMESTAMP>.tar.gz -C /var/jspwiki
    
  3. Restart the jspwiki container:

    docker-compose start jspwiki