Hi everyone, currently I'm trying to patch sonarqube to create another admin in a Sonarqube docker image. This docker image is base on harbur/sonarqube. What I did so far is to extract rows-h2.sql from the sonar-core-5.1.jar file, replaced the insert statement in line 327 with another insert. However, when I start the image the first with a PostgreSQL database, I can still login with user and passwort admin. Do you have any suggestions? Do I patch the right SQL file? Here is a snippet from the dockerfile which tries to patch sonarqube (the SQL comment gets replaced in the real dockerfile): RUN apt-get update && apt-get install -y zip && \ cd /opt/sonar/lib/server && \ mkdir -p org/sonar/core/persistence && \ unzip -p sonar-core-5.1.jar org/sonar/core/persistence/rows-h2.sql | sed "327s/.*/INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, /* values... */);/" > org/sonar/core/persistence/rows-h2.sql && \ zip sonar-core-5.1.jar org/sonar/core/persistence/rows-h2.sql && \ rm -r org && \ apt-get clean Thanks Marc |
Hi Marc, As it can be deduce by the name of the file, rows-h2.sql is only for H2 db. For other db, you need to update active record migrations. In your case you need to update 011_create_administrator.rb. Regards, Julien LANCELOT | SonarSource On 5 May 2015 at 14:56, Marc Schreiber <[hidden email]> wrote:
|
In reply to this post by Schreiber, Marc
Hi Marc, Indeed, rows-h2.sql is only used for the embedded H2 database, which you do not use since you are using PostgreSQL.Jean-Baptiste LIEVREMONT | SonarSource Platform Developer 2015-05-05 14:56 GMT+02:00 Marc Schreiber <[hidden email]>:
|
In reply to this post by Julien Lancelot
Note that the best approach is to use the web service api/users to create the new administrator when server is started. Tech Lead & Co-Founder http://twitter.com/SimonBrandhof On 5 May 2015 at 15:36, Julien Lancelot <[hidden email]> wrote:
|
Thanks for the hints. Patching the file 011_create_administrator.rb causes trouble. I think some other migration steps rely on the adminstrator.
Is there some way to automatically call a script (or something else) which will replaces the admin with another user. I thinking about a hook script and an event trigger. This would fit perfectly: When SQ is done with database migration, then call the script to replace the user. Am Di, 5. Mai, 2015 um 4:01 schrieb Simon Brandhof <[hidden email]>:
|
Hi Marc, As said by Jean-Baptiste and Simon, you should use the WS api/users. Regards, Julien LANCELOT | SonarSource On 5 May 2015 at 16:28, Marc Schreiber <[hidden email]> wrote: Thanks for the hints. Patching the file 011_create_administrator.rb causes trouble. I think some other migration steps rely on the adminstrator. |
In reply to this post by Schreiber, Marc
I forgot to mention that the script would than call the webservice API.
Am Di, 5. Mai, 2015 um 4:28 schrieb Marc Schreiber <[hidden email]>: Thanks for the hints. Patching the file 011_create_administrator.rb causes trouble. I think some other migration steps rely on the adminstrator. |
Free forum by Nabble | Edit this page |