Skip to content

making/sonarqube-on-cf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

cf create-service <your-mysql-service> <your-mysql-plan> sonar-db
# Sonar support MySQL 5.6+
# e.g. cf create-service p.mysql db-small sonar-db
cf create-service-key sonar-db sonar
cf service-key sonar-db sonar | awk 'NR>2 {print}' | ruby -ryaml -rjson -e 'puts YAML.dump(JSON.load(ARGF))' > credentials.yml
cat <<'EOF' > manifest.yml
applications:
- name: sonar
  memory: 2g
  health-check-type: http
  health-check-http-endpoint: /
  docker:
    image: sonarqube:7.4-community
  env:
    SONARQUBE_JDBC_USERNAME: ((username))
    SONARQUBE_JDBC_PASSWORD: ((password))
    SONARQUBE_JDBC_URL: jdbc:mysql://((hostname)):((port))/((name))?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
EOF
cf push --random-route --vars-file credentials.yml

it assumes that credentials.yml should be created via the command above. If you don't have the service broker, you can create credentials.yml by yourself that has following values:

---
hostname: 192.168.12.161
name: foo_db
password: password
port: 3306
username: user

Installing plugins

Installing plugins via Marketplace doesn't work well since download files exist in the ephemeral disk and will disapper when the container is restarted. You can use Manual Installation. You need to have plugins before sonar starts and place them into /opt/sonarqube/extensions/plugins.

Here is an example to install GitHub Authentication Plugin.

cat <<EOF > manifest.yml
applications:
- name: sonar
  memory: 2g
  health-check-type: http
  health-check-http-endpoint: /
  command: |
    wget -q -P /opt/sonarqube/extensions/plugins/ https://binaries.sonarsource.com/Distribution/sonar-auth-github-plugin/sonar-auth-github-plugin-1.4.0.695.jar && \
    ./bin/run.sh 
  docker:
    image: sonarqube:7.4-community
  env:
    SONARQUBE_JDBC_USERNAME: ((username))
    SONARQUBE_JDBC_PASSWORD: ((password))
    SONARQUBE_JDBC_URL: jdbc:mysql://((hostname)):((port))/((name))?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
EOF

About

How to deploy SonarQube on Cloud Foundry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published