Skip to content
Open

xwiki #2519

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions ct/xwiki.sh
Original file line number Diff line number Diff line change
@@ -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 XWiki Installation Found!"
exit
fi

msg_info "Stopping XWiki"
systemctl stop tomcat10
msg_ok "Stopped XWiki"

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 XWiki configuration"

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 XWiki"

msg_info "Starting XWiki"
systemctl start tomcat10
msg_ok "Started XWiki"
msg_ok "Updated successfully! After a major upgrade, open XWiki 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}"
80 changes: 80 additions & 0 deletions install/xwiki-install.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
dbconfig-common dbconfig-common/dbconfig-install boolean true
dbconfig-common dbconfig-common/remember-admin-pass boolean false
EOF

msg_info "Installing XWiki (Tomcat 10, ${XWIKI_DB})"
export DEBIAN_FRONTEND=noninteractive
$STD apt install -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold "xwiki-tomcat10-${XWIKI_DB}"
msg_ok "Installed XWiki"

msg_info "Configuring Java Heap"
if [[ -z "$XWIKI_XMX" ]]; then
XWIKI_XMX=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo) / 1024 * 60 / 100))
fi
[[ "$XWIKI_XMX" -ge 1024 ]] || XWIKI_XMX=1024
sed -i 's/^\(JAVA_OPTS=.*\)$/#\1/' /etc/default/tomcat10
cat <<EOF >>/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
52 changes: 52 additions & 0 deletions json/xwiki.json
Original file line number Diff line number Diff line change
@@ -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://<IP>: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"
}
]
}
Loading