Dev edition as docker image


(Vladislav Riabets) #1

Hi guys! Currently using sonarqube community edition as docker image, and want to upgrade to dev edition. Could you assist me please how hard can it be in docker, to update edition. Also there is link between serverID and license, so from that i have a question how can i replace(is it even possible) server id of my sonarqube?

My version

(Colin Mueller) #2

Hey Validslav,

This is our current position on providing official docker images for our commercial editions:

No plan, but on our radar. You might find some community supported docker images for the commercial edition if you look around.

A Server ID is automatically generated, and only changes under certain circumstances (like changing the JDBC URL your SonarQube Instance uses to connect to the database). Why are you interested in replacing it?


(Vladislav Riabets) #3

If server ID ain’t changing at docker container restart so it’s not a problem, still if no official commercial image is available i will install it on separate VM.

(Eugene Dubrovka) #4

We are running SonarQube 7.1 Developer edition in a docker container. Database is in a separate image. We have already restarted and updated the image many times. Or plugins. Server ID has not changed, JDBC connection string was always the same (we use postgres also in docker).

(Vladislav Riabets) #5

@degree so you use self created docker image?

(Eugene Dubrovka) #6

no, we are not quite there yet. we are using official image of 7.1. we are migrating to own custom 7.5 next year. i wanted to point out that restarts do no affect server id in our case.

(Vladislav Riabets) #7

I see, and where did you get image with dev edition?

(Eugene Dubrovka) #8

We used the image of 7.1 from docker hub, switched edition to develop (this has installed license plugin) and it is working since then. For the version 7.5 we are going to create our own image. We have just started to create docker file. All I can offer you right now is this comment. I cannot guarantee that is will work in any way. I hope that when we find a working solution for dev edition of 7.5 then we will open the source on github.

(Eugene Dubrovka) #10

@Jaff, try comparing to this: We have this built with7.6 Developer edition and running it in production.

(V) #11

Hello. Does this image contain the updated/recommended value for vm.max_map_count ?

I ran into the following when trying on our own (7.6 enterprise edition) docker image:

bash-4.2$ sysctl -w vm.max_map_count=262144
sysctl: setting key "vm.max_map_count": Read-only file system

(Eugene Dubrovka) #12

@vdev987, I have taken the original community edition Dockerfile and updated it to install developer edition. If you need to extend the image – that’s just another RUN command at most. If you are trying to set the value in the running container then you are not root but sonarqube user. Update RUN command to update the value at the build time.

(V) #13

Thanks, @degree. I still get that error (as root) when I add it to my Dockerfile:

Step 8/24 : RUN sysctl -w vm.max_map_count=262144
 ---> Running in e74af7754491
sysctl: setting key "vm.max_map_count": Read-only file system
ERROR: Service 'sonaree' failed to build: The command '/bin/sh -c sysctl -w vm.max_map_count=262144' returned a non-zero code: 255

But we’re FROMing oraclelinux:7.5. I’ll try taking from “the original community edition Dockerfile” like you have.

(Mark Jaffe) #14

I’ve built container from EXACTLY the same Dockerfile, and when I attempt to run it, I get same result, continuous restarts, logs contain not needed

(Mark Jaffe) #15

Thanks, would you be willing to share code for this exercise? I am getting in docker logs sonarqube:

chown: changing ownership of '/opt/sonarqube/bin/': Operation not permitted

Since my looks like this:

#!/usr/bin/env bash
set +x

set -e

if [ "${1:0:1}" != '-' ]; then
  exec "$@"

chown -R sonarqube:sonarqube $SONARQUBE_HOME
exec su-exec sonarqube \
  java -jar lib/sonar-application-$SONAR_VERSION.jar \
  -Dsonar.log.console=true \
  -Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
  -Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
  -Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \
  -Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS" \

(Eugene Dubrovka) #16

Check this one:

(Mark Jaffe) #17

Using your, container still does not stay running, log message is:

standard_init_linux.go:207: exec user process caused "permission denied"

(Eugene Dubrovka) #18

Are you using the same Dockerfile? To the moment I cannot provide more info. I probably need to rebase the changes to the latest develop and publish them on github fork. Then I will be able to share complete package properly. Exactly the thing that works on our production server except configuration of the server itself. This partially can come extra.

(Eugene Dubrovka) #19

The last hint I can give for now:

Use --pull to get the latest jdk image.

(Mark Jaffe) #20

Bingo! Not sure which change was the magic, but i’ve brought it up on my test AWS node (still not able to run on Mac laptop)
Now I’m having trouble analyzing PRs. I did not find in docs the right way to specify Authentication token for github; is it possible that private repos are blocked from analysis?

(Eugene Dubrovka) #21

:slight_smile: :+1: I managed to run the image on my macbook and with quite a number of plugins though without license analysis does not work.
We are using gitlab plugin. For example integration requires a token of a user that has access to the private project. Plugin uses it to call gitlab api to comment or update status of commits.