Compare commits

..

No commits in common. "c226f924ec40d8bb58470994a361f3f0c74e0b1b" and "d6214cf9da2888a83be063e39a10fefb3c494ff9" have entirely different histories.

3 changed files with 50 additions and 95 deletions

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/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
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"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

View File

@ -144,13 +144,11 @@ if [ "$STORAGE_FREE" -lt "$REQUIRED_KB" ]; then
fi
# Check Cluster Quorum if in Cluster
if [ -f /etc/pve/corosync.conf ]; then
if ! pvecm status | grep -q "Quorate: Yes"; then
if ! pvecm status | awk '/^Quorate:/ {exit $2 != "Yes"}'; then
printf "\e[?25h"
echo -e "\n${CROSS}${RD}Cluster is not quorate. Start all nodes or configure quorum device (QDevice).${CL}\n"
exit 210
fi
fi
# Update LXC template list
$STD msg_info "Updating LXC Template List"

View File

@ -737,9 +737,9 @@ function setup_mongodb() {
function fetch_and_deploy_gh_release() {
local app="$1"
local repo="$2"
local mode="${3:-tarball}" # tarball | binary | prebuild | singlefile
local version="${4:-latest}"
local target="${5:-/opt/$app}"
local mode="${3:-tarball}" # tarball | binary | prebuild
local version="${4:-latest}" # optional, default "latest"
local target="${5:-/opt/$app}" # optional target dir
local app_lc=$(echo "${app,,}" | tr -d ' ')
local version_file="$HOME/.${app_lc}"
@ -748,11 +748,10 @@ function fetch_and_deploy_gh_release() {
local current_version=""
if [[ -f "$version_file" ]]; then
current_version=$(<"$version_file")
$STD msg_info "Current installed version of $app: $current_version"
$STD msg_info "Current version: $current_version"
fi
if ! command -v jq &>/dev/null; then
$STD msg_info "Installing jq..."
$STD apt-get install -y jq &>/dev/null
fi
@ -769,22 +768,21 @@ function fetch_and_deploy_gh_release() {
msg_error "Failed to fetch release: HTTP $http_code"
return 1
}
local json tag_name
local json
json=$(</tmp/gh_rel.json)
local tag_name
tag_name=$(echo "$json" | jq -r '.tag_name // .name // empty')
[[ "$tag_name" =~ ^v ]] && version="${tag_name:1}" || version="$tag_name"
if [[ "$current_version" == "$version" ]]; then
$STD msg_info "$app is already up-to-date (v$version)"
$STD msg_info "Already on latest version ($version)"
return 0
fi
$STD msg_info "Preparing to deploy $app v$version (mode: $mode)..."
local tmpdir
tmpdir=$(mktemp -d) || return 1
local filename="" url=""
local filename=""
local url=""
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
url=$(echo "$json" | jq -r '.tarball_url // empty')
@ -807,8 +805,6 @@ function fetch_and_deploy_gh_release() {
cp -r "$unpack_dir"/* "$target/"
shopt -u dotglob nullglob
$STD msg_ok "$app (tarball) deployed to $target"
elif [[ "$mode" == "binary" ]]; then
local arch
arch=$(dpkg --print-architecture 2>/dev/null || uname -m)
@ -818,6 +814,7 @@ function fetch_and_deploy_gh_release() {
local assets url_match=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
# 1. Try to match by exact architecture (e.g. x86_64, amd64, arm64)
for u in $assets; do
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then
url_match="$u"
@ -825,9 +822,13 @@ function fetch_and_deploy_gh_release() {
fi
done
# 2. If no Arch mapping, use the first .deb in the asset listing
if [[ -z "$url_match" ]]; then
for u in $assets; do
[[ "$u" =~ \.deb$ ]] && url_match="$u" && break
if [[ "$u" =~ \.deb$ ]]; then
url_match="$u"
break
fi
done
fi
@ -838,47 +839,49 @@ function fetch_and_deploy_gh_release() {
fi
filename="${url_match##*/}"
$STD msg_info "Downloading binary package: $filename"
$STD msg_info "Downloading binary .deb: $url_match"
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$url_match" || {
msg_error "Download failed: $url_match"
rm -rf "$tmpdir"
return 1
}
$STD msg_info "Installing $filename via apt"
chmod 644 "$tmpdir/$filename"
$STD msg_info "Installing $filename via apt..."
$STD apt-get install -y "$tmpdir/$filename" || {
$STD msg_info "apt failed, falling back to dpkg -i..."
$STD msg_info "Falling back to dpkg -i"
dpkg -i "$tmpdir/$filename" || {
msg_error "Both apt and dpkg installation failed"
msg_error "Both apt and dpkg install failed"
rm -rf "$tmpdir"
return 1
}
}
$STD msg_ok "$app (.deb binary) installed successfully"
elif [[ "$mode" == "prebuild" ]]; then
local pattern="$6"
[[ -z "$pattern" ]] && {
if [[ -z "$pattern" ]]; then
msg_error "Mode 'prebuild' requires 6th parameter (asset filename pattern)"
rm -rf "$tmpdir"
return 1
}
fi
local asset_url=""
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
[[ "$u" =~ $pattern || "$u" == *"$pattern" ]] && asset_url="$u" && break
local assets asset_url=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
for u in $assets; do
if [[ "$u" =~ $pattern || "$u" == *"$pattern" ]]; then
asset_url="$u"
break
fi
done
[[ -z "$asset_url" ]] && {
msg_error "No asset matching '$pattern' found"
if [[ -z "$asset_url" ]]; then
msg_error "No asset matching pattern '$pattern' found"
rm -rf "$tmpdir"
return 1
}
fi
filename="${asset_url##*/}"
$STD msg_info "Downloading prebuilt asset: $filename"
$STD msg_info "Downloading prebuilt asset: $asset_url"
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
msg_error "Download failed: $asset_url"
rm -rf "$tmpdir"
@ -888,7 +891,6 @@ function fetch_and_deploy_gh_release() {
mkdir -p "$target"
if [[ "$filename" == *.zip ]]; then
if ! command -v unzip &>/dev/null; then
$STD msg_info "Installing unzip..."
$STD apt-get install -y unzip
fi
unzip "$tmpdir/$filename" -d "$target"
@ -900,30 +902,32 @@ function fetch_and_deploy_gh_release() {
return 1
fi
$STD msg_ok "$app (prebuilt) extracted to $target"
elif [[ "$mode" == "singlefile" ]]; then
local pattern="$6"
[[ -z "$pattern" ]] && {
if [[ -z "$pattern" ]]; then
msg_error "Mode 'singlefile' requires 6th parameter (asset filename pattern)"
rm -rf "$tmpdir"
return 1
}
fi
local asset_url=""
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
[[ "$u" =~ $pattern || "$u" == *"$pattern" ]] && asset_url="$u" && break
local assets asset_url=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
for u in $assets; do
if [[ "$u" =~ $pattern || "$u" == *"$pattern" ]]; then
asset_url="$u"
break
fi
done
[[ -z "$asset_url" ]] && {
msg_error "No asset matching '$pattern' found"
if [[ -z "$asset_url" ]]; then
msg_error "No asset matching pattern '$pattern' found"
rm -rf "$tmpdir"
return 1
}
fi
filename="${asset_url##*/}"
mkdir -p "$target"
$STD msg_info "Downloading single binary: $filename"
$STD msg_info "Downloading single binary: $asset_url"
curl $curl_timeout -fsSL -o "$target/$app" "$asset_url" || {
msg_error "Download failed: $asset_url"
rm -rf "$tmpdir"
@ -931,7 +935,6 @@ function fetch_and_deploy_gh_release() {
}
chmod +x "$target/$app"
$STD msg_ok "$app (single binary) installed to $target"
else
msg_error "Unknown mode: $mode"
@ -940,7 +943,7 @@ function fetch_and_deploy_gh_release() {
fi
echo "$version" >"$version_file"
$STD msg_ok "$app v$version deployed successfully"
$STD msg_ok "$app deployed (version: $version)"
rm -rf "$tmpdir"
}