2026-02-05 14:16:36 +01:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2026-02-24 15:11:53 +01:00
# Source: https://opencloud.eu | Github: https://github.com/opencloud-eu/opencloud
2026-02-05 14:16:36 +01:00
source /dev/stdin <<< " $FUNCTIONS_FILE_PATH "
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
MAX_ATTEMPTS = 3
servers =( "opencloud" "collabora" "wopi" )
attempt = 0
for server in " ${ servers [@] } " ; do
2026-10-24 17:55:50 +02:00
fqdn_var = "var_opencloud_ ${ server } _fqdn"
fqdn = " ${ !fqdn_var :- } "
2026-02-05 14:16:36 +01:00
until (( attempt >= MAX_ATTEMPTS)) ; do
attempt = $(( attempt + 1 ))
2026-10-24 17:55:50 +02:00
[[ -n " $fqdn " ]] || read -rp " ${ TAB3 } Enter the FQDN of your ${ server ^ } server (ATTEMPT $attempt / $MAX_ATTEMPTS ) (eg $server .domain.tld): " fqdn || { msg_error "No ${ server ^ } FQDN given; set ${ fqdn_var } or answer the prompt" ; exit 64; }
2026-02-05 14:16:36 +01:00
if [[ -z " $fqdn " ]] ; then
msg_warn "Domain cannot be empty!"
elif [[ " $fqdn " = ~ ^([ 0-9]{ 1,3} \. ){ 3}[ 0-9]{ 1,3} $ ]] ; then
msg_warn "IP address not allowed! Please use a FQDN"
2026-10-24 17:55:50 +02:00
fqdn = ""
2026-02-05 14:16:36 +01:00
elif [[ " $fqdn " = ~ ^[ a-zA-Z0-9]([ a-zA-Z0-9-]{ 0,61}[ a-zA-Z0-9]) ?( \. [ a-zA-Z0-9]([ a-zA-Z0-9-]{ 0,61}[ a-zA-Z0-9]) ?) *\. [ a-zA-Z]{ 2,} $ ]] ; then
export ${ server ^^ } _FQDN = " $fqdn "
attempt = 0
break
else
msg_warn "Invalid domain format!"
2026-10-24 17:55:50 +02:00
fqdn = ""
2026-02-05 14:16:36 +01:00
fi
done
if (( attempt >= MAX_ATTEMPTS)) ; then
msg_error "No more attempts - aborting script!"
2026-03-02 13:57:42 +01:00
exit 254
2026-02-05 14:16:36 +01:00
fi
done
2026-02-11 16:30:09 -05:00
msg_info "Installing dependencies"
$STD apt install -y inotify-tools
msg_ok "Installed dependencies"
2026-02-05 14:16:36 +01:00
msg_info "Installing Collabora Online"
curl -fsSL https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg -o /etc/apt/keyrings/collaboraonline-release-keyring.gpg
cat <<EOF >/etc/apt/sources.list.d/colloboraonline.sources
Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb
Suites: ./
Signed-By: /etc/apt/keyrings/collaboraonline-release-keyring.gpg
EOF
2026-09-24 08:06:49 +02:00
apt_update_safe
2026-10-01 08:14:33 +02:00
$STD apt install -y coolwsd code-brand
2026-02-05 14:16:36 +01:00
systemctl stop coolwsd
mkdir -p /etc/systemd/system/coolwsd.service.d
cat <<EOF >/etc/systemd/system/coolwsd.service.d/override.conf
[Unit]
Before=opencloud-wopi.service
EOF
systemctl daemon-reload
COOLPASS = " $( openssl rand -base64 36) "
$STD sudo -u cool coolconfig set-admin-password --user= admin --password= " $COOLPASS "
echo " $COOLPASS " >~/.coolpass
msg_ok "Installed Collabora Online"
2026-10-07 20:05:30 +08:00
fetch_and_deploy_gh_release "OpenCloud" "opencloud-eu/opencloud" "singlefile" "v8.1.0" "/usr/bin" "opencloud-*-linux- $( arch_resolve) "
2026-03-09 13:38:58 -04:00
mv /usr/bin/OpenCloud /usr/bin/opencloud
2026-02-05 14:16:36 +01:00
msg_info "Configuring OpenCloud"
2026-02-06 02:01:20 -05:00
DATA_DIR = "/var/lib/opencloud"
2026-02-05 14:16:36 +01:00
CONFIG_DIR = "/etc/opencloud"
ENV_FILE = " ${ CONFIG_DIR } /opencloud.env"
2026-02-06 02:01:20 -05:00
mkdir -p " $DATA_DIR " " $CONFIG_DIR " /web/assets/{ apps,themes}
2026-02-05 14:16:36 +01:00
curl -fsSL https://raw.githubusercontent.com/opencloud-eu/opencloud-compose/refs/heads/main/config/opencloud/csp.yaml -o " $CONFIG_DIR " /csp.yaml
curl -fsSL https://raw.githubusercontent.com/opencloud-eu/opencloud-compose/refs/heads/main/config/opencloud/proxy.yaml -o " $CONFIG_DIR " /proxy.yaml.bak
cat <<EOF >"$ENV_FILE"
OC_URL=https://${OPENCLOUD_FQDN}
OC_INSECURE=false
IDM_CREATE_DEMO_USERS=false
OC_LOG_LEVEL=warning
OC_CONFIG_DIR=${CONFIG_DIR}
OC_BASE_DATA_PATH=${DATA_DIR}
STORAGE_SYSTEM_OC_ROOT=${DATA_DIR}/storage/metadata
## Web
WEB_ASSET_CORE_PATH=${CONFIG_DIR}/web/assets
WEB_ASSET_APPS_PATH=${CONFIG_DIR}/web/assets/apps
2026-02-06 02:01:20 -05:00
WEB_ASSET_THEMES_PATH=${CONFIG_DIR}/web/assets/themes
2026-02-05 14:16:36 +01:00
# WEB_UI_THEME_PATH=
2026-02-06 02:01:20 -05:00
## Uncomment below to create & modify your web UI config
# WEB_UI_CONFIG_FILE=${CONFIG_DIR}/web/config.json
2026-02-05 14:16:36 +01:00
## Frontend
FRONTEND_DISABLE_RADICALE=true
FRONTEND_GROUPWARE_ENABLED=false
GRAPH_INCLUDE_OCM_SHAREES=true
## Proxy
PROXY_TLS=false
PROXY_CSP_CONFIG_FILE_LOCATION=${CONFIG_DIR}/csp.yaml
## Collaboration - requires VALID TLS
COLLABORA_DOMAIN=${COLLABORA_FQDN}
COLLABORATION_APP_NAME="CollaboraOnline"
COLLABORATION_APP_PRODUCT="Collabora"
COLLABORATION_APP_ADDR=https://${COLLABORA_FQDN}
COLLABORATION_APP_INSECURE=false
COLLABORATION_HTTP_ADDR=0.0.0.0:9300
COLLABORATION_WOPI_SRC=https://${WOPI_FQDN}
COLLABORATION_JWT_SECRET=
## Notifications - Email settings
# NOTIFICATIONS_SMTP_HOST=
# NOTIFICATIONS_SMTP_PORT=
# NOTIFICATIONS_SMTP_SENDER=
# NOTIFICATIONS_SMTP_USERNAME=
# NOTIFICATIONS_SMTP_PASSWORD=
# NOTIFICATIONS_SMTP_AUTHENTICATION=login
## Encryption method. Possible values are 'starttls', 'ssltls' and 'none'
# NOTIFICATIONS_SMTP_ENCRYPTION=starttls
## Allow insecure connections. Defaults to false.
# NOTIFICATIONS_SMTP_INSECURE=false
## Start additional services at runtime
## Examples: notifications, antivirus etc.
## Do not uncomment unless configured above.
# OC_ADD_RUN_SERVICES="notifications"
## OpenID - via web browser
## uncomment for OpenID in general
# OC_EXCLUDE_RUN_SERVICES=idp
# OC_OIDC_ISSUER=<your auth URL>
# IDP_DOMAIN=<your auth URL>
# PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD=none
# PROXY_OIDC_REWRITE_WELLKNOWN=true
# PROXY_USER_OIDC_CLAIM=preferred_username
# PROXY_USER_CS3_CLAIM=username
## automatically create accounts
# PROXY_AUTOPROVISION_ACCOUNTS=true
# WEB_OIDC_SCOPE=openid profile email groups
# GRAPH_ASSIGN_DEFAULT_USER_ROLE=false
#
## uncomment below if using PocketID
# WEB_OIDC_CLIENT_ID=<generated in PocketID>
# WEB_OIDC_METADATA_URL=<your auth URL>/.well-known/openid-configuration
## Full Text Search - Apache Tika
## Requires a separate install of Tika - see https://community-scripts.github.io/ProxmoxVE/scripts?id=apache-tika
# SEARCH_EXTRACTOR_TYPE=tika
# FRONTEND_FULL_TEXT_SEARCH_ENABLED=true
# SEARCH_EXTRACTOR_TIKA_TIKA_URL=<your-tika-url>
2026-02-11 16:30:09 -05:00
## Uncomment below to enable PosixFS Collaborative Mode
## Increase inotify watch/instance limits on your PVE host:
### sysctl -w fs.inotify.max_user_watches=1048576
### sysctl -w fs.inotify.max_user_instances=1024
# STORAGE_USERS_POSIX_ENABLE_COLLABORATION=true
# STORAGE_USERS_POSIX_WATCH_TYPE=inotifywait
# STORAGE_USERS_POSIX_WATCH_FS=true
# STORAGE_USERS_POSIX_WATCH_PATH=<path-to-storage-or-bind-mount>
## User files location - experimental - use at your own risk! - ZFS, NFS v4.2+ supported - CIFS/SMB not supported
2026-02-05 14:16:36 +01:00
# STORAGE_USERS_POSIX_ROOT=<path-to-your-bind_mount>
EOF
cat <<EOF >/etc/systemd/system/opencloud.service
[Unit]
Description=OpenCloud server
After=network-online.target
[Service]
Type=simple
User=opencloud
Group=opencloud
EnvironmentFile=${ENV_FILE}
ExecStart=/usr/bin/opencloud server
Restart=always
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF >/etc/systemd/system/opencloud-wopi.service
[Unit]
Description=OpenCloud WOPI Server
Wants=coolwsd.service
After=opencloud.service coolwsd.service
[Service]
Type=simple
User=opencloud
Group=opencloud
EnvironmentFile=${ENV_FILE}
ExecStartPre=/bin/sleep 10
ExecStart=/usr/bin/opencloud collaboration server
Restart=always
KillSignal=SIGKILL
KillMode=mixed
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
EOF
$STD sudo -u cool coolconfig set ssl.enable false
$STD sudo -u cool coolconfig set ssl.termination true
$STD sudo -u cool coolconfig set ssl.ssl_verification true
2026-10-10 02:43:49 +08:00
$STD sudo -u cool coolconfig set net.frame_ancestors "https:// ${ OPENCLOUD_FQDN } "
2026-02-05 14:16:36 +01:00
useradd -r -M -s /usr/sbin/nologin opencloud
chown -R opencloud:opencloud " $CONFIG_DIR " " $DATA_DIR "
sudo -u opencloud opencloud init --config-path " $CONFIG_DIR " --insecure no
OPENCLOUD_SECRET = " $( sed -n '/jwt/p' " $CONFIG_DIR " /opencloud.yaml | awk '{print $2}' ) "
sed -i "s/JWT_SECRET=/& ${ OPENCLOUD_SECRET //&/ \\ & } /" " $ENV_FILE "
msg_ok "Configured OpenCloud"
msg_info "Starting services"
systemctl enable -q --now coolwsd opencloud
sleep 5
systemctl enable -q --now opencloud-wopi
msg_ok "Started services"
motd_ssh
customize
cleanup_lxc