How to Resolve SonarQube Server cannot be reached Error?
Pre-requisites:
Sonarqube was configured manually by downloading zip file. This instructions will not address for SonarQube that was configured by Docker compose.
Let's see how we can resolve the error:
Solution # 1
Your sonar.properties may not be setup correctly. It could be due to three different reasons:
1. verify below sonar.properties
sudo vi /opt/sonarqube/conf/sonar.properties
uncomment the below lines by removing # and add values highlighted yellow
sonar.jdbc.username=sonar
sonar.jdbc.password=password
Next, uncomment the below line, removing #
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
Solution # 2
2. Switch to sql shell by entering
psql
Execute the below lines (one by one)
ALTER USER sonar WITH ENCRYPTED password 'password';
CREATE DATABASE sonarqube OWNER sonar;
GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;
\q
type exit tom come out of postgresSQL.
Solution #3
3. Make sure you have setup sonarqube as a service properly.
Execute the below command:
sudo vi /etc/systemd/system/sonar.service
# copy the below green highlighted commands in the above file
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
User=root
Group=root
Restart=always
[Install]
WantedBy=multi-user.target
No comments:
Post a Comment