Files
ProxmoxVE/install/onlyoffice-install.sh
T
CanbiZ (MickLesk) 7f57d0998c Refactor/core qol adoption (#17655)
* Scripts: close every msg_info block with msg_ok

Past-tense msg_info calls that should have been msg_ok, notices that opened a block before a prompt, and blocks without a closing msg_ok. These already left a stale spinner; with core's block stack they would resume it after every later msg_ok.

* Generate passwords with random_password

openssl rand -base64 | tr -dc | head -c returned fewer characters than asked for, and the unfiltered | cut variants put / and + into passwords that end up in DSNs and sed expressions. Secrets an app decodes as base64 are unchanged. Requires community-scripts/core#61.

* Keep data directories through CLEAN_INSTALL instead of copying them

create_backup copied uploads, storage and similar directories twice per update and needed their size again in free space. CLEAN_INSTALL_KEEP moves them aside instead. Only directories the upstream release does not ship, in scripts that restored right after the fetch. Requires community-scripts/core#61.

* Drop the 300s uv timeout overrides

setup_uv exports UV_HTTP_TIMEOUT=600 now; the scripts' 300 only lowered it. Requires community-scripts/core#61.
2026-10-03 08:19:10 +02:00

90 lines
3.1 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
nginx \
rabbitmq-server \
ca-certificates
msg_ok "Installed Dependencies"
PG_VERSION="16" setup_postgresql
PG_DB_NAME="onlyoffice" PG_DB_USER="onlyoffice_user" setup_postgresql_db
msg_info "Adding ONLYOFFICE GPG Key"
GPG_TMP="/tmp/onlyoffice.gpg"
KEY_URL="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
TMP_KEY_CONTENT=$(mktemp)
if curl -fsSL "$KEY_URL" -o "$TMP_KEY_CONTENT" && grep -q "BEGIN PGP PUBLIC KEY BLOCK" "$TMP_KEY_CONTENT"; then
gpg --quiet --batch --yes --no-default-keyring --keyring "gnupg-ring:$GPG_TMP" --import "$TMP_KEY_CONTENT" >/dev/null 2>&1
chmod 644 "$GPG_TMP"
chown root:root "$GPG_TMP"
mv "$GPG_TMP" /usr/share/keyrings/onlyoffice.gpg
cat <<EOF >/etc/apt/sources.list.d/onlyoffice.sources
Types: deb
URIs: https://download.onlyoffice.com/repo/debian
Suites: squeeze
Components: main
Signed-By: /usr/share/keyrings/onlyoffice.gpg
EOF
apt_update_safe
msg_ok "GPG Key Added"
else
msg_error "Failed to download or verify GPG key from $KEY_URL"
[[ -f "$TMP_KEY_CONTENT" ]] && rm -f "$TMP_KEY_CONTENT"
exit 250
fi
rm -f "$TMP_KEY_CONTENT"
msg_info "Preconfiguring ONLYOFFICE Debconf Settings"
RMQ_USER=onlyoffice_rmq
RMQ_PASS=$(random_password 13)
JWT_SECRET=$(openssl rand -hex 16)
$STD rabbitmqctl add_user $RMQ_USER $RMQ_PASS
$STD rabbitmqctl set_permissions -p / $RMQ_USER ".*" ".*" ".*"
$STD rabbitmqctl set_user_tags $RMQ_USER administrator
echo onlyoffice-documentserver onlyoffice/db-host string localhost | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string onlyoffice_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $PG_DB_PASS | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string onlyoffice | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/rabbitmq-host string localhost | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/rabbitmq-user string $RMQ_USER | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/rabbitmq-pwd password $RMQ_PASS | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-enabled boolean true | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-secret password $JWT_SECRET | debconf-set-selections
cat <<EOF >>~/onlyoffice.creds
ONLYOFFICE RabbitMQ Credentials
User: $RMQ_USER
Password: $RMQ_PASS
Secret: $JWT_SECRET
EOF
msg_ok "Debconf Preconfiguration Done"
msg_info "Installing ttf-mscorefonts-installer"
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
$STD apt install -y ttf-mscorefonts-installer
msg_ok "Installed Microsoft Core Fonts"
msg_info "Installing ONLYOFFICE Docs"
$STD apt install -y onlyoffice-documentserver
msg_ok "ONLYOFFICE Docs Installed"
motd_ssh
customize
cleanup_lxc