I tried to configure sonarqube (7.6) to use postgresql database and it seems to ignore the jdbc entries in the sonar.properties and picks up the H2 database. When I pass the properties as jvm parameters, it picks up fine. How do I configure sonar to use postgres from the sonar.properties
2019.03.25 05:42:03 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.03.25 05:42:03 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 7.6.0.21501 / d56689a5eb122c06cf87375828085609f5a68323
2019.03.25 05:42:03 INFO web[o.s.s.p.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 INFO web[o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2019.03.25 05:42:03 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar
2019.03.25 05:42:03 WARN web[o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2019.03.25 05:42:05 INFO web[o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
The sonar.properties has only 4 lines as pasted above. I removed all the entries from the default sonar.properties and kept only the jdbc and log properties there.
Yes. I’m using a docker image. The sonar.properties are located in conf/sonar.properties and the properties file seems to be used by sonarQube. The ‘sonar.log.level=DEBUG’ seems to come into effect and starts logging ‘debug’ level events.
Hi, I’m also facing the same issue. SonaQube is not picking Postgresql, always connecting to the default database.
Don’t know what is the fault.
I’m using docker image of sonarqube and added sonar property file, docker image is taking the property file which I added
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube?currentSchema=sonar
I tried with localhost, hostname, container name because I’m using docker for Postgres also.
This is the docker compose file written for postgresql
image: postgres
container_name: postgresDC
hostname: postgres
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
- POSTGRES_DB=sonar
Log is
LOG: database system is ready to accept connections
@Tweety_Darling please let me know how you are using the JVM parameters approach?
Due to the SONAR-12501 bug, jdbc properties in sonar.properties are ignored on all docker images versions until 8.0. If you are using the 7.9.1 LTS, you have to set your properties with the -e sonar.jdbc.username and -e sonar.jdbc.password flags on the docker run command line.
The official documentation on docker hub have been updated last week to specify this behaviour. Sorry for the inconvenience.
If I use the flags in run command, docker itself will not start , ES is failing
Error logs :
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
2019.11.25 08:14:20 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2019.11.25 08:14:20 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2019.11.25 08:14:20 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2019.11.25 08:14:19 INFO es[o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2019.11.25 08:14:20 INFO es[o.e.n.Node] initialized
2019.11.25 08:14:20 INFO es[o.e.n.Node] starting …
2019.11.25 08:14:20 INFO es[o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.11.25 08:14:20 INFO es[o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2019.11.25 08:14:20 ERROR es[o.e.b.Bootstrap] node validation exception
[1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
2019.11.25 08:14:20 INFO es[o.e.n.Node] stopping …
2019.11.25 08:14:20 INFO es[o.e.n.Node] stopped
2019.11.25 08:14:20 INFO es[o.e.n.Node] closing …
2019.11.25 08:14:20 INFO es[o.e.n.Node] closed