improve sonarqube documentation about embedded elasticsearch requirements

This commit is contained in:
Pierre Guillot 2019-07-26 16:19:21 +02:00
parent 1ec4be4013
commit b5f01e87c5
1 changed files with 20 additions and 5 deletions

View File

@ -30,12 +30,29 @@ $ mvn sonar:sonar -Dsonar.host.url=http://$(boot2docker ip):9000
To analyze other kinds of projects and for more details see [Analyzing Source Code documentation](https://redirect.sonarsource.com/doc/analyzing-source-code.html). To analyze other kinds of projects and for more details see [Analyzing Source Code documentation](https://redirect.sonarsource.com/doc/analyzing-source-code.html).
## Requirements
Because SonarQube uses an embedded Elasticsearch, make sure that the Docker host configuration complies with the [Elasticsearch production mode requirements](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode) and [File Descriptors configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html).
For example, on Linux, you can set the recommended values for the current session by running the following commands as root on the host:
```console
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 4096
```
## Advanced configuration ## Advanced configuration
### Option 1: Database configuration ### Database configuration
By default, the image will use an embedded H2 database that is not suited for production. By default, the image will use an embedded H2 database that is not suited for production.
> Warning: Only a single instance of SonarQube can connect to a database schema. If you're using a Docker Swarm or Kubernetes, make sure that multiple SonarQube instances are never running on the same database schema simultaneously. This will cause SonarQube to behave unpredictably and data will be corrupted. There is no safeguard until [SONAR-10362](https://jira.sonarsource.com/browse/SONAR-10362).
### Option 1: Use parameters via Docker environment variables
The production database is configured with the following SonarQube properties used as environment variables: `sonar.jdbc.username`, `sonar.jdbc.password` and `sonar.jdbc.url`. The production database is configured with the following SonarQube properties used as environment variables: `sonar.jdbc.username`, `sonar.jdbc.password` and `sonar.jdbc.url`.
```console ```console
@ -51,11 +68,9 @@ Use of the environment variables `SONARQUBE_JDBC_USERNAME`, `SONARQUBE_JDBC_PASS
More recipes can be found [here](https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md). More recipes can be found [here](https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md).
### Option 2: Use parameters via Docker environment variables
You can pass `sonar.` configuration properties as Docker environment variables, as demonstrated in the example above for database configuration. You can pass `sonar.` configuration properties as Docker environment variables, as demonstrated in the example above for database configuration.
### Option 3: Use bind-mounted persistent volumes ### Option 2: Use bind-mounted persistent volumes
The images contain the SonarQube installation at `/opt/sonarqube`. You can use bind-mounted persistent volumes to override selected files or directories, for example: The images contain the SonarQube installation at `/opt/sonarqube`. You can use bind-mounted persistent volumes to override selected files or directories, for example:
@ -76,7 +91,7 @@ $ docker run -d --name sonarqube \
sonarqube sonarqube
``` ```
### Option 4: Customized image ### Option 3: Customized image
In some environments, it may make more sense to prepare a custom image containing your configuration. A `Dockerfile` to achieve this may be as simple as: In some environments, it may make more sense to prepare a custom image containing your configuration. A `Dockerfile` to achieve this may be as simple as: