This commit is contained in:
CanbiZ
2025-06-24 15:42:13 +02:00
5 changed files with 205 additions and 0 deletions

View File

@ -16,6 +16,10 @@ All LXC instances created using this repository come pre-installed with Midnight
## 2025-06-24
### 🆕 New Scripts
- ONLYOFFICE Docs ([#5420](https://github.com/community-scripts/ProxmoxVE/pull/5420))
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes

6
ct/headers/onlyoffice Normal file
View File

@ -0,0 +1,6 @@
____ _ ______ ______ ____________________________ ____
/ __ \/ | / / /\ \/ / __ \/ ____/ ____/ _/ ____/ ____/ / __ \____ __________
/ / / / |/ / / \ / / / / /_ / /_ / // / / __/ / / / / __ \/ ___/ ___/
/ /_/ / /| / /___/ / /_/ / __/ / __/ _/ // /___/ /___ / /_/ / /_/ / /__(__ )
\____/_/ |_/_____/_/\____/_/ /_/ /___/\____/_____/ /_____/\____/\___/____/

52
ct/onlyoffice.sh Normal file
View File

@ -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}"

40
frontend/public/json/onlyoffice.json generated Normal file
View File

@ -0,0 +1,40 @@
{
"name": "ONLYOFFICE Docs",
"slug": "onlyoffice",
"categories": [
9
],
"date_created": "2025-06-24",
"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"
}
]
}

View File

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