From 391f25996e0078da3f73ebde9940197217644553 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 18 Dec 2025 19:59:20 +1300 Subject: [PATCH] config: Add 15 and update 3 files --- logserver/config/service.env | 2 +- simple-logs/config/service.env | 2 +- versions.json | 3 +- wikijs/README.txt | 64 ++++++++++++++++++++++++++++++++ wikijs/_volumes.sh | 7 ++++ wikijs/backup.sh | 18 +++++++++ wikijs/config/.template_info.env | 13 +++++++ wikijs/config/service.env | 18 +++++++++ wikijs/destroy.sh | 20 ++++++++++ wikijs/install.sh | 19 ++++++++++ wikijs/logs.sh | 11 ++++++ wikijs/ports.sh | 8 ++++ wikijs/restore.sh | 21 +++++++++++ wikijs/ssh.sh | 8 ++++ wikijs/start.sh | 30 +++++++++++++++ wikijs/status.sh | 31 ++++++++++++++++ wikijs/stop.sh | 11 ++++++ wikijs/uninstall.sh | 18 +++++++++ 18 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 wikijs/README.txt create mode 100755 wikijs/_volumes.sh create mode 100755 wikijs/backup.sh create mode 100644 wikijs/config/.template_info.env create mode 100644 wikijs/config/service.env create mode 100755 wikijs/destroy.sh create mode 100755 wikijs/install.sh create mode 100755 wikijs/logs.sh create mode 100755 wikijs/ports.sh create mode 100755 wikijs/restore.sh create mode 100755 wikijs/ssh.sh create mode 100755 wikijs/start.sh create mode 100755 wikijs/status.sh create mode 100755 wikijs/stop.sh create mode 100755 wikijs/uninstall.sh diff --git a/logserver/config/service.env b/logserver/config/service.env index c481a28..9913ff9 100644 --- a/logserver/config/service.env +++ b/logserver/config/service.env @@ -5,7 +5,7 @@ CONTAINER_NAME=logserver SSH_USER="root" # Ports -WEB_PORT=3000 # Grafana web UI +WEB_PORT=3001 # Grafana web UI LOKI_PORT=3100 # Loki API (for clients to send logs) # Authentication for Grafana diff --git a/simple-logs/config/service.env b/simple-logs/config/service.env index 4d786a2..7ee91ed 100644 --- a/simple-logs/config/service.env +++ b/simple-logs/config/service.env @@ -5,7 +5,7 @@ CONTAINER_NAME=simple-logs SSH_USER="root" # Web UI Port -WEB_PORT=3000 +WEB_PORT=3002 # Log retention (days) LOG_RETENTION=7 diff --git a/versions.json b/versions.json index a598e3e..1ae3102 100644 --- a/versions.json +++ b/versions.json @@ -2,10 +2,11 @@ "caddy": "1.0.0", "cloudflare-tunnel": "1.0.0", "gitea-runner-docker": "1.0.0", + "logserver": "1.0.1", "simple-object-server": "1.0.0", "squashdisplay": "1.0.0", "static-website": "1.0.0", "tailscale": "1.0.0", "watchtower": "1.0.0", - "logserver": "1.0.1" + "wikijs": "1.0.0" } diff --git a/wikijs/README.txt b/wikijs/README.txt new file mode 100644 index 0000000..e91fc21 --- /dev/null +++ b/wikijs/README.txt @@ -0,0 +1,64 @@ +Wiki.js Dropshell Template +========================== + +A modern, lightweight and powerful wiki application built on Node.js. +Uses the LinuxServer.io container image for easy deployment. + +Source: https://hub.docker.com/r/linuxserver/wikijs +Docs: https://docs.linuxserver.io/images/docker-wikijs + +Configuration +------------- + +Edit config/service.env to customize your installation: + +CONTAINER_NAME - Name for the Docker container (default: wikijs) +IMAGE_TAG - Docker image tag (default: latest) +DATA_PATH - Host path for persistent storage (default: /home/dropshell/wikijs) +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: Etc/UTC) + +Ports +----- + +3000 - Web interface (configurable via HTTP_PORT) + +Data Storage +------------ + +All persistent data is stored in DATA_PATH: + - config/ - Wiki.js configuration files + - data/ - Wiki content and database + +First Run +--------- + +After installation, access Wiki.js at http://your-server:3080 +You will be guided through the initial setup wizard to: + - Create an administrator account + - Configure authentication methods + - Set up your wiki settings + +Database +-------- + +By default, Wiki.js uses SQLite which requires no additional setup. +For PostgreSQL support, configure the database settings in the +Wiki.js admin panel after initial setup, or edit the config.yml +file directly in DATA_PATH/config/. + +Backup & Restore +---------------- + +Use the backup.sh and restore.sh scripts to backup and restore +your wiki data. Backups include all configuration and content. + +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 +- SSL/TLS should be handled by a reverse proxy (e.g., Caddy) diff --git a/wikijs/_volumes.sh b/wikijs/_volumes.sh new file mode 100755 index 0000000..7b8e39c --- /dev/null +++ b/wikijs/_volumes.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Define volume items for wikijs container +# These are used across backup, restore, create, and destroy operations + +get_wikijs_volumes() { + echo "path:data:${DATA_PATH}" +} diff --git a/wikijs/backup.sh b/wikijs/backup.sh new file mode 100755 index 0000000..c545f11 --- /dev/null +++ b/wikijs/backup.sh @@ -0,0 +1,18 @@ +#!/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 + +_stop_container "$CONTAINER_NAME" + +# shellcheck disable=SC2046 +backup_items $(get_wikijs_volumes) || _die "Failed to create backup" + +_start_container "$CONTAINER_NAME" + +echo "Backup created successfully" diff --git a/wikijs/config/.template_info.env b/wikijs/config/.template_info.env new file mode 100644 index 0000000..fc7d191 --- /dev/null +++ b/wikijs/config/.template_info.env @@ -0,0 +1,13 @@ +# DO NOT EDIT THIS FILE FOR YOUR SERVICE! +# This file is replaced from the template whenever there is an update. +# Edit the service.env file to make changes. + +# Template to use - always required! +TEMPLATE=wikijs +REQUIRES_HOST_ROOT=false +REQUIRES_DOCKER=true +REQUIRES_DOCKER_ROOT=false + +# Image settings +IMAGE_REGISTRY="lscr.io" +IMAGE_REPO="linuxserver/wikijs" diff --git a/wikijs/config/service.env b/wikijs/config/service.env new file mode 100644 index 0000000..be94d4e --- /dev/null +++ b/wikijs/config/service.env @@ -0,0 +1,18 @@ +# 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" + +# Server Settings +SSH_USER="root" + +# Data path on host for persistent storage +DATA_PATH="/home/dropshell/wikijs" + +# Wiki.js port (web interface) +HTTP_PORT=3080 + +# LinuxServer.io environment variables +PUID=1000 +PGID=1000 +TZ="Etc/UTC" diff --git a/wikijs/destroy.sh b/wikijs/destroy.sh new file mode 100755 index 0000000..abbc9b1 --- /dev/null +++ b/wikijs/destroy.sh @@ -0,0 +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! + +echo "WARNING: This will PERMANENTLY DELETE all data for ${CONTAINER_NAME}" +echo "This includes all wiki pages, users, and configuration!" + +./uninstall.sh + +# shellcheck disable=SC2046 +destroy_items $(get_wikijs_volumes) || _die "Failed to destroy docker volumes" + +echo "Destroyed ${CONTAINER_NAME} and all data." diff --git a/wikijs/install.sh b/wikijs/install.sh new file mode 100755 index 0000000..56e6004 --- /dev/null +++ b/wikijs/install.sh @@ -0,0 +1,19 @@ +#!/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_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" + +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}" + +echo "Installation of ${CONTAINER_NAME} complete" diff --git a/wikijs/logs.sh b/wikijs/logs.sh new file mode 100755 index 0000000..e64541c --- /dev/null +++ b/wikijs/logs.sh @@ -0,0 +1,11 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +# LOGS SCRIPT +# Shows the container logs + +echo "Container ${CONTAINER_NAME} logs:" +_grey_start +docker logs "${CONTAINER_NAME}" "$@" +_grey_end diff --git a/wikijs/ports.sh b/wikijs/ports.sh new file mode 100755 index 0000000..d9bbb50 --- /dev/null +++ b/wikijs/ports.sh @@ -0,0 +1,8 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "HTTP_PORT" + +# PORTS SCRIPT +# Lists the exposed ports + +echo "$HTTP_PORT" diff --git a/wikijs/restore.sh b/wikijs/restore.sh new file mode 100755 index 0000000..145c9b5 --- /dev/null +++ b/wikijs/restore.sh @@ -0,0 +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" + +# RESTORE SCRIPT +# Restores Wiki.js data from a backup + +# Uninstall container before restore +./uninstall.sh || _die "Failed to uninstall service before restore" + +# Restore data from backup file +# shellcheck disable=SC2046 +restore_items $(get_wikijs_volumes) || _die "Failed to restore data from backup file" + +# Reinstall service +./install.sh || _die "Failed to reinstall service after restore" + +echo "Restore complete! Service is running again." diff --git a/wikijs/ssh.sh b/wikijs/ssh.sh new file mode 100755 index 0000000..5cd6b11 --- /dev/null +++ b/wikijs/ssh.sh @@ -0,0 +1,8 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" + +# SSH SCRIPT +# Opens a shell inside the container + +docker exec -it "${CONTAINER_NAME}" /bin/bash diff --git a/wikijs/start.sh b/wikijs/start.sh new file mode 100755 index 0000000..666233e --- /dev/null +++ b/wikijs/start.sh @@ -0,0 +1,30 @@ +#!/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" + +# START SCRIPT +# The start script is required for all templates. +# It is used to start the service on the server. + +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} \ + ${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 + +echo "Container ${CONTAINER_NAME} started" +echo "Access Wiki.js at http://localhost:${HTTP_PORT}" diff --git a/wikijs/status.sh b/wikijs/status.sh new file mode 100755 index 0000000..b1a13d5 --- /dev/null +++ b/wikijs/status.sh @@ -0,0 +1,31 @@ +#!/bin/bash +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) + echo "Running" + ;; + exited|stopped) + echo "Stopped" + ;; + restarting|paused) + echo "Error" + ;; + *) + echo "Unknown" + ;; +esac diff --git a/wikijs/stop.sh b/wikijs/stop.sh new file mode 100755 index 0000000..fe3d4df --- /dev/null +++ b/wikijs/stop.sh @@ -0,0 +1,11 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_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. + +_stop_container $CONTAINER_NAME || _die "Failed to stop container ${CONTAINER_NAME}" + +echo "Container ${CONTAINER_NAME} stopped" diff --git a/wikijs/uninstall.sh b/wikijs/uninstall.sh new file mode 100755 index 0000000..d948214 --- /dev/null +++ b/wikijs/uninstall.sh @@ -0,0 +1,18 @@ +#!/bin/bash +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" + +# 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! + +_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" + +# Remove the image +docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" + +echo "Uninstallation of ${CONTAINER_NAME} complete." +echo "Data volume preserved. To remove all data, use destroy.sh"