Docker-sonarqube: Update to recipes.md

Created on 1 Sep 2017  路  9Comments  路  Source: SonarSource/docker-sonarqube

I noticed this hasn't been updated in a little while, and I think it has become simpler with the newer versions of docker and docker-compose.

I was able to get it working with this docker-compose.yml file.

version: "2"

services:
  sonarqube:
    image: sonarqube
    ports:
      - "9000:9000"
    environment:
      - SONARQUBE_JDBC_USERNAME=sonar
      - SONARQUBE_JDBC_PASSWORD=sonar
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar

  db:
    image: postgres
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar

Am I missing something? If not, I'm happy to submit a Pull Request.

help wanted

All 9 comments

Am I missing something? If not, I'm happy to submit a Pull Request.

Well, to open pull-request, you'd better explain the difference between new and old.

I think it has become simpler with the newer versions of docker and docker-compose.

More specifically - what exactly was changed in docker and docker-compose that allows this simplification?

And when? Notice that minimal versions that were tested are specified - https://github.com/SonarSource/docker-sonarqube/blob/c6aa0bbe967999f37cfa64522b3ae6ff0fda04de/recipes.md#requirements

Also should be noted that line (target) of the following reference still exists:

    volumes:
      - postgresql:/var/lib/postgresql
      # This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
      - postgresql_data:/var/lib/postgresql/data

And regarding explanations about current example of docker-compose.yml should be mentioned that it was contributed by @andreas-lundgren-storytel

@Godin I'm not a sonarqube dev so I'm not exactly sure the reasoning behind the initial volume mounts. What I can tell you that it works without the mounts using the latest versions of everything.

Just sharing what I have learned - if y'all don't care for input, feel free to delete this thread.

if y'all don't care for input, feel free to delete this thread

Thank you for your inputs - they are appreciated.

I do care. Exactly because of this, I'd like to be sure that this will work for others and not just for you. You know - "works on my machine" not always a good argument 馃槈

I'm not exactly sure the reasoning behind the initial volume mounts.

That's why I mentioned initial contributor of docker-compse.yml - hoping to receive valuable inputs from him about this, if he'll have time/interest.

Also it makes sense to add mem_limit & restart options

SONARQUBE_JDBC_USERNAME and SONARQUBE_JDBC_PASSWORD should be configured according to the official docker hub page. And the sonarqube should depend on the db.

Hi, you can add option for sonarqube service :

   depends_on:
      - db

Cause whenever you want to start any service (ie sonarqube), db service will always start first, see on docker-compose doc

@bigornoo as explained on page https://docs.docker.com/compose/startup-order/ depends_on does not guarantee that database will be really ready.

@Godin But it still improves situation that DB is more likely to be ready. Also, in case of shutdown it is even more important.

We updated docker-compose examples in 8.2 release and also added depends_on in postgress example (although as @Godin said, this does not guarantee the db readiness).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoeyHoutenbos picture JoeyHoutenbos  路  3Comments

adrianblakey picture adrianblakey  路  5Comments

vishalsvayam picture vishalsvayam  路  6Comments

alexsuter picture alexsuter  路  3Comments

avarf picture avarf  路  8Comments