parent
091271c8d6
commit
de944792de
@ -33,30 +33,30 @@ function update_script() {
|
||||
systemctl stop sonarqube
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Creating backup"
|
||||
msg_info "Creating Backup"
|
||||
BACKUP_DIR="/opt/sonarqube-backup"
|
||||
mv /opt/sonarqube ${BACKUP_DIR}
|
||||
msg_ok "Backup created"
|
||||
msg_ok "Created Backup"
|
||||
|
||||
msg_info "Installing sonarqube"
|
||||
msg_info "Updating SonarQube"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/SonarSource/sonarqube/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
RELEASE=$(get_latest_github_release "SonarSource/sonarqube")
|
||||
curl -fsSL "https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-${RELEASE}.zip" -o $temp_file
|
||||
unzip -q "$temp_file" -d /opt
|
||||
mv /opt/sonarqube-* /opt/sonarqube
|
||||
msg_ok "Installed sonarqube"
|
||||
msg_ok "Updated SonarQube"
|
||||
|
||||
msg_info "Restoring backup"
|
||||
msg_info "Restoring Backup"
|
||||
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}
|
||||
chown -R sonarqube:sonarqube /opt/sonarqube
|
||||
msg_ok "Backup restored"
|
||||
msg_ok "Restored Backup"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start sonarqube
|
||||
msg_ok "Service started"
|
||||
msg_ok "Service Started"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
|
||||
@ -14,24 +14,11 @@ update_os
|
||||
|
||||
JAVA_VERSION="21" setup_java
|
||||
PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="sonarqube" PG_DB_USER="sonarqube" setup_postgresql_db
|
||||
|
||||
msg_info "Installing Postgresql"
|
||||
DB_NAME="sonarqube"
|
||||
DB_USER="sonarqube"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_USER;"
|
||||
{
|
||||
echo "Application Credentials"
|
||||
echo "DB_NAME: $DB_NAME"
|
||||
echo "DB_USER: $DB_USER"
|
||||
echo "DB_PASS: $DB_PASS"
|
||||
} >>~/sonarqube.creds
|
||||
msg_ok "Installed PostgreSQL"
|
||||
|
||||
msg_info "Configuring SonarQube"
|
||||
msg_info "Setting up SonarQube"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/SonarSource/sonarqube/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
RELEASE=$(get_latest_github_release "SonarSource/sonarqube")
|
||||
curl -fsSL "https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-${RELEASE}.zip" -o $temp_file
|
||||
unzip -q "$temp_file" -d /opt
|
||||
mv /opt/sonarqube-* /opt/sonarqube
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user