mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-13 17:26:43 +00:00
setup_go with no GO_VERSION resolves to whatever go.dev currently serves, so every Go app was built against a moving target. When 1.27 landed it broke wanderer outright (#16909): PocketBase pins go 1.25.0 and stack-overflows at startup when built with anything newer. Two problems, both fixed here: setup_go ran before the source was fetched in all 15 install scripts, so the pin could not be read even if someone wanted one. It now runs after the fetch and reads the version out of go.mod. 13 ct/ scripts rebuild with go during update. Eleven never called setup_go at all and rebuilt with whatever the container happened to have; the other two called it before the fetch. All 13 now use the same call as their installer, verified identical string for string. caddy is left alone: xcaddy fetches the Caddy source itself, so there is no local go.mod to read, and it already pins deliberately. wanderer is in #16976.
118 lines
4.5 KiB
Bash
118 lines
4.5 KiB
Bash
#!/usr/bin/env bash
|
|
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main"
|
|
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
|
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: MickLesk (CanbiZ)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/databasus/databasus
|
|
|
|
APP="Databasus"
|
|
var_tags="${var_tags:-backup;postgresql;database}"
|
|
var_cpu="${var_cpu:-2}"
|
|
var_ram="${var_ram:-2048}"
|
|
var_disk="${var_disk:-8}"
|
|
var_os="${var_os:-debian}"
|
|
var_version="${var_version:-13}"
|
|
var_arm64="${var_arm64:-yes}"
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
function update_script() {
|
|
header_info
|
|
check_container_storage
|
|
check_container_resources
|
|
|
|
if [[ ! -f /opt/databasus/databasus ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
NODE_VERSION="24" NODE_MODULE="corepack" setup_nodejs
|
|
|
|
if check_for_gh_release "databasus" "databasus/databasus"; then
|
|
msg_info "Stopping Databasus"
|
|
$STD systemctl stop databasus
|
|
msg_ok "Stopped Databasus"
|
|
|
|
create_backup /opt/databasus/.env
|
|
|
|
msg_info "Ensuring Database Clients"
|
|
# Create PostgreSQL version symlinks for compatibility
|
|
for v in 12 13 14 15 16 18; do
|
|
ln -sf /usr/lib/postgresql/17 /usr/lib/postgresql/$v
|
|
done
|
|
# Install MongoDB Database Tools via direct .deb (no APT repo for Debian 13)
|
|
if ! command -v mongodump &>/dev/null; then
|
|
[[ "$(get_os_info id)" == "ubuntu" ]] && MONGO_DIST="ubuntu2204" || MONGO_DIST="debian12"
|
|
MONGO_ARCH=$(arch_resolve "x86_64" "arm64")
|
|
# MongoDB only publishes arm64 builds for Ubuntu
|
|
[[ "$MONGO_ARCH" == "arm64" ]] && MONGO_DIST="ubuntu2204"
|
|
fetch_and_deploy_from_url "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-${MONGO_DIST}-${MONGO_ARCH}-100.16.1.deb"
|
|
fi
|
|
ensure_dependencies mariadb-client
|
|
mkdir -p /usr/local/mariadb-{10.6,12.1}/bin /usr/local/mysql-{5.7,8.0,8.4,9}/bin /usr/local/mongodb-database-tools/bin
|
|
[[ -f /usr/bin/mongodump ]] && ln -sf /usr/bin/mongodump /usr/local/mongodb-database-tools/bin/mongodump
|
|
[[ -f /usr/bin/mongorestore ]] && ln -sf /usr/bin/mongorestore /usr/local/mongodb-database-tools/bin/mongorestore
|
|
# Create MariaDB and MySQL client symlinks for compatibility
|
|
for dir in /usr/local/mariadb-{10.6,12.1}/bin; do
|
|
ln -sf /usr/bin/mariadb-dump "$dir/mariadb-dump"
|
|
ln -sf /usr/bin/mariadb "$dir/mariadb"
|
|
done
|
|
for dir in /usr/local/mysql-{5.7,8.0,8.4,9}/bin; do
|
|
ln -sf /usr/bin/mariadb-dump "$dir/mysqldump"
|
|
ln -sf /usr/bin/mariadb "$dir/mysql"
|
|
done
|
|
msg_ok "Ensured Database Clients"
|
|
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "databasus" "databasus/databasus" "tarball" "latest" "/opt/databasus"
|
|
GO_VERSION="$(grep -m1 '^go ' /opt/databasus/backend/go.mod | awk '{print $2}')" setup_go
|
|
|
|
msg_info "Updating Databasus"
|
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
cd /opt/databasus/frontend
|
|
|
|
$STD corepack prepare pnpm@latest --activate
|
|
$STD pnpm install --frozen-lockfile
|
|
$STD pnpm run build
|
|
cd /opt/databasus/backend
|
|
$STD go mod download
|
|
$STD /root/go/bin/swag init -g cmd/main.go -o swagger
|
|
$STD env CGO_ENABLED=0 GOOS=linux GOARCH=$(arch_resolve) go build -o databasus ./cmd
|
|
mv /opt/databasus/backend/databasus /opt/databasus/databasus
|
|
mkdir -p /opt/databasus/ui/build
|
|
cp -r /opt/databasus/frontend/dist/* /opt/databasus/ui/build/
|
|
cp -r /opt/databasus/backend/migrations /opt/databasus/
|
|
chown -R postgres:postgres /opt/databasus
|
|
msg_ok "Updated Databasus"
|
|
|
|
restore_backup
|
|
|
|
if ! grep -q "EnvironmentFile=/.env" /etc/systemd/system/databasus.service; then
|
|
msg_info "Updating Service"
|
|
sed -i 's|EnvironmentFile=.*|EnvironmentFile=/.env|' /etc/systemd/system/databasus.service
|
|
$STD systemctl daemon-reload
|
|
msg_ok "Updated Service"
|
|
fi
|
|
|
|
msg_info "Starting Databasus"
|
|
$STD systemctl start databasus
|
|
msg_ok "Started Databasus"
|
|
msg_ok "Updated successfully!"
|
|
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 "${GATEWAY}${BGN}http://${IP}${CL}"
|