New Install of SonarQube and Connect to Postges13 DB

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) = 9.24
  • what are you trying to achieve = New Installation, Postgre13 Database setup
  • what have you tried so far to achieve this = New Installation with the following:

This is a disconnected environment, no connection to the internet…

  • Have PostgreSQL13 installed.
  • Have Postgre user (sonarqube) setup as follows in postgre,
    CREATE ROLE sonarqube WITH LOGIN PASSWORD ‘1234565789’ VALID UNTIL ‘infinity’;
  • Now i want to setup the sonarqube db, no docs on how to do this specifically for sonarqube, so i was about to do the following in postgre
    CREATE DATABASE sonarqube WITH ENCODING=‘UTF8’ OWNER=sonarqube;

does this look good, if you have a sonarqube db install connectivity guide, please advise.
Thanks,
Tom

Hey there.

Once a database is created, all you need to do is plugin the JDBC URL (the Install the Server documentation discusses how for both Docker and more traditional deployments) and start your SonarQube server.

Thank you, following install guide is good after the DB is setup.
Should of shrank down my question, when creating the DB in postgres, does this syntax look good?

CREATE DATABASE sonarqube WITH ENCODING=‘UTF8’ OWNER=sonarqube;

For other none-sonarqube apps, when I created DBs in Postgres for them, there were different syntax for each application. I just want to do it correct the first time for SonarQube.

Thanks again,
Tom

Thanks again,

Verified postgre13 is installed correctly, sonarqube user and sonarqube db.
The DB server (192.168.100.50) is external from the App (sonarqube) server.
Firewall port 5432 is open between db server and app server, i can run netstat -nlp | grep 5432, it shows its listening on 5432
From the App server i can run NC 192.168.100.50 5432, it makes a connection and keeps it open.
I have OpenJDK 11 installed and set to system wide, as there is OpenJDK 1.8 installed as well.

modified my sonar.properties, just like everyone else,
sonar.jdbc.username=sonarqube
sonar.jdbc.password=my unique pw
sonar.jdbc.url=jdbc:postgresql://192.168.100.50:5432/sonarqube

logged in as not root, user = sonarqube, browse to …/bin/linux-x86-64 run the following sudo ./sonar.sh start

The application starts for brief moment then stops, if i check Status, is states Not Running.
this is a disconnected environment, doesn’t touch the internet.

I’ve looked through the community articles, lots of time it points to the jdbc settings, i’ve checked and double checked.
What is going on here???
I don’t know.

What do your server logs say?

Have to hand type as they are on a disconnected environment.
ES.LOG
1st line, ERROR es…bootstrap exception
2nd line, can not run elasticsearch as root
(i’ve seen other articles that mention this, i’m running as the user “sonarqube” via sudo.
About half way down, another ERROR Uncaught Exception in the thread.
nothing really stands out…

Sonar.date.log
Launching JVM…
INFO: Clean and Creating temp directory /var/sonarqube/temp
INFO: Elasticsearch listening on HTTP 127.0.0.1: 9001, TCP: 127.0.0.1:34035
INFO: Launch process … /Apps/Apps/SonarQube/elasticsearch…
INFO: waiting on elasticsearch to be up and running
uncaught exception in thread [main]
Java.lang.RuntimeException:cannot run elasticsearch as root…
then about 10 lines at org.elasticsearch.bootstrap or .cli
For complete error refer to the this log
process exited
process is stopped
sonarqube is stopped

I only see two logs.
es.log and sonar.date.log
I do not see or cannot find web.log or ce.log

made it a lot further. Couple of things,

  1. linux permissions on folders for logs and for /data /temp directories 2) starting as non admin, made it further, but still some Variable messages in logs. 3) Modified /etc/systctl.conf and /etc/security/limits.conf with necessary variables.
    Then the application would stay started

Now, visit http://hostname:9000 get a 404 status message.
I’ve seen this in a few community articles, if you have a link to one, please send along.

Is the 404 showing up in your access.log file? If not – the request may not actually be reaching the application.

I have it all up and running.
this time it was a network maintenance issue that happened over the weekend. IPs stepping on each other. Just put in my SonarQube license request with ServerID.

Is there a optimization guide for all the settings in the sonarqube.properties file?