fixes
This commit is contained in:
parent
bb25caa24d
commit
51c51f1f36
46
install/onlyoffice-install.sh
Normal file
46
install/onlyoffice-install.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/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"
|
@ -144,10 +144,12 @@ if [ "$STORAGE_FREE" -lt "$REQUIRED_KB" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Cluster Quorum if in Cluster
|
# Check Cluster Quorum if in Cluster
|
||||||
if ! pvecm status | awk '/^Quorate:/ {exit $2 != "Yes"}'; then
|
if [ -f /etc/pve/corosync.conf ]; then
|
||||||
printf "\e[?25h"
|
if ! pvecm status | grep -q "Quorate: Yes"; then
|
||||||
echo -e "\n${CROSS}${RD}Cluster is not quorate. Start all nodes or configure quorum device (QDevice).${CL}\n"
|
printf "\e[?25h"
|
||||||
exit 210
|
echo -e "\n${CROSS}${RD}Cluster is not quorate. Start all nodes or configure quorum device (QDevice).${CL}\n"
|
||||||
|
exit 210
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update LXC template list
|
# Update LXC template list
|
||||||
|
@ -737,9 +737,9 @@ function setup_mongodb() {
|
|||||||
function fetch_and_deploy_gh_release() {
|
function fetch_and_deploy_gh_release() {
|
||||||
local app="$1"
|
local app="$1"
|
||||||
local repo="$2"
|
local repo="$2"
|
||||||
local mode="${3:-tarball}" # tarball | binary | prebuild
|
local mode="${3:-tarball}" # tarball | binary | prebuild | singlefile
|
||||||
local version="${4:-latest}" # optional, default "latest"
|
local version="${4:-latest}"
|
||||||
local target="${5:-/opt/$app}" # optional target dir
|
local target="${5:-/opt/$app}"
|
||||||
|
|
||||||
local app_lc=$(echo "${app,,}" | tr -d ' ')
|
local app_lc=$(echo "${app,,}" | tr -d ' ')
|
||||||
local version_file="$HOME/.${app_lc}"
|
local version_file="$HOME/.${app_lc}"
|
||||||
@ -748,10 +748,11 @@ function fetch_and_deploy_gh_release() {
|
|||||||
local current_version=""
|
local current_version=""
|
||||||
if [[ -f "$version_file" ]]; then
|
if [[ -f "$version_file" ]]; then
|
||||||
current_version=$(<"$version_file")
|
current_version=$(<"$version_file")
|
||||||
$STD msg_info "Current version: $current_version"
|
$STD msg_info "Current installed version of $app: $current_version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v jq &>/dev/null; then
|
if ! command -v jq &>/dev/null; then
|
||||||
|
$STD msg_info "Installing jq..."
|
||||||
$STD apt-get install -y jq &>/dev/null
|
$STD apt-get install -y jq &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -768,21 +769,22 @@ function fetch_and_deploy_gh_release() {
|
|||||||
msg_error "Failed to fetch release: HTTP $http_code"
|
msg_error "Failed to fetch release: HTTP $http_code"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
local json
|
|
||||||
|
local json tag_name
|
||||||
json=$(</tmp/gh_rel.json)
|
json=$(</tmp/gh_rel.json)
|
||||||
local tag_name
|
|
||||||
tag_name=$(echo "$json" | jq -r '.tag_name // .name // empty')
|
tag_name=$(echo "$json" | jq -r '.tag_name // .name // empty')
|
||||||
[[ "$tag_name" =~ ^v ]] && version="${tag_name:1}" || version="$tag_name"
|
[[ "$tag_name" =~ ^v ]] && version="${tag_name:1}" || version="$tag_name"
|
||||||
|
|
||||||
if [[ "$current_version" == "$version" ]]; then
|
if [[ "$current_version" == "$version" ]]; then
|
||||||
$STD msg_info "Already on latest version ($version)"
|
$STD msg_info "$app is already up-to-date (v$version)"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$STD msg_info "Preparing to deploy $app v$version (mode: $mode)..."
|
||||||
|
|
||||||
local tmpdir
|
local tmpdir
|
||||||
tmpdir=$(mktemp -d) || return 1
|
tmpdir=$(mktemp -d) || return 1
|
||||||
local filename=""
|
local filename="" url=""
|
||||||
local url=""
|
|
||||||
|
|
||||||
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
if [[ "$mode" == "tarball" || "$mode" == "source" ]]; then
|
||||||
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
url=$(echo "$json" | jq -r '.tarball_url // empty')
|
||||||
@ -805,6 +807,8 @@ function fetch_and_deploy_gh_release() {
|
|||||||
cp -r "$unpack_dir"/* "$target/"
|
cp -r "$unpack_dir"/* "$target/"
|
||||||
shopt -u dotglob nullglob
|
shopt -u dotglob nullglob
|
||||||
|
|
||||||
|
$STD msg_ok "$app (tarball) deployed to $target"
|
||||||
|
|
||||||
elif [[ "$mode" == "binary" ]]; then
|
elif [[ "$mode" == "binary" ]]; then
|
||||||
local arch
|
local arch
|
||||||
arch=$(dpkg --print-architecture 2>/dev/null || uname -m)
|
arch=$(dpkg --print-architecture 2>/dev/null || uname -m)
|
||||||
@ -814,7 +818,6 @@ function fetch_and_deploy_gh_release() {
|
|||||||
local assets url_match=""
|
local assets url_match=""
|
||||||
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
|
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
|
for u in $assets; do
|
||||||
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then
|
if [[ "$u" =~ ($arch|amd64|x86_64|aarch64|arm64).*\.deb$ ]]; then
|
||||||
url_match="$u"
|
url_match="$u"
|
||||||
@ -822,13 +825,9 @@ function fetch_and_deploy_gh_release() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# 2. If no Arch mapping, use the first .deb in the asset listing
|
|
||||||
if [[ -z "$url_match" ]]; then
|
if [[ -z "$url_match" ]]; then
|
||||||
for u in $assets; do
|
for u in $assets; do
|
||||||
if [[ "$u" =~ \.deb$ ]]; then
|
[[ "$u" =~ \.deb$ ]] && url_match="$u" && break
|
||||||
url_match="$u"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -839,49 +838,47 @@ function fetch_and_deploy_gh_release() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
filename="${url_match##*/}"
|
filename="${url_match##*/}"
|
||||||
$STD msg_info "Downloading binary .deb: $url_match"
|
$STD msg_info "Downloading binary package: $filename"
|
||||||
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$url_match" || {
|
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$url_match" || {
|
||||||
msg_error "Download failed: $url_match"
|
msg_error "Download failed: $url_match"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$STD msg_info "Installing $filename via apt"
|
|
||||||
chmod 644 "$tmpdir/$filename"
|
chmod 644 "$tmpdir/$filename"
|
||||||
|
$STD msg_info "Installing $filename via apt..."
|
||||||
$STD apt-get install -y "$tmpdir/$filename" || {
|
$STD apt-get install -y "$tmpdir/$filename" || {
|
||||||
$STD msg_info "Falling back to dpkg -i"
|
$STD msg_info "apt failed, falling back to dpkg -i..."
|
||||||
dpkg -i "$tmpdir/$filename" || {
|
dpkg -i "$tmpdir/$filename" || {
|
||||||
msg_error "Both apt and dpkg install failed"
|
msg_error "Both apt and dpkg installation failed"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$STD msg_ok "$app (.deb binary) installed successfully"
|
||||||
|
|
||||||
elif [[ "$mode" == "prebuild" ]]; then
|
elif [[ "$mode" == "prebuild" ]]; then
|
||||||
local pattern="$6"
|
local pattern="$6"
|
||||||
if [[ -z "$pattern" ]]; then
|
[[ -z "$pattern" ]] && {
|
||||||
msg_error "Mode 'prebuild' requires 6th parameter (asset filename pattern)"
|
msg_error "Mode 'prebuild' requires 6th parameter (asset filename pattern)"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
local assets asset_url=""
|
local asset_url=""
|
||||||
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
|
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
|
||||||
for u in $assets; do
|
[[ "$u" =~ $pattern || "$u" == *"$pattern" ]] && asset_url="$u" && break
|
||||||
if [[ "$u" =~ $pattern || "$u" == *"$pattern" ]]; then
|
|
||||||
asset_url="$u"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z "$asset_url" ]]; then
|
[[ -z "$asset_url" ]] && {
|
||||||
msg_error "No asset matching pattern '$pattern' found"
|
msg_error "No asset matching '$pattern' found"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
filename="${asset_url##*/}"
|
filename="${asset_url##*/}"
|
||||||
$STD msg_info "Downloading prebuilt asset: $asset_url"
|
$STD msg_info "Downloading prebuilt asset: $filename"
|
||||||
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
|
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
|
||||||
msg_error "Download failed: $asset_url"
|
msg_error "Download failed: $asset_url"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
@ -891,6 +888,7 @@ function fetch_and_deploy_gh_release() {
|
|||||||
mkdir -p "$target"
|
mkdir -p "$target"
|
||||||
if [[ "$filename" == *.zip ]]; then
|
if [[ "$filename" == *.zip ]]; then
|
||||||
if ! command -v unzip &>/dev/null; then
|
if ! command -v unzip &>/dev/null; then
|
||||||
|
$STD msg_info "Installing unzip..."
|
||||||
$STD apt-get install -y unzip
|
$STD apt-get install -y unzip
|
||||||
fi
|
fi
|
||||||
unzip "$tmpdir/$filename" -d "$target"
|
unzip "$tmpdir/$filename" -d "$target"
|
||||||
@ -902,32 +900,30 @@ function fetch_and_deploy_gh_release() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$STD msg_ok "$app (prebuilt) extracted to $target"
|
||||||
|
|
||||||
elif [[ "$mode" == "singlefile" ]]; then
|
elif [[ "$mode" == "singlefile" ]]; then
|
||||||
local pattern="$6"
|
local pattern="$6"
|
||||||
if [[ -z "$pattern" ]]; then
|
[[ -z "$pattern" ]] && {
|
||||||
msg_error "Mode 'singlefile' requires 6th parameter (asset filename pattern)"
|
msg_error "Mode 'singlefile' requires 6th parameter (asset filename pattern)"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
local assets asset_url=""
|
local asset_url=""
|
||||||
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
|
for u in $(echo "$json" | jq -r '.assets[].browser_download_url'); do
|
||||||
for u in $assets; do
|
[[ "$u" =~ $pattern || "$u" == *"$pattern" ]] && asset_url="$u" && break
|
||||||
if [[ "$u" =~ $pattern || "$u" == *"$pattern" ]]; then
|
|
||||||
asset_url="$u"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z "$asset_url" ]]; then
|
[[ -z "$asset_url" ]] && {
|
||||||
msg_error "No asset matching pattern '$pattern' found"
|
msg_error "No asset matching '$pattern' found"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
filename="${asset_url##*/}"
|
filename="${asset_url##*/}"
|
||||||
mkdir -p "$target"
|
mkdir -p "$target"
|
||||||
$STD msg_info "Downloading single binary: $asset_url"
|
$STD msg_info "Downloading single binary: $filename"
|
||||||
curl $curl_timeout -fsSL -o "$target/$app" "$asset_url" || {
|
curl $curl_timeout -fsSL -o "$target/$app" "$asset_url" || {
|
||||||
msg_error "Download failed: $asset_url"
|
msg_error "Download failed: $asset_url"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
@ -935,6 +931,7 @@ function fetch_and_deploy_gh_release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chmod +x "$target/$app"
|
chmod +x "$target/$app"
|
||||||
|
$STD msg_ok "$app (single binary) installed to $target"
|
||||||
|
|
||||||
else
|
else
|
||||||
msg_error "Unknown mode: $mode"
|
msg_error "Unknown mode: $mode"
|
||||||
@ -943,7 +940,7 @@ function fetch_and_deploy_gh_release() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$version" >"$version_file"
|
echo "$version" >"$version_file"
|
||||||
$STD msg_ok "$app deployed (version: $version)"
|
$STD msg_ok "$app v$version deployed successfully"
|
||||||
rm -rf "$tmpdir"
|
rm -rf "$tmpdir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user