Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msfidelis/sonarqube-stack
:package: :whale: :package: :whale: Local and Kubernetes example to deploy Sonarqube server to CI
https://github.com/msfidelis/sonarqube-stack
ci cloud docker docker-compose kubernetes quality-assurance sonarqube
Last synced: 3 months ago
JSON representation
:package: :whale: :package: :whale: Local and Kubernetes example to deploy Sonarqube server to CI
- Host: GitHub
- URL: https://github.com/msfidelis/sonarqube-stack
- Owner: msfidelis
- Created: 2021-04-01T00:25:28.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-02T15:41:52.000Z (almost 4 years ago)
- Last Synced: 2024-10-02T09:18:22.635Z (3 months ago)
- Topics: ci, cloud, docker, docker-compose, kubernetes, quality-assurance, sonarqube
- Homepage:
- Size: 65.4 KB
- Stars: 15
- Watchers: 2
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Running Local
## Setup local stack
```
docker-compose up -d postgresql
docker-compose up --force-recreate
```## Login
Access http://0.0.0.0:9000 in your browser and wait for sonar setup
The initial user and password for admin user is `admin/admin`. Change on first access.
## Generate your user token for CI
Access in your user menu, `My Account` > `Security` > `Generate Tokens`
![account](/.github/img/account.png)
![token](/.github/img/token.png)
## Configure sonar-project.properties on your application
```bash
echo '''
sonar.projectKey=chip
sonar.projectName=chip
sonar.sources=./
sonar.sourceEncoding=UTF-8
''' > sonar-project.properties
```## Run your first scan
```
docker run \
--rm \
-e SONAR_HOST_URL="http://0.0.0.0:9000" \
-e SONAR_LOGIN=2f165ff1a9ed5241471d0a9ce32e8e93ac63ffa5 \
-v "$(pwd):/usr/src" \
--network host \
sonarsource/sonar-scanner-cli
```# Kubernetes
### Create namespace
```bash
kubectl apply -f namespaces.yml
```### Edit and create configmaps and secrets
```bash
kubectl apply -f configmap.yml
```### Deploy a postgresql stack
```bash
kubectl apply -f postgresql.yml
```### Deploy a sonarqube stack
```bash
kubectl apply -f sonarqube.yml
```## Run your first scan
```
docker run \
--rm \
-e SONAR_HOST_URL="http://sonarqube.raj.ninja" \
-e SONAR_LOGIN=2f165ff1a9ed5241471d0a9ce32e8e93ac63ffa5 \
-v "$(pwd):/usr/src" \
--network host \
sonarsource/sonar-scanner-cli
```