Files
ProxmoxVE/ct/sonarqube.sh
T

76 lines
2.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
_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
2025-10-11 00:04:38 +02:00
# Author: prop4n
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://docs.sonarsource.com/sonarqube-server
APP="SonarQube"
var_tags="${var_tags:-automation}"
var_cpu="${var_cpu:-4}"
var_ram="${var_ram:-6144}"
var_disk="${var_disk:-25}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
2025-10-11 00:04:38 +02:00
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 /opt/sonarqube ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "sonarqube" "SonarSource/sonarqube"; then
msg_info "Stopping Service"
systemctl stop sonarqube
msg_ok "Stopped Service"
2025-12-11 10:52:49 +01:00
msg_info "Creating Backup"
2025-10-11 00:04:38 +02:00
BACKUP_DIR="/opt/sonarqube-backup"
mv /opt/sonarqube ${BACKUP_DIR}
2025-12-11 10:52:49 +01:00
msg_ok "Created Backup"
2025-10-11 00:04:38 +02:00
2025-12-11 10:52:49 +01:00
msg_info "Updating SonarQube"
2026-05-19 23:42:26 +02:00
RELEASE=$(curl -fsSL "https://binaries.sonarsource.com/s3api?prefix=Distribution/sonarqube/sonarqube-&delimiter=/" |
grep -oP 'sonarqube-[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.zip' |
sort -V | tail -n1)
fetch_and_deploy_from_url "https://binaries.sonarsource.com/Distribution/sonarqube/${RELEASE}" /opt/sonarqube
echo "${RELEASE}" >~/.sonarqube
2025-12-11 10:52:49 +01:00
msg_ok "Updated SonarQube"
2025-10-11 00:04:38 +02:00
2025-12-11 10:52:49 +01:00
msg_info "Restoring Backup"
2025-10-11 00:04:38 +02:00
cp -rp ${BACKUP_DIR}/data/ /opt/sonarqube/data/
cp -rp ${BACKUP_DIR}/extensions/ /opt/sonarqube/extensions/
cp -p ${BACKUP_DIR}/conf/sonar.properties /opt/sonarqube/conf/sonar.properties
rm -rf ${BACKUP_DIR}
chmod +x /opt/sonarqube/bin/linux-x86-64/sonar.sh
2025-10-11 00:04:38 +02:00
chown -R sonarqube:sonarqube /opt/sonarqube
2025-12-11 10:52:49 +01:00
msg_ok "Restored Backup"
2025-10-11 00:04:38 +02:00
msg_info "Starting Service"
systemctl start sonarqube
2025-12-11 10:52:49 +01:00
msg_ok "Service Started"
msg_ok "Updated successfully!"
2025-10-11 00:04:38 +02:00
fi
exit
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2025-10-11 00:04:38 +02:00
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}:9000${CL}"