From edd010e04e7ee9765507f51ac75cc307fa16b1ec Mon Sep 17 00:00:00 2001 From: freakms <37141351+freakms@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:29:40 +0100 Subject: [PATCH 1/3] feat: add XWiki --- ct/xwiki.sh | 73 ++++++++++++++++++++++++++++++++++++ install/xwiki-install.sh | 80 ++++++++++++++++++++++++++++++++++++++++ json/xwiki.json | 52 ++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 ct/xwiki.sh create mode 100644 install/xwiki-install.sh create mode 100644 json/xwiki.json diff --git a/ct/xwiki.sh b/ct/xwiki.sh new file mode 100644 index 0000000000..b160d1f185 --- /dev/null +++ b/ct/xwiki.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: freakms +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://www.xwiki.org + +APP="XWiki" +var_tags="${var_tags:-wiki}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-16}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" +# amd64 only: the XWiki Debian packages are architecture independent, but +# they are not tested on arm64 yet. +var_arm64="${var_arm64:-no}" + +# Read by install/xwiki-install.sh +export var_xwiki_db="${var_xwiki_db:-pgsql}" +export var_xwiki_channel="${var_xwiki_channel:-stable}" +export var_xwiki_xmx="${var_xwiki_xmx:-}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /etc/xwiki/xwiki.cfg ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Stopping ${APP}" + systemctl stop tomcat10 + msg_ok "Stopped ${APP}" + + msg_info "Backing up ${APP} configuration" + mkdir -p /opt/xwiki_backup + cp -a /etc/xwiki "/opt/xwiki_backup/etc-xwiki-$(date +%F)" + msg_ok "Backed up ${APP} configuration" + + msg_info "Updating ${APP}" + export DEBIAN_FRONTEND=noninteractive + mapfile -t XWIKI_PKGS < <(dpkg-query -W -f='${Package}\n' 'xwiki-*') + $STD apt update + $STD apt install -y --only-upgrade -o Dpkg::Options::=--force-confold "${XWIKI_PKGS[@]}" + msg_ok "Updated ${APP}" + + msg_info "Starting ${APP}" + systemctl start tomcat10 + msg_ok "Started ${APP}" + msg_ok "Updated successfully! After a major upgrade, open ${APP} in the browser and finish the Distribution Wizard." + exit +} + +start +build_container +description + +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/xwiki${CL}" diff --git a/install/xwiki-install.sh b/install/xwiki-install.sh new file mode 100644 index 0000000000..a23795d30a --- /dev/null +++ b/install/xwiki-install.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: freakms +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://www.xwiki.org + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +XWIKI_DB="${var_xwiki_db:-pgsql}" +XWIKI_CHANNEL="${var_xwiki_channel:-stable}" +XWIKI_XMX="${var_xwiki_xmx:-}" + +if [[ "$XWIKI_DB" != "pgsql" && "$XWIKI_DB" != "mariadb" ]]; then + msg_error "var_xwiki_db must be pgsql or mariadb (given: ${XWIKI_DB})" + exit 1 +fi +if [[ "$XWIKI_CHANNEL" != "stable" && "$XWIKI_CHANNEL" != "lts" ]]; then + msg_error "var_xwiki_channel must be stable or lts (given: ${XWIKI_CHANNEL})" + exit 1 +fi + +# The database server must exist before the XWiki package, so that +# dbconfig-common can create the database and user. +if [[ "$XWIKI_DB" == "pgsql" ]]; then + setup_postgresql +else + setup_mariadb +fi + +msg_info "Adding XWiki Repository (${XWIKI_CHANNEL})" +curl -fsSL https://maven.xwiki.org/xwiki-keyring.gpg -o /usr/share/keyrings/xwiki-keyring.gpg +curl -fsSL "https://maven.xwiki.org/${XWIKI_CHANNEL}/xwiki-${XWIKI_CHANNEL}.list" -o "/etc/apt/sources.list.d/xwiki-${XWIKI_CHANNEL}.list" +$STD apt update +msg_ok "Added XWiki Repository" + +debconf-set-selections <>/etc/default/tomcat10 +JAVA_OPTS="-Djava.awt.headless=true -Xmx${XWIKI_XMX}m -XX:+UseG1GC" +EOF +systemctl restart tomcat10 +msg_ok "Configured Java Heap (${XWIKI_XMX} MiB)" + +msg_info "Waiting for XWiki to start (this can take a few minutes)" +for _ in $(seq 1 90); do + HTTP_CODE="$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8080/xwiki/ || true)" + [[ "$HTTP_CODE" =~ ^(200|302|303)$ ]] && break + sleep 5 +done +if [[ "$HTTP_CODE" =~ ^(200|302|303)$ ]]; then + msg_ok "XWiki is running" +else + msg_error "XWiki did not answer (HTTP ${HTTP_CODE}). Check: journalctl -u tomcat10" + exit 1 +fi + +motd_ssh +customize +cleanup_lxc diff --git a/json/xwiki.json b/json/xwiki.json new file mode 100644 index 0000000000..a612ea50f6 --- /dev/null +++ b/json/xwiki.json @@ -0,0 +1,52 @@ +{ + "name": "XWiki", + "slug": "xwiki", + "categories": [12], + "date_created": "2026-11-10", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8080, + "documentation": "https://www.xwiki.org/xwiki/bin/view/Documentation/", + "website": "https://www.xwiki.org/", + "repository": "https://github.com/xwiki/xwiki-platform", + "architectures": ["amd64"], + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/xwiki.webp", + "description": "XWiki is a free, open source wiki platform written in Java. It offers structured data, applications inside the wiki, a powerful extension system and fine-grained permissions, and is a common alternative to Confluence.", + "install_methods": [ + { + "type": "default", + "script": "ct/xwiki.sh", + "config_path": "/etc/xwiki/xwiki.cfg", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 16, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "On first start open http://:8080/xwiki/ and finish the Distribution Wizard: create the admin account and install the XWiki Standard flavor. This takes a few minutes.", + "type": "info" + }, + { + "text": "The database (PostgreSQL by default, MariaDB optional) and its random password are created by the Debian package; the connection is stored in /etc/xwiki/hibernate.cfg.xml.", + "type": "info" + }, + { + "text": "The Java heap is set to about 60 % of the container RAM in /etc/default/tomcat10. XWiki needs at least 2 GiB, 4 GiB is recommended.", + "type": "info" + }, + { + "text": "Take a snapshot or backup before updating; major XWiki upgrades finish with the Distribution Wizard in the browser.", + "type": "warning" + } + ] +} From c3eefdb08a45ae5bf84376b5686e97120b5b3d09 Mon Sep 17 00:00:00 2001 From: freakms <37141351+freakms@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:58:19 +0100 Subject: [PATCH 2/3] fix(xwiki): only upgrade installed packages --- ct/xwiki.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/xwiki.sh b/ct/xwiki.sh index b160d1f185..1268894941 100644 --- a/ct/xwiki.sh +++ b/ct/xwiki.sh @@ -51,7 +51,7 @@ function update_script() { msg_info "Updating ${APP}" export DEBIAN_FRONTEND=noninteractive - mapfile -t XWIKI_PKGS < <(dpkg-query -W -f='${Package}\n' 'xwiki-*') + mapfile -t XWIKI_PKGS < <(dpkg-query -W -f='${db:Status-Abbrev} ${Package}\n' 'xwiki-*' 2>/dev/null | awk '$1 == "ii" {print $2}') $STD apt update $STD apt install -y --only-upgrade -o Dpkg::Options::=--force-confold "${XWIKI_PKGS[@]}" msg_ok "Updated ${APP}" From d0c098b55484e4c9325d2a275a1da4bf650b35a9 Mon Sep 17 00:00:00 2001 From: freakms <37141351+freakms@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:21:35 +0100 Subject: [PATCH 3/3] fix(xwiki): use app name in update messages --- ct/xwiki.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ct/xwiki.sh b/ct/xwiki.sh index 1268894941..3c3452560e 100644 --- a/ct/xwiki.sh +++ b/ct/xwiki.sh @@ -36,30 +36,30 @@ function update_script() { check_container_resources if [[ ! -f /etc/xwiki/xwiki.cfg ]]; then - msg_error "No ${APP} Installation Found!" + msg_error "No XWiki Installation Found!" exit fi - msg_info "Stopping ${APP}" + msg_info "Stopping XWiki" systemctl stop tomcat10 - msg_ok "Stopped ${APP}" + msg_ok "Stopped XWiki" - msg_info "Backing up ${APP} configuration" + msg_info "Backing up XWiki configuration" mkdir -p /opt/xwiki_backup cp -a /etc/xwiki "/opt/xwiki_backup/etc-xwiki-$(date +%F)" - msg_ok "Backed up ${APP} configuration" + msg_ok "Backed up XWiki configuration" - msg_info "Updating ${APP}" + msg_info "Updating XWiki" export DEBIAN_FRONTEND=noninteractive mapfile -t XWIKI_PKGS < <(dpkg-query -W -f='${db:Status-Abbrev} ${Package}\n' 'xwiki-*' 2>/dev/null | awk '$1 == "ii" {print $2}') $STD apt update $STD apt install -y --only-upgrade -o Dpkg::Options::=--force-confold "${XWIKI_PKGS[@]}" - msg_ok "Updated ${APP}" + msg_ok "Updated XWiki" - msg_info "Starting ${APP}" + msg_info "Starting XWiki" systemctl start tomcat10 - msg_ok "Started ${APP}" - msg_ok "Updated successfully! After a major upgrade, open ${APP} in the browser and finish the Distribution Wizard." + msg_ok "Started XWiki" + msg_ok "Updated successfully! After a major upgrade, open XWiki in the browser and finish the Distribution Wizard." exit }