Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): * Community Edition Version 9.4
- what are you trying to achieve: Trying to find where configuration changes are stored so that I can replicate the same through docker file.
- what have you tried so far to achieve this: I have been searching in the google various sites to find the path but unfortunately did not find useful information.
Hi @subbu.kobra and welcome to the community ,
there are multiple ways to configure sonarqube. if you are in a containerized environment you can take a look at this section for configuration using environment variables: Environment Variables | SonarQube Docs
If you want to configure sonarqube via the
sonar.properties file there is documentation directly in the file itself (you can find it in the conf directory in your sonarqube installation).
everything that is not confurable via env or properties persist in the database and you probably should not manually modify the DB because this could break a future database migration in an upcomming update.
hope that helps
Hi @DefinitelyNotTobi Thank you very much for quick response. Probably I did not ask my question clearly. let’s say if need to do perform the following action after sonarQube is installed and running, I am able to do through the UI. However, I want to make this part of docker container so that when I run the docker container, all my configurations (or UI changes) changes will be there by default.
Navigate to Administration-> Configuration->Languages->XML and remove .xml language from the list.
As these changes persist in the database there is currently nothing available to enforce this easily. That said there is a web api available that might help you to create your own init script. Everything that you do via the web ui is possible to do via the api.
May I ask about the use case why you need this? Maybe I could think of another way to achieve this
Hi @DefinitelyNotTobi , My requirement is to take the OOB SonarQube docker image and make/add changes that I need for my project requirement (one time changes like I sent you in my previous post) and create a new image so that next time onwards (for higher environments), I don’t have to apply those changes manually. My image will be ready with all changes applied.
Please let me know if you need more details.
Hmm this sounds more like config management tbh, so maybe an ansible playbook to provision a SQ instance to your needs? or this terraform provider might solve this as well.
i don’t have any other idea that would hold These config changes persist in the database, so if you don’t plan to also ship a modified version of your database there is no way to achive this only in containers
Thanks @DefinitelyNotTobi !! One quick question. May I know where is SonarQube database exists in my local. I have searched few folders and don’t see any database.
The embedded h2 database is created during runtime at
/opt/sonarqube/data/sonar.mv.db in the official docker image, but please note that this is for evaluation purposes only and does not support database migrations during update for example. for a production deployment you are expected to connect to a Postgresql/MSSQL or OracleDB