docs: Add 1 and update 13 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 49s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 49s
This commit is contained in:
@@ -2,11 +2,18 @@ Wiki.js Dropshell Template
|
||||
==========================
|
||||
|
||||
A modern, lightweight and powerful wiki application built on Node.js.
|
||||
Uses the LinuxServer.io container image for easy deployment.
|
||||
Uses Docker Compose with PostgreSQL database for reliability.
|
||||
|
||||
Source: https://hub.docker.com/r/linuxserver/wikijs
|
||||
Docs: https://docs.linuxserver.io/images/docker-wikijs
|
||||
|
||||
Architecture
|
||||
------------
|
||||
|
||||
This template runs two containers:
|
||||
- wikijs: The Wiki.js application (linuxserver/wikijs)
|
||||
- wikijs_db: PostgreSQL 15 database
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
@@ -19,7 +26,9 @@ HTTP_PORT - Web interface port (default: 3080)
|
||||
PUID - User ID for file permissions (default: 1000)
|
||||
PGID - Group ID for file permissions (default: 1000)
|
||||
TZ - Timezone (default: Pacific/Auckland)
|
||||
DB_TYPE - Database type: sqlite or postgres (default: sqlite)
|
||||
DB_NAME - PostgreSQL database name (default: wikijs)
|
||||
DB_USER - PostgreSQL username (default: wikijs)
|
||||
DB_PASS - PostgreSQL password (default: changeme) ** CHANGE THIS! **
|
||||
|
||||
Ports
|
||||
-----
|
||||
@@ -31,7 +40,8 @@ Data Storage
|
||||
|
||||
All persistent data is stored in DATA_PATH:
|
||||
- config/ - Wiki.js configuration files
|
||||
- data/ - Wiki content and database
|
||||
- data/ - Wiki.js data and uploads
|
||||
- postgres/ - PostgreSQL database files
|
||||
|
||||
First Run
|
||||
---------
|
||||
@@ -45,30 +55,24 @@ You will be guided through the initial setup wizard to:
|
||||
Database
|
||||
--------
|
||||
|
||||
By default, Wiki.js uses SQLite (DB_TYPE=sqlite) which requires no
|
||||
additional setup and stores data in DATA_PATH/data/.
|
||||
PostgreSQL 15 is included and configured automatically.
|
||||
Database credentials are set in service.env.
|
||||
|
||||
For PostgreSQL support, set DB_TYPE=postgres and configure these
|
||||
additional environment variables in service.env:
|
||||
DB_HOST - PostgreSQL server hostname
|
||||
DB_PORT - PostgreSQL server port (default: 5432)
|
||||
DB_NAME - Database name
|
||||
DB_USER - Database username
|
||||
DB_PASS - Database password
|
||||
|
||||
Note: Database settings only apply on first run. After initial setup,
|
||||
modify DATA_PATH/config/config.yml directly.
|
||||
IMPORTANT: Change DB_PASS from the default before first install!
|
||||
|
||||
Backup & Restore
|
||||
----------------
|
||||
|
||||
Use the backup.sh and restore.sh scripts to backup and restore
|
||||
your wiki data. Backups include all configuration and content.
|
||||
your wiki data. Backups include:
|
||||
- Wiki.js configuration
|
||||
- PostgreSQL database
|
||||
- Uploaded assets
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
- The container runs as non-root using PUID/PGID
|
||||
- Configuration changes after first run should be made through
|
||||
the Wiki.js admin panel or by editing config/config.yml
|
||||
- Both containers restart automatically unless stopped
|
||||
- The database container must be running for Wiki.js to work
|
||||
- SSL/TLS should be handled by a reverse proxy (e.g., Caddy)
|
||||
- Use 'docker compose logs' to view logs from both containers
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/_volumes.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||
|
||||
# BACKUP SCRIPT
|
||||
# Creates a backup of the Wiki.js data volume
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
_stop_container "$CONTAINER_NAME"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Stop containers for consistent backup
|
||||
docker compose stop
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
backup_items $(get_wikijs_volumes) || _die "Failed to create backup"
|
||||
|
||||
_start_container "$CONTAINER_NAME"
|
||||
# Restart containers
|
||||
docker compose start
|
||||
|
||||
echo "Backup created successfully"
|
||||
|
||||
@@ -8,6 +8,6 @@ REQUIRES_HOST_ROOT=false
|
||||
REQUIRES_DOCKER=true
|
||||
REQUIRES_DOCKER_ROOT=false
|
||||
|
||||
# Image settings
|
||||
# Image settings (used by docker-compose.yml)
|
||||
IMAGE_REGISTRY="lscr.io"
|
||||
IMAGE_REPO="linuxserver/wikijs"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Service settings specific to this server
|
||||
# (can also override anything in the .template_info.env file in the template to make it specific to this server)
|
||||
CONTAINER_NAME=wikijs
|
||||
IMAGE_TAG="latest"
|
||||
|
||||
@@ -17,5 +16,7 @@ PUID=1000
|
||||
PGID=1000
|
||||
TZ="Pacific/Auckland"
|
||||
|
||||
# Database configuration (sqlite requires no external database)
|
||||
DB_TYPE="sqlite"
|
||||
# PostgreSQL database settings
|
||||
DB_NAME="wikijs"
|
||||
DB_USER="wikijs"
|
||||
DB_PASS="changeme"
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/_volumes.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||
|
||||
# DESTROY SCRIPT
|
||||
# Completely removes the service AND all data
|
||||
# WARNING: This is irreversible!
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
echo "WARNING: This will PERMANENTLY DELETE all data for ${CONTAINER_NAME}"
|
||||
echo "This includes all wiki pages, users, and configuration!"
|
||||
echo "This includes all wiki pages, users, database, and configuration!"
|
||||
|
||||
./uninstall.sh
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
destroy_items $(get_wikijs_volumes) || _die "Failed to destroy docker volumes"
|
||||
# Stop and remove containers
|
||||
docker compose down -v 2>/dev/null || true
|
||||
|
||||
# Remove data directory
|
||||
rm -rf "${DATA_PATH}"
|
||||
|
||||
echo "Destroyed ${CONTAINER_NAME} and all data."
|
||||
|
||||
33
wikijs/docker-compose.yml
Normal file
33
wikijs/docker-compose.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
container_name: ${CONTAINER_NAME}_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASS}
|
||||
volumes:
|
||||
- ${DATA_PATH}/postgres:/var/lib/postgresql/data
|
||||
|
||||
wikijs:
|
||||
image: lscr.io/linuxserver/wikijs:${IMAGE_TAG}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
- PUID=${PUID}
|
||||
- PGID=${PGID}
|
||||
- TZ=${TZ}
|
||||
- DB_TYPE=postgres
|
||||
- DB_HOST=${CONTAINER_NAME}_db
|
||||
- DB_PORT=5432
|
||||
- DB_USER=${DB_USER}
|
||||
- DB_PASS=${DB_PASS}
|
||||
- DB_NAME=${DB_NAME}
|
||||
volumes:
|
||||
- ${DATA_PATH}/config:/config
|
||||
- ${DATA_PATH}/data:/data
|
||||
ports:
|
||||
- "${HTTP_PORT}:3000"
|
||||
@@ -1,19 +1,26 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/_volumes.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "DATA_PATH"
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
create_items $(get_wikijs_volumes) || _die "Failed to create data directory $DATA_PATH"
|
||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||
|
||||
_check_docker_installed || _die "Docker test failed, aborting installation..."
|
||||
|
||||
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
||||
# Create data directories
|
||||
mkdir -p "${DATA_PATH}/config" "${DATA_PATH}/data" "${DATA_PATH}/postgres"
|
||||
|
||||
bash ./stop.sh || _die "Failed to stop container ${CONTAINER_NAME}"
|
||||
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
|
||||
bash ./start.sh || _die "Failed to start container ${CONTAINER_NAME}"
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Pull images
|
||||
docker compose pull || _die "Failed to pull images"
|
||||
|
||||
# Stop existing containers
|
||||
docker compose down 2>/dev/null || true
|
||||
|
||||
# Start containers (--build ensures fresh state)
|
||||
docker compose up -d --build || _die "Failed to start containers"
|
||||
|
||||
echo "Installation of ${CONTAINER_NAME} complete"
|
||||
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# LOGS SCRIPT
|
||||
# Shows the container logs
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
echo "Container ${CONTAINER_NAME} logs:"
|
||||
_grey_start
|
||||
docker logs "${CONTAINER_NAME}" "$@"
|
||||
docker compose logs "$@"
|
||||
_grey_end
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/_volumes.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||
|
||||
# RESTORE SCRIPT
|
||||
# Restores Wiki.js data from a backup
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
# Uninstall container before restore
|
||||
./uninstall.sh || _die "Failed to uninstall service before restore"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Stop containers before restore
|
||||
docker compose down
|
||||
|
||||
# Restore data from backup file
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# SSH SCRIPT
|
||||
# Opens a shell inside the container
|
||||
|
||||
# SSH into the wikijs container
|
||||
docker exec -it "${CONTAINER_NAME}" /bin/bash
|
||||
|
||||
@@ -1,31 +1,13 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "DATA_PATH" "HTTP_PORT" "PUID" "PGID" "TZ" "DB_TYPE"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||
|
||||
# START SCRIPT
|
||||
# The start script is required for all templates.
|
||||
# It is used to start the service on the server.
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
DOCKER_RUN_CMD="docker run -d \
|
||||
--restart unless-stopped \
|
||||
--name ${CONTAINER_NAME} \
|
||||
-p ${HTTP_PORT}:3000 \
|
||||
-v ${DATA_PATH}/config:/config \
|
||||
-v ${DATA_PATH}/data:/data \
|
||||
-e PUID=${PUID} \
|
||||
-e PGID=${PGID} \
|
||||
-e TZ=${TZ} \
|
||||
-e DB_TYPE=${DB_TYPE} \
|
||||
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
|
||||
|
||||
if ! _create_and_start_container "$DOCKER_RUN_CMD" "$CONTAINER_NAME"; then
|
||||
_die "Failed to start container ${CONTAINER_NAME}"
|
||||
fi
|
||||
|
||||
# Check if the container is running
|
||||
if ! _is_container_running "$CONTAINER_NAME"; then
|
||||
_die "Container ${CONTAINER_NAME} is not running"
|
||||
fi
|
||||
cd "$SCRIPT_DIR"
|
||||
docker compose up -d || _die "Failed to start containers"
|
||||
|
||||
echo "Container ${CONTAINER_NAME} started"
|
||||
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|
||||
|
||||
@@ -2,30 +2,13 @@
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# STATUS SCRIPT
|
||||
# The status script is REQUIRED.
|
||||
# It is used to return the status of the service.
|
||||
# Must output exactly one of: Running, Stopped, Error, Unknown
|
||||
|
||||
# Check if container exists
|
||||
if ! docker ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||
echo "Unknown"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check container state
|
||||
STATE=$(docker inspect -f '{{.State.Status}}' "$CONTAINER_NAME" 2>/dev/null)
|
||||
case "$STATE" in
|
||||
running)
|
||||
# Check if main wikijs container is running
|
||||
if docker ps --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||
echo "Running"
|
||||
;;
|
||||
exited|stopped)
|
||||
else
|
||||
if docker ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||
echo "Stopped"
|
||||
;;
|
||||
restarting|paused)
|
||||
echo "Error"
|
||||
;;
|
||||
*)
|
||||
else
|
||||
echo "Unknown"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# STOP SCRIPT
|
||||
# The stop script is required for all templates.
|
||||
# It is used to stop the service on the server.
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
_stop_container $CONTAINER_NAME || _die "Failed to stop container ${CONTAINER_NAME}"
|
||||
cd "$SCRIPT_DIR"
|
||||
docker compose stop || _die "Failed to stop containers"
|
||||
|
||||
echo "Container ${CONTAINER_NAME} stopped"
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#!/bin/bash
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_check_required_env_vars "CONTAINER_NAME"
|
||||
|
||||
# UNINSTALL SCRIPT
|
||||
# The uninstall script is required for all templates.
|
||||
# It is used to uninstall the service from the server.
|
||||
# IMPORTANT: This script MUST preserve data volumes!
|
||||
# Export variables for docker compose
|
||||
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||
|
||||
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
|
||||
_is_container_running "$CONTAINER_NAME" && _die "Couldn't stop existing container"
|
||||
_is_container_exists "$CONTAINER_NAME" && _die "Couldn't remove existing container"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Remove the image
|
||||
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
||||
# Stop and remove containers (but preserve volumes/data)
|
||||
docker compose down || _die "Failed to stop containers"
|
||||
|
||||
# Remove images
|
||||
docker compose config --images | xargs -r docker rmi 2>/dev/null || true
|
||||
|
||||
echo "Uninstallation of ${CONTAINER_NAME} complete."
|
||||
echo "Data volume preserved. To remove all data, use destroy.sh"
|
||||
echo "Data preserved in ${DATA_PATH}. To remove all data, use destroy.sh"
|
||||
|
||||
Reference in New Issue
Block a user