Skip to content

Commit

Permalink
Merge pull request #1 from Springjunky/SONAR
Browse files Browse the repository at this point in the history
Sonar added
  • Loading branch information
Springjunky authored Feb 19, 2018
2 parents 2b884f0 + 25a119e commit 7354d8a
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 38 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ My personal solution is a local, docker-based CI/CD Build Environment ready in a
* docker-compose version >= 1.15.0

## Installation
### without sonar
Bring up your own build environment ... just do a
```
git clone https://github.com/Springjunky/docker-local-build-environment.git
Expand All @@ -25,6 +26,20 @@ Bring up your own build environment ... just do a
docker-compose up --build -d
docker-compose logs
```

### with sonar
Warning: you need a lot of memory to use the full toolset (more than 10GB)
```
git clone https://github.com/Springjunky/docker-local-build-environment.git
cd docker-local-build-environment
sudo ./setupEnvironment.sh
docker-compose -f docker-compose.yml -f docker-compose-sonar.yml up --build
docker-compose logs
```




### The first startup takes a long time (especially gitlab), so be patient

open your favorite browser (_not_ at localhost, use the $(hostname)/jenkins )
Expand Down Expand Up @@ -121,7 +136,7 @@ It takes a long time until gitlab is ready to accept a runner registration, if i
Gitlab is very very fast with new releases and sometimes the api has breaking changes. If something does not work take a look at the Jenkins Bugtracker.

### Sonar
In future releases Sonar will be added...(You need to install some rules (Administration - System - Update Center - Available - Search: Java)
You need to install some rules (Administration - System - Update Center - Available - Search: Java)

### Nexus
Some ToDo for me described here
Expand Down Expand Up @@ -162,7 +177,7 @@ every ping must work, if not, check extra_hosts in compose-file
* ~~install ansible~~
* ~~apply a gitlab runner~~
* ~~apply git-lfs~~
* apply sonar
* ~~apply sonar~~
* apply a better registry


Expand Down
26 changes: 0 additions & 26 deletions docker-compose-sonar-part.yml.template

This file was deleted.

35 changes: 35 additions & 0 deletions docker-compose-sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# docker-sonar configuration,
# add this to your docker-compose up if you want to have sonarqube
# docker-compose -f docker-xcompose.yml -f docker-compose-sonar.yml up
version: "3"

services:
postgres:
image: postgres
extra_hosts:
- ${DC_HOSTNAME}:${DC_HOSTIP}
networks:
- devstacknetwork
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- ${DC_BASE_DATA_DIR}/postgres-db/postgresql:/var/lib/postgresql
# This needs explicit mapping due to
# https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
- ${DC_BASE_DATA_DIR}/postgres-db/postgresql_data:/var/lib/postgresql/data

sonar:
image: sonarqube
extra_hosts:
- ${DC_HOSTNAME}:${DC_HOSTIP}
networks:
- devstacknetwork
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://postgres:5432/sonar
volumes:
- ${DC_BASE_DATA_DIR}/sonar/sonarqube_conf:/opt/sonarqube/conf
- ${DC_BASE_DATA_DIR}/sonar/sonarqube_data:/opt/sonarqube/data
- ${DC_BASE_DATA_DIR}/sonar/sonarqube_extensions:/opt/sonarqube/extensions
- ${DC_BASE_DATA_DIR}/sonar/sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ services:
# SSH Bypassing into gitlab, if you want to change this edit nginx.conf also
- "2222:2222" #ssh port of gitlab (ssh://git@myHOST:2222/scott/foo.git)
- "5555:5555" #Gitlab Docker Registry do NOT use 5000, this is an internal PORT of the gitlab-ce Image
depends_on: # start proxy after all the others
- gitlab
- jenkins
- nexus
networks:
- devstacknetwork

# ------------------------------------------------------------------------------
jenkins-fat:
jenkins:
build: jenkins-fat
extra_hosts:
- ${DC_HOSTNAME}:${DC_HOSTIP}
Expand Down
22 changes: 14 additions & 8 deletions nginx-reverse/reverse-proxy.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

# Setting all teh prefixes is a crazy ..
# Setting all the prefixes is a crazy ..

server {
listen 80;
server_name "" ;
Expand All @@ -13,7 +14,7 @@ server {

# Same like ENV JENKINS_OPTS=.....--prefix=/jenkins in jenkins-fat/Jenkins-Dockerfile
location ^~/jenkins {
proxy_pass http://jenkins-fat:8080;
proxy_pass http://jenkins:8080;
include /etc/nginx/conf.d/proxy-settings.conf;
}

Expand All @@ -22,11 +23,16 @@ server {
proxy_pass http://nexus:8081;
include /etc/nginx/conf.d/proxy-settings.conf;
}
#Future Use
# # Same like sonar.web.context=/sonar in preconfig/sonar/sonar.properties
# location ^~/sonar {
# proxy_pass http://sonar:9000;
# include /etc/nginx/conf.d/proxy-settings.conf;
# }
#Future Use
# Same like sonar.web.context=/sonar in preconfig/sonar/sonar.properties
location ^~/sonar {
# prevent nginx to throw errors if sonar
# is not available
# 127.0.0.11 is the Docker DNS
resolver 127.0.0.11 valid=05s;
set $sonarvm sonar;
proxy_pass http://$sonarvm:9000;
include /etc/nginx/conf.d/proxy-settings.conf;
}

}
2 changes: 1 addition & 1 deletion preconfig/sonar/sonar.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Only one Property is need
# Only one Property is need (because sonar ist behind nginx)
sonar.web.context=/sonar

0 comments on commit 7354d8a

Please sign in to comment.