#0000 - Add Docker Compose setup for SonarQube with configuration
Introduce Docker Compose setup to deploy SonarQube with PostgreSQL and Traefik integration. Added necessary configuration files including `.env.dist`, `.gitignore`, and `LICENSE`. Updated README with detailed installation and usage instructions.
This commit is contained in:
parent
34a7d4ef26
commit
6bac073d56
6 changed files with 140 additions and 1 deletions
5
.env.dist
Normal file
5
.env.dist
Normal file
|
@ -0,0 +1,5 @@
|
|||
SONAR_FQDN='example.com'
|
||||
|
||||
POSTGRES_USERNAME='CHANGEME'
|
||||
|
||||
POSTGRES_PASSWORD='CHANGEME'
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.env
|
21
LICENCE
Normal file
21
LICENCE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Guillaume 'B.B.' Van Hemmen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
54
README.md
54
README.md
|
@ -1,3 +1,55 @@
|
|||
# SonarQube
|
||||
|
||||
SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and code smells on 29 programming languages. SonarQube offers reports on duplicated code, coding standards, unit tests, code coverage, code complexity, comments, bugs, and security recommendations. SonarQube provides automated analysis and integration with Maven, Ant, Gradle, MSBuild, and continuous integration tools.
|
||||
## Introduction
|
||||
|
||||
This project provides a Docker Compose setup for quickly setting up a SonarQube instance. SonarQube is an open-source
|
||||
platform for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect
|
||||
bugs, code smells, and security vulnerabilities.
|
||||
|
||||
## Table of contents
|
||||
|
||||
1. [Introduction](#introduction)
|
||||
2. [Table of contents](#table-of-contents)
|
||||
3. [Prerequisites](#prerequisites)
|
||||
4. [Installation](#installation)
|
||||
5. [Usage](#usage)
|
||||
6. [License](#license)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker: Make sure Docker is installed and running on your system.
|
||||
- Docker Compose: You also need Docker Compose to orchestrate the container setup.
|
||||
- To have
|
||||
deployed [Traefik standalone](https://git.van-hemmen.com/GuillaumeHemmen-DockerCompose-Infra/traefik-standalone)
|
||||
or [Traefik Authelia](https://git.van-hemmen.com/GuillaumeHemmen-DockerCompose-Infra/traefik-authelia)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
```bash
|
||||
git clone https://git.van-hemmen.com/GuillaumeHemmen-DockerCompose-Infra/sonarqube.git
|
||||
cd sonarqube
|
||||
```
|
||||
|
||||
2. Copy the environment variable template:
|
||||
|
||||
```bash
|
||||
cp .env.dist .env
|
||||
```
|
||||
|
||||
3. Customize the `.env` file as necessary for your environment.
|
||||
|
||||
## Usage
|
||||
|
||||
Start the Traefik service with Docker Compose:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Access SonarQube by navigating to `https://<SONAR_FQDN>` in your web browser.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the MIT license. See the [LICENSE](LICENCE) file for details.
|
||||
|
|
60
docker-compose.yml
Normal file
60
docker-compose.yml
Normal file
|
@ -0,0 +1,60 @@
|
|||
networks:
|
||||
network:
|
||||
traefik_network:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
postgresql:
|
||||
postgresql_data:
|
||||
|
||||
|
||||
services:
|
||||
app:
|
||||
image: sonarqube:10.4-community
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
labels:
|
||||
- "traefik.docker.network=traefik_network"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.sonarqube.rule=Host(`${SONAR_FQDN}`)"
|
||||
- "traefik.http.routers.sonarqube.entrypoints=websecure"
|
||||
- "traefik.http.routers.sonarqube.tls.certresolver=myresolver"
|
||||
networks:
|
||||
- traefik_network
|
||||
- network
|
||||
volumes:
|
||||
# https://github.com/mc1arke/sonarqube-community-branch-plugin
|
||||
- ./plugins/sonarqube-community-branch-plugin-1.19.0.jar:/opt/sonarqube/extensions/plugins/sonarqube-branch-plugin.jar
|
||||
environment:
|
||||
- SONAR_JDBC_USERNAME=${POSTGRES_USERNAME}
|
||||
- SONAR_JDBC_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- SONAR_JDBC_URL=jdbc:postgresql://postgresql:5432/sonar
|
||||
- SONAR_WEB_JAVAADDITIONALOPTS=-javaagent:./extensions/plugins/sonarqube-branch-plugin.jar=web
|
||||
- SONAR_CE_JAVAADDITIONALOPTS=-javaagent:./extensions/plugins/sonarqube-branch-plugin.jar=ce
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: any
|
||||
delay: 5s
|
||||
|
||||
postgresql:
|
||||
image: postgres:11
|
||||
networks:
|
||||
- network
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USERNAME}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgresql:/var/lib/postgresql
|
||||
- postgresql_data:/var/lib/postgresql/data
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: any
|
||||
delay: 5s
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready", "-U", "$${POSTGRES_USERNAME}", "-d", "sonar" ]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 10
|
BIN
plugins/sonarqube-community-branch-plugin-1.19.0.jar
Normal file
BIN
plugins/sonarqube-community-branch-plugin-1.19.0.jar
Normal file
Binary file not shown.
Loading…
Reference in a new issue