From c75af3a7508383e51ccc43513e2805106e3ceaa0 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:35:24 +0200 Subject: [PATCH] ONLYOFFICE Docs (#5420) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 'Add new script' * Update install/onlyoffice-install.sh * Update onlyoffice-install.sh * add info for credentials * Update onlyoffice.sh * curl * naming --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/headers/onlyoffice | 6 ++ ct/onlyoffice.sh | 52 ++++++++++++++ frontend/public/json/onlyoffice.json | 40 +++++++++++ install/onlyoffice-install.sh | 103 +++++++++++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 ct/headers/onlyoffice create mode 100644 ct/onlyoffice.sh create mode 100644 frontend/public/json/onlyoffice.json create mode 100644 install/onlyoffice-install.sh diff --git a/ct/headers/onlyoffice b/ct/headers/onlyoffice new file mode 100644 index 000000000..448440cd0 --- /dev/null +++ b/ct/headers/onlyoffice @@ -0,0 +1,6 @@ + ____ __ ____ _________ + / __ \____ / /_ __/ __ \/ __/ __(_)_______ + / / / / __ \/ / / / / / / / /_/ /_/ / ___/ _ \ +/ /_/ / / / / / /_/ / /_/ / __/ __/ / /__/ __/ +\____/_/ /_/_/\__, /\____/_/ /_/ /_/\___/\___/ + /____/ diff --git a/ct/onlyoffice.sh b/ct/onlyoffice.sh new file mode 100644 index 000000000..7e06d0067 --- /dev/null +++ b/ct/onlyoffice.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.onlyoffice.com/ + +APP="ONLYOFFICE Docs" +var_tags="${var_tags:-word;excel;powerpoint;pdf}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-10}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /var/www/onlyoffice ]]; then + msg_error "No valid ${APP} installation found!" + exit 1 + fi + + msg_info "Updating $APP" + $STD apt-get update + $STD apt-get -y --only-upgrade install onlyoffice-documentserver + msg_ok "Updated $APP" + + if systemctl is-enabled --quiet onlyoffice-documentserver; then + msg_info "Restarting $APP" + $STD systemctl restart onlyoffice-documentserver + msg_ok "$APP restarted" + fi + 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}${CL}" diff --git a/frontend/public/json/onlyoffice.json b/frontend/public/json/onlyoffice.json new file mode 100644 index 000000000..5a73e4f44 --- /dev/null +++ b/frontend/public/json/onlyoffice.json @@ -0,0 +1,40 @@ +{ + "name": "ONLYOFFICE Docs", + "slug": "onlyoffice", + "categories": [ + 9 + ], + "date_created": "2025-06-17", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://helpcenter.onlyoffice.com/docs", + "website": "https://onlyoffice.com/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/onlyoffice.webp", + "config_path": "/etc/onlyoffice/documentserver/local.json", + "description": "ONLYOFFICE Docs is an open-source online office suite that provides collaborative editors for text documents, spreadsheets, and presentations, fully compatible with Microsoft Office formats (DOCX, XLSX, PPTX).", + "install_methods": [ + { + "type": "default", + "script": "ct/onlyoffice.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 10, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "admin", + "password": "admin" + }, + "notes": [ + { + "text": "Database / RabbitMQ Credentials: `cat ~/onlyoffice.creds`", + "type": "info" + } + ] +} diff --git a/install/onlyoffice-install.sh b/install/onlyoffice-install.sh new file mode 100644 index 000000000..96b941f61 --- /dev/null +++ b/install/onlyoffice-install.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 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-get install -y \ + nginx \ + rabbitmq-server \ + ca-certificates \ + software-properties-common +msg_ok "Installed Dependencies" + +PG_VERSION="16" setup_postgresql + +msg_info "Setup Database" +DB_NAME=onlyoffice +DB_USER=onlyoffice_user +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +{ + echo "ONLYOFFICE-Credentials" + echo "ONLYOFFICE Database User: $DB_USER" + echo "ONLYOFFICE Database Password: $DB_PASS" + echo "ONLYOFFICE Database Name: $DB_NAME" +} >>~/onlyoffice.creds +msg_ok "Set up Database" + +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 + echo "deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] https://download.onlyoffice.com/repo/debian squeeze main" >/etc/apt/sources.list.d/onlyoffice.list + $STD apt-get update + 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 1 +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) + +echo onlyoffice-documentserver onlyoffice/db-host string localhost | debconf-set-selections +echo onlyoffice-documentserver onlyoffice/db-user string $DB_USER | debconf-set-selections +echo onlyoffice-documentserver onlyoffice/db-pwd password $DB_PASS | debconf-set-selections +echo onlyoffice-documentserver onlyoffice/db-name string $DB_NAME | 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 + +echo "RabbitMQ User: $RMQ_USER" >>~/onlyoffice.creds +echo "RabbitMQ Password: $RMQ_PASS" >>~/onlyoffice.creds +echo "JWT Secret: $JWT_SECRET" >>~/onlyoffice.creds +{ + echo "" + echo "ONLYOFFICE RabbitMQ Credentials" + echo "User: $RMQ_USER" + echo "Password: $RMQ_PASS" + echo "Secret: $JWT_SECRET" +} >>~/onlyoffice.creds +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-get install -y ttf-mscorefonts-installer +msg_ok "Installed Microsoft Core Fonts" + +msg_info "Installing ONLYOFFICE Docs" +$STD apt-get install -y onlyoffice-documentserver +msg_ok "ONLYOFFICE Docs Installed" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"