Browse Source

SONAR-13091 Update Docker upgrade docs

tags/8.2.0.32929
michaelbirnstiehl 4 years ago
parent
commit
5164f4c1ee

+ 3
- 13
server/sonar-docs/src/pages/setup/get-started-2-minutes.md View File

@@ -31,22 +31,12 @@ url: /setup/get-started-2-minutes/
## Using Docker
Images of the Community, Developer, and Enterprise Editions are available on [Docker Hub](https://hub.docker.com/_/sonarqube/).

Start the server by running:
1. Start the server by running:

```console
$ docker run -d --name sonarqube -p 9000:9000 <image_name>
```

By default you can login as `admin` with password `admin`, see the [authentication documentation](https://docs.sonarqube.org/latest/instance-administration/security/).
2. Log in to [http://localhost:9000](http://localhost:9000) with System Administrator credentials (login=admin, password=admin).

To analyze a Maven project:

```console
# On Linux:
$ mvn sonar:sonar

# With boot2docker:
$ mvn sonar:sonar -Dsonar.host.url=http://$(boot2docker ip):9000
```

To analyze other types of projects and for more details see [Analyzing Source Code documentation](https://redirect.sonarsource.com/doc/analyzing-source-code.html).
3. Click the **Create new project** button to analyze your first project.

+ 89
- 91
server/sonar-docs/src/pages/setup/install-server.md View File

@@ -149,97 +149,95 @@ wrapper.java.command=/path/to/my/jdk/bin/java

## Installing the Server from the Docker Image

Click your SonarQube version below for instructions on installing the server from a Docker image.

[[collapse]]
| ## SonarQube 8.2+
|
| Follow these steps for your first installation:
|
| 1. Creating the following volumes helps prevent the loss of information when updating to a new version or upgrading to a higher edition:
| - `sonarqube_data` – contains data files, such as the embedded H2 database and Elasticsearch indexes
| - `sonarqube_logs` – contains SonarQube logs about access, web process, CE process, and Elasticsearch
| - `sonarqube_extensions` – contains plugins, such as language analyzers
|
| Create the volumes with the following commands:
| ```bash
| $> docker volume create --name sonarqube_data
| $> docker volume create --name sonarqube_extensions
| $> docker volume create --name sonarqube_logs
| ```
|
| 2. Configure the database with SonarQube properties using environment variables. Define these variables using the -e flag as shown in the following example:
|
| ```console
| #Example for PostgreSQL
| -e SONAR_JDBC_USERNAME=sonar \
| -e SONAR_JDBC_PASSWORD=sonar \
| -e SONAR.JDBC.URL=jdbc:postgresql://localhost/sonar \
| ```
|
| For more configuration environment variables, see the [Docker Environment Variables](/setup/environment-variables/).
|
| [[info]]
| | Drivers for supported databases (except Oracle) are already provided. Do not replace the provided drivers; they are the only ones supported. For Oracle, you need to copy the JDBC driver into the `sonarqube_extensions` volume.
|
| [[warning]]
| | Use of the environment variables `SONARQUBE_JDBC_USERNAME`, `SONARQUBE_JDBC_PASSWORD`, and `SONARQUBE_JDBC_URL` is deprecated and will stop working in future releases.
|
| 3. Run the image:
|
| ```bash
| $> docker run -d --name sonarqube \
| -p 9000:9000 \
| -e SONAR_JDBC_URL=... \
| -e SONAR_JDBC_USERNAME=... \
| -e SONAR_JDBC_PASSWORD=... \
| -v sonarqube_data:/opt/sonarqube/data \
| -v sonarqube_extensions:/opt/sonarqube/extensions \
| -v sonarqube_logs:/opt/sonarqube/logs \
| <image_name>
| ```

[[collapse]]
| ## SonarQube 7.9.x LTS
|
| Follow these steps for your first installation:
|
| 1. Create volumes `sonarqube_conf`, `sonarqube_data`, `sonarqube_logs`, and `sonarqube_extensions` and start the image with the following command. This will populate all the volumes (copying default plugins, create the Elasticsearch data folder, create the sonar.properties configuration file). Watch the logs, and, once the container is properly started, you can force-exit (ctrl+c) and proceed to the next step.
|
| ```console
| $ docker run --rm \
| -p 9000:9000 \
| -v sonarqube_conf:/opt/sonarqube/conf \
| -v sonarqube_extensions:/opt/sonarqube/extensions \
| -v sonarqube_logs:/opt/sonarqube/logs \
| -v sonarqube_data:/opt/sonarqube/data \
| <image_name>
| ```
|
|2. Configure sonar.properties if needed. Please note that due to [SONAR-12501](https://jira.sonarsource.com/browse/SONAR-12501), providing `sonar.jdbc.url`, `sonar.jdbc.username`, `sonar.jdbc.password` and `sonar.web.javaAdditionalOpts` in `sonar.properties` is not working, and you will need to explicitly define theses values in the docker run command with the `-e` flag.
|
| ```plain
| #Example for PostgreSQL
| -e sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
| ```
|
|[[info]]
|| Drivers for supported databases (except Oracle) are already provided. Do not replace the provided drivers; they are the only ones supported. For Oracle, you need to copy the JDBC driver into |`$SONARQUBE_HOME/extensions/jdbc-driver/oracle`.
|
|3. Run the image with your JDBC username and password :
|
| ```console
| $ docker run -d --name sonarqube \
| -p 9000:9000 \
| -e sonar.jdbc.url=... \
| -e sonar.jdbc.username=... \
| -e sonar.jdbc.password=... \
| -v sonarqube_conf:/opt/sonarqube/conf \
| -v sonarqube_extensions:/opt/sonarqube/extensions \
| -v sonarqube_logs:/opt/sonarqube/logs \
| -v sonarqube_data:/opt/sonarqube/data \
| <image_name>
| ```
See your SonarQube version below for instructions on installing the server from a Docker image.

### SonarQube 8.2+

Follow these steps for your first installation:

1. Creating the following volumes helps prevent the loss of information when updating to a new version or upgrading to a higher edition:
- `sonarqube_data` – contains data files, such as the embedded H2 database and Elasticsearch indexes
- `sonarqube_logs` – contains SonarQube logs about access, web process, CE process, and Elasticsearch
- `sonarqube_extensions` – contains plugins, such as language analyzers
Create the volumes with the following commands:
```bash
$> docker volume create --name sonarqube_data
$> docker volume create --name sonarqube_extensions
$> docker volume create --name sonarqube_logs
```

2. Configure the database with SonarQube properties using environment variables. Define these variables using the -e flag as shown in the following example:

```console
#Example for PostgreSQL
-e SONAR_JDBC_URL=jdbc:postgresql://localhost/sonar \
-e SONAR_JDBC_USERNAME=sonar \
-e SONAR_JDBC_PASSWORD=sonar \
```

For more configuration environment variables, see the [Docker Environment Variables](/setup/environment-variables/).

[[info]]
| Drivers for supported databases (except Oracle) are already provided. Do not replace the provided drivers; they are the only ones supported. For Oracle, you need to copy the JDBC driver into the `sonarqube_extensions` volume.

[[warning]]
| Use of the environment variables `SONARQUBE_JDBC_USERNAME`, `SONARQUBE_JDBC_PASSWORD`, and `SONARQUBE_JDBC_URL` is deprecated and will stop working in future releases.

3. Run the image:

```bash
$> docker run -d --name sonarqube \
-p 9000:9000 \
-e SONAR_JDBC_URL=... \
-e SONAR_JDBC_USERNAME=... \
-e SONAR_JDBC_PASSWORD=... \
-v sonarqube_data:/opt/sonarqube/data \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
<image_name>
```

### SonarQube 7.9.x LTS

Follow these steps for your first installation:

1. Create volumes `sonarqube_conf`, `sonarqube_data`, `sonarqube_logs`, and `sonarqube_extensions` and start the image with the following command. This will populate all the volumes (copying default plugins, create the Elasticsearch data folder, create the sonar.properties configuration file). Watch the logs, and, once the container is properly started, you can force-exit (ctrl+c) and proceed to the next step.

```console
$ docker run --rm \
-p 9000:9000 \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_data:/opt/sonarqube/data \
<image_name>
```

2. Configure sonar.properties if needed. Please note that due to [SONAR-12501](https://jira.sonarsource.com/browse/SONAR-12501), providing `sonar.jdbc.url`, `sonar.jdbc.username`, `sonar.jdbc.password` and `sonar.web.javaAdditionalOpts` in `sonar.properties` is not working, and you will need to explicitly define theses values in the docker run command with the `-e` flag.

```plain
#Example for PostgreSQL
-e sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
```

[[info]]
| Drivers for supported databases (except Oracle) are already provided. Do not replace the provided drivers; they are the only ones supported. For Oracle, you need to copy the JDBC driver into `$SONARQUBE_HOME/extensions/jdbc-driver/oracle`.

3. Run the image with your JDBC username and password :

```console
$ docker run -d --name sonarqube \
-p 9000:9000 \
-e sonar.jdbc.url=... \
-e sonar.jdbc.username=... \
-e sonar.jdbc.password=... \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_data:/opt/sonarqube/data \
<image_name>
```

## Next Steps


+ 22
- 11
server/sonar-docs/src/pages/setup/upgrading.md View File

@@ -33,20 +33,31 @@ If you are using the Oracle DB, copy its JDBC driver into `$NEW_SONARQUBE_HOME/e

To upgrade to SonarQube 8.2+:

1. Create a **new** `sonarqube_extensions_8_x` volume.
1. Create a **new** `sonarqube_extensions_8_x` volume.

2. If you're using Oracle, copy the JDBC driver into the new `sonarqube_extensions_8_x` volume.

3. Non-default plugins need to be either re-added through the marketplace after start-up or manually added to the `sonarqube_extensions_8_x` volume.
2. Stop and remove the existing SonarQube container (a restart from the UI is not enough as the environment variables are only evaluated during the first run, not during a restart):
```console
$ docker stop <container_id>
$ docker rm <container_id>
```

4. Stop and remove the SonarQube container (a restart from the UI is not enough as the environment variables are only evaluated during the first run, not during a restart):
3. If you're using non-default plugins, they need to be manually added to the new `sonarqube_extensions_8_x` volume after the first start-up only. If you're using an Oracle database, the same applies to the JDBC driver. To do this:

```console
$ docker stop <image_name>
$ docker rm <image_name>
a. Start the SonarQube container with the embedded H2 database:
```
$ docker run --rm \
-p 9000:9000 \
-v sonarqube_extensions_8_x:/opt/sonarqube/extensions \
<image_name>
```
b. Exit once SonarQube has started properly.
c. Copy non-default plugins into `sonarqube_extensions_8_x/plugins` and, if needed, the Oracle driver into `sonarqube_extensions_8_x/jdbc-driver/oracle`.

5. Run docker:
4. Run docker:

```bash
$> docker run -d --name sonarqube \
@@ -60,9 +71,9 @@ To upgrade to SonarQube 8.2+:
<image_name>
```

6. Browse to `http://yourSonarQubeServerURL/setup` and follow the setup instructions.
5. Browse to `http://yourSonarQubeServerURL/setup` and follow the setup instructions.

7. Reanalyze your projects to get fresh data.
6. Reanalyze your projects to get fresh data.

### From 7.9.x LTS to another 7.9.x LTS version


Loading…
Cancel
Save