baywet
baywet

Reputation: 5382

Command line to initialize SonarQube database?

I'm trying to automate sonarqube installation. One (small) issue I'm running into is after installation during first access, as sonarqube is initializing the db schema, we run into timeouts. I'd like to know if there's a script/command to initialize the db (create tables and all) from the bash? I've been digging on the internet and couldn't find an answer to that. Thanks!

Upvotes: 3

Views: 778

Answers (3)

Simon Brandhof
Simon Brandhof

Reputation: 5136

I'd like to complete answers from Seb and Jeroen. Schema is indeed created programmatically by SonarQube during startup. This step can't be executed independently in a script. Just start server. Instead of parsing logs, I suggest to call the web service GET http:///api/system/status (see documentation at http://nemo.sonarqube.org/api_documentation/api/system/status) to know when database is fully initialized.

Database upgrade when installing a new release can also be triggered through the web service POST http:///api/system/migrate_db (see http://nemo.sonarqube.org/api_documentation/api/system/migrate_db).

Upvotes: 3

Seb - SonarSource Team
Seb - SonarSource Team

Reputation: 962

Database initialization is built-in SonarQube and can not be run independently of starting SonarQube.

As suggested by @jeroen, you can indeed analyze the sonar.log file and wait for the web[o.s.s.a.TomcatAccessLog] Web server is started line.

Upvotes: 2

Jeroen Heier
Jeroen Heier

Reputation: 3694

You can build in a wait loop and/or analyze the SonarQube log file during startup.

Upvotes: 0

Related Questions