I defined 2 services to run Sonarqube in a docker swarm :
version: "3"
services:
sonar-a:
image: library/sonarqube:6.7.5
ports:
- "9000:9000"
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- SONARQUBE_JDBC_URL="jdbc:postgresql://10.11.12.13:5432/sonar"
deploy:
placement:
constraints:
- node.hostname == some-node
sonar-a-db:
image: library/postgres:10.5
ports:
- "5432:5432"
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
- POSTGRES_DB=sonar
deploy:
placement:
constraints:
- node.hostname == some-node
(I removed the volumes to ease the tests)
But I always get this error that tells me Sonar cant "determine database dialect" :
...
2018.09.28 15:22:42 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2018.09.28 15:22:42 INFO web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2018.09.28 15:22:42 INFO web[][o.e.p.PluginsService] no modules loaded
2018.09.28 15:22:42 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2018.09.28 15:22:42 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2018.09.28 15:22:42 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.09.28 15:22:43 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2018.09.28 15:22:43 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.1.0.11001 / 9f47ce9daecebb16fc777249a418252625ae774a
2018.09.28 15:22:43 ERROR web[][o.s.s.p.Platform] Web server startup failed: Unable to determine database dialect to use within sonar with dialect null jdbc url "jdbc:postgresql://10.4.140.56:5432/sonar"
2018.09.28 15:22:48 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped ...
I tried different versions, I tried with mysql, I tried to pass a dialect variable in the SONARQUBE_JDBC_URL but nothing changes Any idea ?
Strings in YAML should be defined without quotes. Right now your JDBC URL is equal to "jdbc:postgresql://10.11.12.13:5432/sonar"
instead of the jdbc:postgresql://10.11.12.13:5432/sonar
.
You have to change this:
- SONARQUBE_JDBC_URL="jdbc:postgresql://10.11.12.13:5432/sonar"
to:
- SONARQUBE_JDBC_URL=jdbc:postgresql://10.11.12.13:5432/sonar