How to do backup and restore for sonarqube version 7.9.1

We have installed sonarqube community edition v 7.9.1.

We want to upgrade it to the latest version although the plan is to perform a backup and restore in case the upgrade goes wrong. Looking at the documentation for the version we have there is no description about it however more recent version does have instructions for backup. I tried to follow it and test it on another server with no good results.

Does any of you have idea how to perform backup and restore for sonarqube community edition v 7.9.1?

Thanks in advance.

Hi,
The procedure to backup and restore your database will depend on the vendor of the DB and how it is deployed. It’s not something specific to SonarQube.

DB is postgres v 12.1

Already performed the backup from the database with this instructions

Bakcup database

docker exec -t your-db-container pg_dumpall -c -U postgres > dump_date +%d-%m-%Y"_"%H_%M_%S.sql

#Restore Database
cat your_dump.sql | docker exec -i your-db-container psql -U postgres

And after restore there is no project displayed in sonarqube server at all, do I need to perform something additional?

No, nothing else should be necessary.
At start up SonarQube will perform any migrations that are needed and index the data.

No project is listed after migration despite that database has been migrated successfully.

On an alternative way I had tested out the upgrade sonarqube server process and no projects are listed too.

How can verify that index data was performed successfully?

I just realized what was my problem. I’m using containers for db (postgres) and for sonarqube. For the upgrade I stopped both contaners, remove them and then rebuilt them. After this I went to http://sonarqubeserver:9000/setup and it sshows that all is up to date.

For my last attempt I just ran sonarqube container with version upgraded and when I checked out http://sonarqubeserver:9000/setup this time it mentioned that database needs to be upgraded too, so proceed to it and after solved some plugins compatibility problems the service is up with projects listed as expected.

Thanks for your time and directions.

1 Like