Browse Source

SONAR-13091 update docs to officially support Docker

tags/8.2.0.32929
michaelbirnstiehl 4 years ago
parent
commit
021fc4ca27

+ 2
- 1
server/sonar-docs/src/pages/analysis/scan/sonarscanner.md View File

@@ -10,7 +10,8 @@ url: /analysis/scan/sonarscanner/
| [Linux 64-bit](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip) |
| [Windowx 64-bit](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-windows.zip) |
| [Mac OS X 64-bit](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-macosx.zip) |
| [Any*](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873.zip)
| [Any*](https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873.zip) |
| [Docker](https://hub.docker.com/r/sonarsource/sonar-scanner-cli)
| *Requires a pre-installed JVM - with the same requirements as the SonarQube server.

The SonarScanner is the scanner to use when there is no specific scanner for your build system.

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

@@ -29,5 +29,24 @@ url: /setup/get-started-2-minutes/
5. Click the **Create new project** button to analyze your first project.

## Using Docker
Images of the Community, Developer, and Enterprise Editions are available on [Docker Hub](https://hub.docker.com/_/sonarqube/).

A Docker image of the Community Edition is available on [Docker Hub](https://hub.docker.com/_/sonarqube/). You can find usage and configuration examples there.
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/).

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

+ 95
- 1
server/sonar-docs/src/pages/setup/install-server.md View File

@@ -70,7 +70,7 @@ If you want to use a custom schema and not the default "public" one, the Postgre
ALTER USER mySonarUser SET search_path to mySonarQubeSchema
```

## Installing the Web Server
## Installing the Server from the ZIP file

First, check the [requirements](/requirements/requirements/). Then download and unzip the [distribution](http://www.sonarqube.org/downloads/) (do not unzip into a directory starting with a digit).

@@ -147,6 +147,100 @@ wrapper.java.command=/path/to/my/jdk/bin/java
- Running SonarQube [behind a Proxy](/setup/operate-server/)
- Running SonarQube Community Edition with [Docker](https://hub.docker.com/_/sonarqube/)

## 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>
| ```

## Next Steps

Once your server is installed and running, you may also want to [Install Plugins](/setup/install-plugin/). Then you're ready to begin [Analyzing Source Code](/analysis/overview/).

+ 2
- 4
server/sonar-docs/src/pages/setup/operate-server.md View File

@@ -1,10 +1,8 @@
---
title: Configure & Operate the Server
title: Operating the Server
url: /setup/operate-server/
---

<!-- sonarqube -->

## Running SonarQube as a Service on Windows

### Install or Uninstall NT Service (may have to run these files via Run As Administrator):
@@ -40,7 +38,7 @@ $SONAR_HOME/bin/linux-x86-64/sonar.sh force-stop

## Running SonarQube as a Service on Linux with SystemD

On Unix system using SystemD, you can install SonarQube as a service. You cannot run SonarQube as `root` in 'nix systems. Ideally, you will created a new account dedicated to the purpose of running SonarQube.
On a Unix system using SystemD, you can install SonarQube as a service. You cannot run SonarQube as `root` in 'nix systems. Ideally, you will created a new account dedicated to the purpose of running SonarQube.
Let's suppose:

* The user used to start the service is `sonarqube`

+ 362
- 0
server/sonar-docs/src/pages/setup/sonar-properties.md View File

@@ -0,0 +1,362 @@
---
title: Environment Variables
url: /setup/environment-variables/
---

This page provides environment variables used for configuring SonarQube with Docker. The values provided in the following environment variables are the default values.

## Database

[[info]]
|- The embedded H2 database is used by default. It is recommended for tests but not for production use. Supported databases are Oracle, PostgreSQL, and Microsoft SQLServer.
|- Changes to the database connection URL (sonar.jdbc.url) can affect SonarSource licensed products.

### User Credentials

**`SONAR_JDBC_USERNAME=`**
**`SONAR_JDBC_PASSWORD=`**
Permissions to create tables, indices, and triggers must be granted to JDBC user. The schema must be created first.

### Embedded Database (default)

**`SONAR_EMBEDDEDDATABASE_PORT=9092`**
H2 embedded database server listening port, defaults to 9092.

### Oracle 11g/12c/18c/19c

**`SONAR_JDBC_URL=jdbc:oracle:thin:@localhost:1521/XE`**
The Oracle JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/. Only the thin client is supported, and we recommend using the latest Oracle JDBC driver. See https://jira.sonarsource.com/browse/SONAR-9758 for more details. If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000.

### PostgreSQL 9.3 or greater

**`SONAR_JDBC_URL=jdbc:postgresql://localhost/sonarqube?currentSchema=my_schema`**
By default the schema named "public" is used. It can be overridden with the parameter "currentSchema".

### Microsoft SQLServer 2014/2016/2017 and SQL Azure

**`SONAR_JDBC_URL=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true`**
A database named sonar must exist and its collation must be case-sensitive (CS) and accent-sensitive (AS). Use this connection string if you want to use integrated security with Microsoft Sql Server. Do not set the `SONAR_JDBC_USERNAME` or `SONAR_JDBC_PASSWORD` property if you are using Integrated Security.

For Integrated Security to work, you have to download the Microsoft SQL JDBC driver package [here](https://www.microsoft.com/en-us/download/details.aspx?id=55539) and copy sqljdbc_auth.dll to your path. You need to copy the 64-bit version of the dll.

**`SONAR_JDBC_URL=jdbc:sqlserver://localhost;databaseName=sonar`**
Use this connection string if you want to use SQL Auth while connecting to MS Sql Server. Set the `SONAR_JDBC_USERNAME` and `SONAR_JDBC_PASSWORD` appropriately.

### Connection pool settings

**`SONAR_JDBC_MAXACTIVE=60`**
The maximum number of active connections that can be allocated at the same time, or negative for no limit. The recommended value is 1.2 * max sizes of HTTP pools. For example, if HTTP ports are enabled with default sizes (50, see property `sonar.web.http.maxThreads`) then `SONAR_JDBC_MAXACTIVE` should be 1.2 * 50 = 60.

**`SONAR_JDBC_MAXIDLE=5`**
The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.

**`SONAR_JDBC_MINIDLE=2`**
The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.

**`SONAR_JDBC_MAXWAIT=5000`**
The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or <= 0 to wait indefinitely.

**`SONAR_JDBC_MINEVICTABLEIDLETIMEMILLIS=600000`**
**`SONAR_JDBC_TIMEBETWEENEVICTIONRUNSMILLIS=30000`**

## Web Server

**`SONAR_WEB_JAVAOPTS=@webJavaOpts@`**
the web server is executed in a dedicated Java process. By default, heap size is @webDefaultHeapSize@. Use this property to customize JVM options.

[[info]]
| The HotSpot Server VM is recommended. The property -server should be added if server mode
| is not enabled by default on your environment. See [here](http://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html).
|
| Startup can be long if the entropy source is short of entropy. Adding
| -Djava.security.egd=file:/dev/./urandom is an option to resolve the problem. [See](https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source)

**`SONAR_WEB_JAVAADDITIONALOPTS=`**
Same as previous property, but allows to not repeat all other settings like -Xmx

**`SONAR_WEB_HOST=0.0.0.0`**
Binding IP address. For servers with more than one IP address, this property specifies which address will be used for listening on the specified ports. By default, ports will be used on all IP addresses associated with the server.

**`SONAR_WEB_CONTEXT=`**
Web context. When set, it must start with a forward slash (for example /sonarqube).
The default value is root context (empty value).

**`SONAR_WEB_PORT=9000`**
TCP port for incoming HTTP connections. Default value is 9000.

**`SONAR_WEB_HTTP_MAXTHREADS=50`**
The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will not accept any more connections until the number of connections falls below this value. The operating system may still accept connections based on the `SONAR_WEB_CONNECTIONS_ACCEPTCOUNT` property. The default value is 50.

**`SONAR_WEB_HTTP_MINTHREADS=5`**
The minimum number of threads always kept running. The default value is 5.

**`SONAR_WEB_HTTP_ACCEPTCOUNT=25`**
The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 25.

**`SONAR_AUTH_JWTBASE64HS256SECRET=`**
By default users are logged out and sessions closed when server is restarted. If you prefer keeping user sessions open, a secret should be defined. Value is HS256 key encoded with base64. It must be unique for each installation of SonarQube. Example of command-line:
echo -n "type_what_you_want" | openssl dgst -sha256 -hmac "key" -binary | base64

**`SONAR_WEB_SESSIONTIMEOUTINMINUTES=4320`**
The inactivity timeout duration of user sessions, in minutes. After the configured period of time, the user is logged out. The default value is set to 3 days (4320 minutes) and cannot be greater than 3 months. Value must be strictly positive.

**`SONAR_WEB_SYSTEMPASSCODE=`**
A passcode can be defined to access some web services from monitoring tools without having to use the credentials of a system administrator. Check the Web API documentation to know which web services are supporting this authentication mode. The passcode should be provided in HTTP requests with the header "X-Sonar-Passcode". By default feature is disabled.

## SSO Authentication

**`SONAR_WEB_SSO_ENABLE=false`**
Enable authentication using HTTP headers

**`SONAR_WEB_SSO_LOGINHEADER=X-Forwarded-Login`**
Name of the header to get the user login. Only alphanumeric, '.' and '@' characters are allowed

**`SONAR_WEB_SSO_NAMEHEADER=X-Forwarded-Name`**
Name of the header to get the user name

**`SONAR_WEB_SSO_EMAILHEADER=X-Forwarded-Email`**
Name of the header to get the user email (optional)

**`SONAR_WEB_SSO_GROUPSHEADER=X-Forwarded-Groups`**
Name of the header to get the list of user groups, separated by comma (optional). If the SONAR_SSO_GROUPSHEADER is set, the user will belong to those groups if groups exist in SonarQube. If none of the provided groups exists in SonarQube, the user will only belong to the default group. Note that the default group will always be set.
**`SONAR_WEB_SSO_REFRESHINTERVALINMINUTES=5`**
Interval used to know when to refresh name, email, and groups. During this interval, if for instance the name of the user is changed in the header, it will only be updated after X minutes.

## LDAP Configuration

**`SONAR_SECURITY_REALM=LDAP`**
Enable the LDAP feature

**`SONAR_AUTHENTICATOR_DOWNCASE=true`**
Set to true when connecting to a LDAP server using a case-insensitive setup.

**`LDAP_URL=ldap://localhost:10389`**
URL of the LDAP server. Note that if you are using ldaps, then you should install the server certificate into the Java truststore.

**`LDAP_BINDDN=cn=sonar,ou=users,o=mycompany`**
Bind DN is the username of an LDAP user to connect (or bind) with. Leave this blank for anonymous access to the LDAP directory (optional)

**`LDAP_BINDPASSWORD=secret`**
Bind Password is the password of the user to connect with. Leave this blank for anonymous access to the LDAP directory (optional)

**`LDAP_AUTHENTICATION=simple`**
Possible values: simple | CRAM-MD5 | DIGEST-MD5 | GSSAPI See http://java.sun.com/products/jndi/tutorial/ldap/security/auth.html (default: simple)

**`LDAP_REALM=example.org`**
See :
* http://java.sun.com/products/jndi/tutorial/ldap/security/digest.html
* http://java.sun.com/products/jndi/tutorial/ldap/security/crammd5.html
(optional)

**`LDAP_CONTEXTFACTORYCLASS=com.sun.jndi.ldap.LdapCtxFactory`**
Context factory class (optional)

**`LDAP_STARTTLS=true`**
Enable usage of StartTLS (default : false)

**`LDAP_FOLLOWREFERRALS=false`**
Follow or not referrals. See http://docs.oracle.com/javase/jndi/tutorial/ldap/referral/jndi.html (default: true)

### User Mapping

**`LDAP_USER_BASEDN=cn=users,dc=example,dc=org`**
Distinguished Name (DN) of the root node in LDAP from which to search for users (mandatory)

**`LDAP_USER_REQUEST=(&(objectClass=user)(sAMAccountName={login}))`**
LDAP user request. (default: (&(objectClass=inetOrgPerson)(uid={login})) )

**`LDAP_USER_REALNAMEATTRIBUTE=name`**
Attribute in LDAP defining the user’s real name. (default: cn)

**`LDAP_USER_EMAILATTRIBUTE=email`**
Attribute in LDAP defining the user’s email. (default: mail)

### Group Mapping

**`LDAP_GROUP_BASEDN=cn=groups,dc=example,dc=org`**
Distinguished Name (DN) of the root node in LDAP from which to search for groups. (optional, default: empty)

**`LDAP_GROUP_REQUEST=(&(objectClass=group)(member={dn}))`**
LDAP group request (default: (&(objectClass=groupOfUniqueNames)(uniqueMember={dn})) )

**`LDAP_GROUP_IDATTRIBUTE=sAMAccountName`**
Property used to specifiy the attribute to be used for returning the list of user groups in the compatibility mode. (default: cn)

## Compute Engine

**`SONAR_CE_JAVAOPTS=@ceJavaOpts@`**
The Compute Engine is responsible for processing background tasks.
Compute Engine is executed in a dedicated Java process. Default heap size is @ceDefaultHeapSize@.
Use the following property to customize JVM options.

[[info]]
| The HotSpot Server VM is recommended. The property -server should be added if server mode
| is not enabled by default on your environment:
| http://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html

**`SONAR_CE_JAVAADDITIONALOPTS=`**
Same as previous property, but allows to not repeat all other settings like -Xmx

## Elasticsearch

Elasticsearch is used to facilitate fast and accurate information retrieval.
It is executed in a dedicated Java process. Default heap size is @searchDefaultHeapSize@.

[[warning]]
| Linux users on 64-bit systems, ensure Virtual Memory on your system is correctly configured for Elasticsearch to run properly (see [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/vm-max-map-count.html) for details).
|
| When SonarQube runs standalone, a warning such as the following may appear in logs/es.log:
| "max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]"
|
| When SonarQube runs as a cluster, however, Elasticsearch will refuse to start.

**`SONAR_SEARCH_JAVAOPTS=@searchJavaOpts@`**
JVM options of Elasticsearch process

**`SONAR_SEARCH_JAVAADDITIONALOPTS=`**
Same as previous property, but allows to not repeat all other settings like -Xmx

**`SONAR_SEARCH_PORT=9001`**
Elasticsearch port. Default is 9001. Use 0 to get a free port.
As a security precaution, should be blocked by a firewall and not exposed to the Internet.

**`SONAR_SEARCH_HOST=`**
Elasticsearch host. The search server will bind this address and the search client will connect to it.
Default is loopback address.
As a security precaution, should NOT be set to a publicly available address.

## Update Center

**`SONAR_UPDATECENTER_ACTIVATE=true`**
Update Center requires an internet connection to request https://update.sonarsource.org
It is enabled by default.

**`HTTP_PROXYHOST=`**
**`HTTP_PROXYPORT=`**
HTTP proxy (default none)

**`HTTPS_PROXYHOST=`**
**`HTTPS_PROXYPORT=`**
HTTPS proxy (defaults are values of HTTP_PROXYHOST and HTTP_PROXYPORT)
**`HTTP_AUTH_NTLM_DOMAIN=`**
NT domain name if NTLM proxy is used

**`SOCKSPROXYHOST=`**
**`SOCKSPROXYPORT=`**
SOCKS proxy (default none)

**`HTTP_PROXYUSER=`**
**`HTTP_PROXYPASSWORD=`**
Proxy authentication (used for HTTP, HTTPS and SOCKS proxies)
**`HTTP_NONPROXYHOSTS=`**
Proxy exceptions: list of hosts that can be accessed without going through the proxy separated by the '|' character, wildcard character '*' can be used for pattern matching used for HTTP and HTTPS (default none) (note: localhost and its literal notations (127.0.0.1, ...) are always excluded).

## Logging

SonarQube produces logs in four logs files located in the same directory (see property `SONAR_PATH_LOGS` below),
one per process:
* Main process (aka. App) logs in sonar.log
* Web Server (aka. Web) logs in web.log
* Compute Engine (aka. CE) logs in ce.log
* Elasticsearch (aka. ES) logs in es.log

All four files follow the same rolling policy (see `SONAR_LOG_ROLLINGPOLICY` and `SONAR_LOG_MAXFILES`) but it applies
individually (eg. if `SONAR_LOG_MAXFILES=4`, there can be at most 4 of each files, ie. 16 files in total).

All four files have logs in the same format:

|1|2|3|
|----|----|-|--------------------|------------------------------|----|
2016.11.16 16:47:00 INFO ce[AVht0dNXFcyiYejytc3m][o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=org.sonarqube:example-java-maven | type=REPORT |

|4|5|6|
|--------------------|----------------------|-------------|
| id=AVht0dNXFcyiYejytc3m | submitter=admin | time=1699ms|

**1**: timestamp. Format is YYYY.MM.DD HH:MM:SS
YYYY: year on 4 digits
MM: month on 2 digits
DD: day on 2 digits
HH: hour of day on 2 digits in 24 hours format
MM: minutes on 2 digits
SS: seconds on 2 digits
**2**: log level.
Possible values (in order of descending criticality): ERROR, WARN, INFO, DEBUG and TRACE
**3**: process identifier. Possible values: app (main), web (Web Server), ce (Compute Engine) and es (Elasticsearch)

**4**: SQ thread identifier. Can be empty. In the Web Server, if present, it will be the HTTP request ID. In the Compute Engine, if present, it will be the task ID.
**5**: logger name. Usually a class canonical name. Package names are truncated to keep the whole field to 20 characters max
**6**: log payload. Content of this field does not follow any specific format, can vary in length and include line returns. Some logs, however, will follow the convention to provide data in payload in the format "| key=value" Especially, log of profiled pieces of code will end with "| time=XXXXms".

**`SONAR_LOG_LEVEL=INFO`**
Global level of logs (applies to all 4 processes). Supported values are INFO (default), DEBUG and TRACE

**`SONAR_LOG_LEVEL_APP=INFO`**
**`SONAR_LOG_LEVEL_WEB=INFO`**
**`SONAR_LOG_LEVEL_CE=INFO`**
**`SONAR_LOG_LEVEL_ES=INFO`**
Level of logs of each process can be controlled individually with their respective properties. When specified, they overwrite the level defined at global level. Supported values are INFO, DEBUG and TRACE

**`SONAR_PATH_LOGS=logs`**
Path to log files. Can be absolute or relative to installation directory. Default is <installation home>/logs

**`SONAR_LOG_ROLLINGPOLICY=time:yyyy-MM-dd`**
Rolling policy of log files:
* based on time if value starts with "time:", for example by day ("time:yyyy-MM-dd") or by month ("time:yyyy-MM")
* based on size if value starts with "size:", for example "size:10MB"
* disabled if value is "none". That needs logs to be managed by an external system like logrotate.

**`SONAR_LOG_MAXFILES=7`**
Maximum number of files to keep if a rolling policy is enabled.
* maximum value is 20 on size rolling policy
* unlimited on time rolling policy. Set to zero to disable old file purging.

**`SONAR_WEB_ACCESSLOGS_ENABLE=true`**
Access log is the list of all the HTTP requests received by server. If enabled, it is stored
in the file {`SONAR_PATH_LOGS`}/access.log. This file follows the same rolling policy as other log file
(see `SONAR_LOG_ROLLINGPOLICY` and `SONAR_LOG_MAXFILES`).

**`SONAR_WEB_ACCESSLOGS_PATTERN=%i{X-Forwarded-For} %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}"`**
Format of access log. It is ignored if `SONAR_WEB_ACCESSLOGS_ENABLE=false`.

Possible values are:
- "common" is the Common Log Format, shortcut to: %h %l %u %user %date "%r" %s %b
- "combined" is another format widely recognized, shortcut to: %h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}"
- else a custom pattern. See http://logback.qos.ch/manual/layouts.html#AccessPatternLayout.
The login of authenticated user is not implemented with "%u" but with "%reqAttribute{LOGIN}" (since version 6.1).
The value displayed for anonymous users is "-".

The SonarQube's HTTP request ID can be added to the pattern with "%reqAttribute{ID}" (since version 6.2).

If SonarQube is behind a reverse proxy, then the following value allows to display the correct remote IP address:

Default value (which was "combined" before version 6.2) is equivalent to "combined + SQ HTTP request ID":
`SONAR_WEB_ACCESSLOGS_PATTERN=%h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}" "%reqAttribute{ID}"`

## Others

**`SONAR_NOTIFICATIONS_DELAY=60`**
Delay in seconds between processing of notification queue. Default is 60 seconds.

**`SONAR_PATH_DATA=data`**
**`SONAR_PATH_TEMP=temp`**
Paths to persistent data files (embedded database and search index) and temporary files. Can be absolute or relative to installation directory. Defaults are respectively <installation home>/data and <installation home>/temp

**`SONAR_TELEMETRY_ENABLE=true`**
Telemetry - Share anonymous SonarQube statistics. By sharing anonymous SonarQube statistics, you help us understand how SonarQube is used so we can improve the product to work even better for you. We don't collect source code or IP addresses. And we don't share the data with anyone else. To see an example of the data shared: login as a global administrator, call the WS api/system/info and check the Statistics field.

## Development – only for developers
[[warning]]
| The following properties MUST NOT be used in production environments.

**`SONAR_SEARCH_HTTPPORT=-1`**
Elasticsearch HTTP connector


+ 44
- 4
server/sonar-docs/src/pages/setup/upgrading.md View File

@@ -13,13 +13,11 @@ Example 2 : 6.2 -> 6.7, migration path is 6.2 -> 6.7.x LTS (where x is the lates

This is a generic upgrade guide. Carefully read the [Release Upgrade Notes](/setup/upgrade-notes/) of your target version and of any intermediate version(s).

[[info]]
| **Planning to Upgrade to a Commercial Edition?**
| If you are moving to 6.7 LTS and installing a Commercial Edition, please read this [documentation](https://docs.sonarqube.org/display/SONARQUBE67/SonarSource+Editions).

[[warning]]
| Before you start, back up your SonarQube Database. Upgrade problems are rare, but you'll want the backup if anything does happen.

### Upgrading from the ZIP file

1. Download and unzip the SonarQube distribution of your edition in a fresh directory, let's say `$NEW_SONARQUBE_HOME`
2. Manually install the non-default plugins that are compatible with your version of SonarQube. Use the [Compatibility Matrix](https://docs.sonarqube.org/display/PLUG/Plugin+Version+Matrix) to ensure that the versions you install are compatible with your server version. Note that the most recent versions of all SonarSource code analyzers available in your edition are installed by default. Simply copying plugins from the old server to the new is not recommended; incompatible or duplicate plugins could cause startup errors.
3. Update the contents of `sonar.properties` and `wrapper.conf` files (in `$NEW_SONARQUBE_HOME/conf`) with the settings of the related files in the `$OLD_SONARQUBE_HOME/conf` directory (web server URL, database, ldap settings, etc.). Do not copy-paste the old files.
@@ -29,6 +27,48 @@ If you are using the Oracle DB, copy its JDBC driver into `$NEW_SONARQUBE_HOME/e
6. Browse to `http://yourSonarQubeServerURL/setup` and follow the setup instructions
7. Reanalyze your projects to get fresh data

### Upgrading from the Docker image

### To 8.2+

To upgrade to SonarQube 8.2+:

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.

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

```console
$ docker stop <image_name>
$ docker rm <image_name>
```

5. Run docker:

```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_8_x:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
<image_name>
```

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

7. Reanalyze your projects to get fresh data.

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

No specific Docker operations are needed, just use the new tag.


## Additional Information

### Oracle Clean-up

+ 7
- 1
server/sonar-docs/static/StaticNavigationTree.json View File

@@ -13,7 +13,13 @@
"/setup/overview/",
"/setup/get-started-2-minutes/",
"/setup/install-server/",
"/setup/operate-server/",
{
"title": "Configure and Operate a Server",
"children": [
"/setup/operate-server/",
"/setup/environment-variables/"
]
},
"/setup/install-plugin/",
"/setup/install-cluster/",
"/setup/operate-cluster/",

Loading…
Cancel
Save