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.
|
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
|
Source: https://hub.docker.com/r/linuxserver/wikijs
|
||||||
Docs: https://docs.linuxserver.io/images/docker-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
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
@@ -19,7 +26,9 @@ HTTP_PORT - Web interface port (default: 3080)
|
|||||||
PUID - User ID for file permissions (default: 1000)
|
PUID - User ID for file permissions (default: 1000)
|
||||||
PGID - Group ID for file permissions (default: 1000)
|
PGID - Group ID for file permissions (default: 1000)
|
||||||
TZ - Timezone (default: Pacific/Auckland)
|
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
|
Ports
|
||||||
-----
|
-----
|
||||||
@@ -30,8 +39,9 @@ Data Storage
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
All persistent data is stored in DATA_PATH:
|
All persistent data is stored in DATA_PATH:
|
||||||
- config/ - Wiki.js configuration files
|
- config/ - Wiki.js configuration files
|
||||||
- data/ - Wiki content and database
|
- data/ - Wiki.js data and uploads
|
||||||
|
- postgres/ - PostgreSQL database files
|
||||||
|
|
||||||
First Run
|
First Run
|
||||||
---------
|
---------
|
||||||
@@ -45,30 +55,24 @@ You will be guided through the initial setup wizard to:
|
|||||||
Database
|
Database
|
||||||
--------
|
--------
|
||||||
|
|
||||||
By default, Wiki.js uses SQLite (DB_TYPE=sqlite) which requires no
|
PostgreSQL 15 is included and configured automatically.
|
||||||
additional setup and stores data in DATA_PATH/data/.
|
Database credentials are set in service.env.
|
||||||
|
|
||||||
For PostgreSQL support, set DB_TYPE=postgres and configure these
|
IMPORTANT: Change DB_PASS from the default before first install!
|
||||||
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.
|
|
||||||
|
|
||||||
Backup & Restore
|
Backup & Restore
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Use the backup.sh and restore.sh scripts to backup and 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
|
Notes
|
||||||
-----
|
-----
|
||||||
|
|
||||||
- The container runs as non-root using PUID/PGID
|
- Both containers restart automatically unless stopped
|
||||||
- Configuration changes after first run should be made through
|
- The database container must be running for Wiki.js to work
|
||||||
the Wiki.js admin panel or by editing config/config.yml
|
|
||||||
- SSL/TLS should be handled by a reverse proxy (e.g., Caddy)
|
- 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
|
#!/bin/bash
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${SCRIPT_DIR}/_volumes.sh"
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||||
|
|
||||||
# BACKUP SCRIPT
|
# Export variables for docker compose
|
||||||
# Creates a backup of the Wiki.js data volume
|
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
|
# shellcheck disable=SC2046
|
||||||
backup_items $(get_wikijs_volumes) || _die "Failed to create backup"
|
backup_items $(get_wikijs_volumes) || _die "Failed to create backup"
|
||||||
|
|
||||||
_start_container "$CONTAINER_NAME"
|
# Restart containers
|
||||||
|
docker compose start
|
||||||
|
|
||||||
echo "Backup created successfully"
|
echo "Backup created successfully"
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ REQUIRES_HOST_ROOT=false
|
|||||||
REQUIRES_DOCKER=true
|
REQUIRES_DOCKER=true
|
||||||
REQUIRES_DOCKER_ROOT=false
|
REQUIRES_DOCKER_ROOT=false
|
||||||
|
|
||||||
# Image settings
|
# Image settings (used by docker-compose.yml)
|
||||||
IMAGE_REGISTRY="lscr.io"
|
IMAGE_REGISTRY="lscr.io"
|
||||||
IMAGE_REPO="linuxserver/wikijs"
|
IMAGE_REPO="linuxserver/wikijs"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# Service settings specific to this server
|
# 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
|
CONTAINER_NAME=wikijs
|
||||||
IMAGE_TAG="latest"
|
IMAGE_TAG="latest"
|
||||||
|
|
||||||
@@ -17,5 +16,7 @@ PUID=1000
|
|||||||
PGID=1000
|
PGID=1000
|
||||||
TZ="Pacific/Auckland"
|
TZ="Pacific/Auckland"
|
||||||
|
|
||||||
# Database configuration (sqlite requires no external database)
|
# PostgreSQL database settings
|
||||||
DB_TYPE="sqlite"
|
DB_NAME="wikijs"
|
||||||
|
DB_USER="wikijs"
|
||||||
|
DB_PASS="changeme"
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${SCRIPT_DIR}/_volumes.sh"
|
|
||||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||||
|
|
||||||
# DESTROY SCRIPT
|
# Export variables for docker compose
|
||||||
# Completely removes the service AND all data
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
# WARNING: This is irreversible!
|
|
||||||
|
|
||||||
echo "WARNING: This will PERMANENTLY DELETE all data for ${CONTAINER_NAME}"
|
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
|
# Stop and remove containers
|
||||||
destroy_items $(get_wikijs_volumes) || _die "Failed to destroy docker volumes"
|
docker compose down -v 2>/dev/null || true
|
||||||
|
|
||||||
|
# Remove data directory
|
||||||
|
rm -rf "${DATA_PATH}"
|
||||||
|
|
||||||
echo "Destroyed ${CONTAINER_NAME} and all data."
|
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
|
#!/bin/bash
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${SCRIPT_DIR}/_volumes.sh"
|
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||||
_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..."
|
_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}"
|
# Export variables for docker compose
|
||||||
_remove_container "$CONTAINER_NAME" || _die "Failed to remove container ${CONTAINER_NAME}"
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
bash ./start.sh || _die "Failed to start container ${CONTAINER_NAME}"
|
|
||||||
|
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 "Installation of ${CONTAINER_NAME} complete"
|
||||||
|
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
_check_required_env_vars "CONTAINER_NAME"
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
# LOGS SCRIPT
|
# Export variables for docker compose
|
||||||
# Shows the container logs
|
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:"
|
echo "Container ${CONTAINER_NAME} logs:"
|
||||||
_grey_start
|
_grey_start
|
||||||
docker logs "${CONTAINER_NAME}" "$@"
|
docker compose logs "$@"
|
||||||
_grey_end
|
_grey_end
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
source "${SCRIPT_DIR}/_volumes.sh"
|
source "${SCRIPT_DIR}/_volumes.sh"
|
||||||
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
_check_required_env_vars "CONTAINER_NAME" "DATA_PATH"
|
||||||
|
|
||||||
# RESTORE SCRIPT
|
# Export variables for docker compose
|
||||||
# Restores Wiki.js data from a backup
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
|
|
||||||
# Uninstall container before restore
|
cd "$SCRIPT_DIR"
|
||||||
./uninstall.sh || _die "Failed to uninstall service before restore"
|
|
||||||
|
# Stop containers before restore
|
||||||
|
docker compose down
|
||||||
|
|
||||||
# Restore data from backup file
|
# Restore data from backup file
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
|
|||||||
@@ -2,7 +2,5 @@
|
|||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
_check_required_env_vars "CONTAINER_NAME"
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
# SSH SCRIPT
|
# SSH into the wikijs container
|
||||||
# Opens a shell inside the container
|
|
||||||
|
|
||||||
docker exec -it "${CONTAINER_NAME}" /bin/bash
|
docker exec -it "${CONTAINER_NAME}" /bin/bash
|
||||||
|
|||||||
@@ -1,31 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source "${AGENT_PATH}/common.sh"
|
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
|
# Export variables for docker compose
|
||||||
# The start script is required for all templates.
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
# It is used to start the service on the server.
|
|
||||||
|
|
||||||
DOCKER_RUN_CMD="docker run -d \
|
cd "$SCRIPT_DIR"
|
||||||
--restart unless-stopped \
|
docker compose up -d || _die "Failed to start containers"
|
||||||
--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
|
|
||||||
|
|
||||||
echo "Container ${CONTAINER_NAME} started"
|
echo "Container ${CONTAINER_NAME} started"
|
||||||
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|
echo "Access Wiki.js at http://localhost:${HTTP_PORT}"
|
||||||
|
|||||||
@@ -2,30 +2,13 @@
|
|||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
_check_required_env_vars "CONTAINER_NAME"
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
# STATUS SCRIPT
|
# Check if main wikijs container is running
|
||||||
# The status script is REQUIRED.
|
if docker ps --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||||
# It is used to return the status of the service.
|
echo "Running"
|
||||||
# Must output exactly one of: Running, Stopped, Error, Unknown
|
else
|
||||||
|
if docker ps -a --format "{{.Names}}" | grep -q "^${CONTAINER_NAME}$"; then
|
||||||
# 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"
|
echo "Stopped"
|
||||||
;;
|
else
|
||||||
restarting|paused)
|
|
||||||
echo "Error"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown"
|
echo "Unknown"
|
||||||
;;
|
fi
|
||||||
esac
|
fi
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source "${AGENT_PATH}/common.sh"
|
source "${AGENT_PATH}/common.sh"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
_check_required_env_vars "CONTAINER_NAME"
|
_check_required_env_vars "CONTAINER_NAME"
|
||||||
|
|
||||||
# STOP SCRIPT
|
# Export variables for docker compose
|
||||||
# The stop script is required for all templates.
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
# It is used to stop the service on the server.
|
|
||||||
|
|
||||||
_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"
|
echo "Container ${CONTAINER_NAME} stopped"
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source "${AGENT_PATH}/common.sh"
|
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
|
# Export variables for docker compose
|
||||||
# The uninstall script is required for all templates.
|
export CONTAINER_NAME DATA_PATH HTTP_PORT PUID PGID TZ IMAGE_TAG DB_NAME DB_USER DB_PASS
|
||||||
# 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}"
|
cd "$SCRIPT_DIR"
|
||||||
_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
|
# Stop and remove containers (but preserve volumes/data)
|
||||||
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
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 "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