From bdee66ca7453769b9097e659119163c5971ed01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Z=2E=20K=C3=B6v=C3=A9r?= Date: Tue, 21 Nov 2017 22:02:09 +0100 Subject: [PATCH] Upgrade SonarQube to version 6.7 --- templates/sonarqube/2/README.md | 19 +++++ templates/sonarqube/2/docker-compose.yml.tpl | 67 ++++++++++++++++ templates/sonarqube/2/rancher-compose.yml | 84 ++++++++++++++++++++ templates/sonarqube/config.yml | 2 +- 4 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 templates/sonarqube/2/README.md create mode 100644 templates/sonarqube/2/docker-compose.yml.tpl create mode 100644 templates/sonarqube/2/rancher-compose.yml diff --git a/templates/sonarqube/2/README.md b/templates/sonarqube/2/README.md new file mode 100644 index 0000000..b95a44c --- /dev/null +++ b/templates/sonarqube/2/README.md @@ -0,0 +1,19 @@ +## What is inside SonarQube Stack? +* [SonarQube Server](http://www.sonarqube.org/) + Sidekick for storing plugins +* Postgres Database + Sidekick for storing data + +## Info +* In default SonarQube package will install alpine docker version and will create "sonar" postgres database, user and password. +* SonarQube service is exposed by a loadbalancer. +* Optional, you could install non alpine version. Use it if your software needs glibc. +* Optional, you could use an external postgres database link. +* Once SonarQube will start, make sure you setup correct information in setup page. +* For easy upgrades there are sidekicks for postgres data with dedicated storage. + +## Installing Plugins Manually +* Go to [Plugin Library](http://docs.sonarqube.org/display/PLUG/Plugin+Library) and find your favourite plugins +* Execute `docker exec -it [sonarqube-data bash]`, go to /opt/sonarqube/extensions/plugins and put your plugins here +* Restart SonarQube container. + +## First Start +* Use admin/admin to login to the SonarQube interface. \ No newline at end of file diff --git a/templates/sonarqube/2/docker-compose.yml.tpl b/templates/sonarqube/2/docker-compose.yml.tpl new file mode 100644 index 0000000..8fcb41b --- /dev/null +++ b/templates/sonarqube/2/docker-compose.yml.tpl @@ -0,0 +1,67 @@ +version: '2' +services: + sonarqube-lb: + image: rancher/lb-service-haproxy:v0.7.6 + ports: + - ${http_port}:${http_port} + sonarqube-storage: + network_mode: none + labels: + io.rancher.container.hostname_override: container_name + io.rancher.container.start_once: true + environment: + - SERVICE_UID=0 + - SERVICE_GID=0 + - SERVICE_VOLUME=/opt/sonarqube/extensions/plugins + volumes: + - sonarqube-plugin:/opt/sonarqube/extensions/plugins + image: rawmind/alpine-volume:0.0.2-1 + sonarqube: + labels: + io.rancher.container.hostname_override: container_name + io.rancher.sidekicks: sonarqube-storage + image: sonarqube:${docker_version} + environment: + SONARQUBE_WEB_JVM_OPTS: ${jvm_opts} + SONARQUBE_JDBC_USERNAME: ${postgres_user} + SONARQUBE_JDBC_PASSWORD: ${postgres_password} + SONARQUBE_JDBC_URL: jdbc:postgresql://db:${postgres_port}/${postgres_db} + volumes_from: + - sonarqube-storage +{{- if ne .Values.postgres_link ""}} + external_links: + - ${postgres_link}:db +{{- else}} + links: + - db:db + db: + labels: + io.rancher.container.hostname_override: container_name + io.rancher.sidekicks: db-storage + image: postgres:9.6.3-alpine + environment: + POSTGRES_USER: ${postgres_user} + POSTGRES_PASSWORD: ${postgres_password} + POSTGRES_DB: ${postgres_db} + volumes_from: + - db-storage + db-storage: + network_mode: none + labels: + io.rancher.container.hostname_override: container_name + io.rancher.container.start_once: true + environment: + - SERVICE_UID=0 + - SERVICE_GID=0 + - SERVICE_VOLUME=/var/lib/postgresql + volumes: + - db-data:/var/lib/postgresql + image: rawmind/alpine-volume:0.0.2-1 +{{- end}} +volumes: + sonarqube-plugin: + driver: local +{{- if eq .Values.postgres_link ""}} + db-data: + driver: local +{{- end}} diff --git a/templates/sonarqube/2/rancher-compose.yml b/templates/sonarqube/2/rancher-compose.yml new file mode 100644 index 0000000..4d4454c --- /dev/null +++ b/templates/sonarqube/2/rancher-compose.yml @@ -0,0 +1,84 @@ +version: '2' +catalog: + name: "SonarQube" + version: "v6.7" + description: "SonarQube" + uuid: sonarqube-0 + minimum_rancher_version: v0.51.0 + questions: + - variable: docker_version + description: "SonarQube docker version" + label: "SonarQube docker version" + required: true + default: "6.7-alpine" + type: "enum" + options: + - 6.7-alpine + - 6.7 + - variable: http_port + description: "SonarQube http port" + label: "SonarQube http Port" + required: true + default: "9000" + type: "int" + - variable: jvm_opts + description: "SonarQube web jvm options" + label: "SonarQube web jvm options" + required: false + default: "" + type: "string" + - variable: postgres_port + description: "Postgres Port" + label: "Postgres Port" + required: true + default: "5432" + type: "int" + - variable: postgres_db + description: "Postgres Database Name" + label: "Postgres Database" + required: true + default: "sonar" + type: "string" + - variable: postgres_user + description: "Postgres User" + label: "Postgres User" + required: true + default: "sonar" + type: "string" + - variable: postgres_password + description: "Postgres Password" + label: "Postgres Password" + required: true + default: "sonar" + type: "password" + - variable: "postgres_link" + description: | + Optional external postgres service to use. + label: "Postgres stack/service" + default: "" + required: false + type: "service" +services: + sonarqube-lb: + scale: 1 + lb_config: + port_rules: + - protocol: http + service: sonarqube + source_port: ${http_port} + target_port: 9000 + health_check: + response_timeout: 2000 + healthy_threshold: 2 + port: 42 + unhealthy_threshold: 3 + sonarqube: + scale: 1 + retain_ip: true + health_check: + port: 9000 + interval: 5000 + unhealthy_threshold: 3 + request_line: 'GET / HTTP/1.0' + healthy_threshold: 2 + response_timeout: 5000 diff --git a/templates/sonarqube/config.yml b/templates/sonarqube/config.yml index 13373da..c6bcb39 100644 --- a/templates/sonarqube/config.yml +++ b/templates/sonarqube/config.yml @@ -1,5 +1,5 @@ name: SonarQube description: | SonarQube - an open source quality management platform. -version: v6.5 +version: v6.7 category: Test Automation