#!/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 </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=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-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 <>~/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