Dev edition as docker image

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 7.3.0.15553

1 Like

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?

Colin

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.

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).

@degree so you use self created docker image?

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.

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

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.

@Jaff, try comparing to this: https://gist.github.com/degree/51accc0da6cab6d8b5fb06b833bdac76. We have this built with7.6 Developer edition and running it in production.

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

@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.

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.

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

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

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

Since my run.sh looks like this:

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

set -e

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

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 -Djava.security.egd=file:/dev/./urandom" \
  "$@"

Check this one: https://github.com/SonarSource/docker-sonarqube/blob/master/7.6-community/run.sh

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

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

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.

The last hint I can give for now:
docker build --pull -t "$CI_REGISTRY_IMAGE:$SONAR_VERSION" --build-arg SONAR_VERSION=$SONAR_VERSION .

Use --pull to get the latest jdk image.

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?

: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.