Skip to content

Commit

Permalink
Merge branch 'Psukhe-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pghalliday committed May 6, 2015
2 parents fc815b6 + fd6f69c commit 247773f
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 45 deletions.
58 changes: 58 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,67 @@
default['sonarqube']['checksum'] = 'b257668788655bb5656b8b520e70b8a63a4a37c62a0e350a5145681eebce5ddb'
default['sonarqube']['os_kernel'] = 'linux-x86-64'

default['sonarqube']['config']['dir'] = "/opt/sonarqube-#{node['sonarqube']['version']}/conf"
default['sonarqube']['config']['file'] = 'sonar.properties'

default['sonarqube']['user'] = 'sonarqube'
default['sonarqube']['group'] = 'sonarqube'

default['sonarqube']['web']['host'] = '0.0.0.0'
default['sonarqube']['web']['context'] = nil
default['sonarqube']['web']['port'] = 9000
default['sonarqube']['web']['https']['port'] = -1 # Default value of -1 leaves https disabled

default['sonarqube']['embeddedDatabase']['dataDir'] = nil
default['sonarqube']['embeddedDatabase']['port'] = 9092

default['sonarqube']['jdbc']['username'] = 'sonar'
default['sonarqube']['jdbc']['password'] = 'sonar'
default['sonarqube']['jdbc']['url'] = 'jdbc:h2:tcp:https://localhost:9092/sonar'

default['sonarqube']['jdbc']['maxActive'] = 20
default['sonarqube']['jdbc']['maxIdle'] = 5
default['sonarqube']['jdbc']['minIdle'] = 2
default['sonarqube']['jdbc']['maxWait'] = 5000
default['sonarqube']['jdbc']['minEvictableIdleTimeMillis'] = 600_000
default['sonarqube']['jdbc']['timeBetweenEvictionRunsMillis'] = 30_000

default['sonarqube']['web']['https']['keyAlias'] = nil
default['sonarqube']['web']['https']['keyPass'] = 'changeit'
default['sonarqube']['web']['https']['keystoreFile'] = nil
default['sonarqube']['web']['https']['keystorePass'] = nil
default['sonarqube']['web']['https']['keystoreType'] = 'JKS'
default['sonarqube']['web']['https']['keystoreProvider'] = nil
default['sonarqube']['web']['https']['truststoreFile'] = nil
default['sonarqube']['web']['https']['truststorePass'] = nil
default['sonarqube']['web']['https']['truststoreType'] = 'JKS'
default['sonarqube']['web']['https']['truststoreProvider'] = nil
default['sonarqube']['web']['https']['clientAuth'] = false

default['sonarqube']['web']['http']['maxThreads'] = 50
default['sonarqube']['web']['http']['minThreads'] = 5
default['sonarqube']['web']['http']['acceptCount'] = 25
default['sonarqube']['web']['https']['minThreads'] = 5
default['sonarqube']['web']['https']['maxThreads'] = 50
default['sonarqube']['web']['https']['acceptCount'] = 25

default['sonarqube']['web']['accessLogs']['enable'] = true
default['sonarqube']['ajp']['port'] = 9009

default['sonarqube']['updatecenter']['activate'] = true
default['sonarqube']['http']['proxyHost'] = nil
default['sonarqube']['http']['proxyPort'] = nil
default['sonarqube']['http']['auth']['ntlm']['domain'] = nil
default['sonarqube']['socksProxyHost'] = nil
default['sonarqube']['socksProxyPort'] = nil
default['sonarqube']['http']['proxyUser'] = nil
default['sonarqube']['http']['proxyPassword'] = nil
default['sonarqube']['notifications']['delay'] = 60
default['sonarqube']['log']['profilingLevel'] = 'NONE'

default['sonarqube']['rails']['dev'] = false

default['sonarqube']['extra_properties'] = [
# 'sonar.security.realm=LDAP',
# 'sonar.security.savePassword=false'
]
5 changes: 0 additions & 5 deletions libraries/matchers.rb

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
license 'MIT'
description 'Installs/Configures SonarQube'
long_description 'Installs/Configures SonarQube'
version '0.2.0'
version '0.3.0'
supports 'ubuntu'
supports 'centos'
25 changes: 0 additions & 25 deletions providers/jdbc.rb

This file was deleted.

19 changes: 12 additions & 7 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
sonarqube_user = node['sonarqube']['user']
sonarqube_group = node['sonarqube']['group']

sonarqube_jdbc_username = node['sonarqube']['jdbc']['username']
sonarqube_jdbc_password = node['sonarqube']['jdbc']['password']
sonarqube_jdbc_url = node['sonarqube']['jdbc']['url']
sonarqube_config_dir = node['sonarqube']['config']['dir']
sonarqube_config_file = node['sonarqube']['config']['file']

sonarqube_zipfile_destination = ::File.join(Chef::Config[:file_cache_path], "sonarqube-#{sonarqube_version}.zip")
sonarqube_zipfile_source = "#{sonarqube_mirror}/sonarqube-#{sonarqube_version}.zip"
Expand Down Expand Up @@ -39,11 +38,17 @@
not_if { ::File.exist?(sonarqube_runscript) }
end

sonarqube_jdbc "/opt/sonarqube-#{sonarqube_version}/conf/sonar.properties" do
username sonarqube_jdbc_username
password sonarqube_jdbc_password
url sonarqube_jdbc_url
directory sonarqube_config_dir do
recursive true
mode 0700
owner sonarqube_user
group sonarqube_group
end

template "#{sonarqube_config_dir}/#{sonarqube_config_file}" do
source 'sonar.properties.erb'
notifies :restart, 'service[sonarqube]', :delayed
mode 0600
end

link '/usr/bin/sonarqube' do
Expand Down
7 changes: 0 additions & 7 deletions resources/jdbc.rb

This file was deleted.

187 changes: 187 additions & 0 deletions templates/default/sonar.properties.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Generated by Chef for <%= node['fqdn'] %>
# Local modifications will be overwritten.

# This file must contain only ISO 8859-1 characters
# see https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
#
# To use an environment variable, use the following syntax : ${env:NAME_OF_ENV_VARIABLE}
# For example:
# sonar.jdbc.url= ${env:SONAR_JDBC_URL}
#
#
# See also the file conf/wrapper.conf for JVM advanced settings

#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests only.
# Please use a production-ready database. Supported databases are MySQL, Oracle, PostgreSQL
# and Microsoft SQLServer.

# Permissions to create tables, indices and triggers must be granted to JDBC user.
# The schema must be created first.
sonar.jdbc.username=<%= node['sonarqube']['jdbc']['username'] %>
sonar.jdbc.password=<%= node['sonarqube']['jdbc']['password'] %>

#----- Embedded database H2
# Note: it does not accept connections from remote hosts, so the
# SonarQube server and the maven plugin must be executed on the same host.

# Database URL
sonar.jdbc.url=<%= node['sonarqube']['jdbc']['url'] %>

# directory containing H2 database files. By default it's the /data directory in the SonarQube installation.
sonar.embeddedDatabase.dataDir=<%= node['sonarqube']['embeddedDatabase']['dataDir'] %>
# H2 embedded database server listening port, defaults to 9092
sonar.embeddedDatabase.port=<%= node['sonarqube']['embeddedDatabase']['port'] %>

#----- Connection pool settings
sonar.jdbc.maxActive=<%= node['sonarqube']['jdbc']['maxActive'] %>
sonar.jdbc.maxIdle=<%= node['sonarqube']['jdbc']['maxIdle'] %>
sonar.jdbc.minIdle=<%= node['sonarqube']['jdbc']['minIdle'] %>
sonar.jdbc.maxWait=<%= node['sonarqube']['jdbc']['maxWait'] %>
sonar.jdbc.minEvictableIdleTimeMillis=<%= node['sonarqube']['jdbc']['minEvictableIdleTimeMillis'] %>
sonar.jdbc.timeBetweenEvictionRunsMillis=<%= node['sonarqube']['jdbc']['timeBetweenEvictionRunsMillis'] %>


#--------------------------------------------------------------------------------------------------
# WEB SERVER

# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
sonar.web.host=<%= node['sonarqube']['web']['host'] %>

# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
sonar.web.context=<%= node['sonarqube']['web']['context'] %>

# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=<%= node['sonarqube']['web']['port'] %>

# TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
sonar.web.https.port=<%= node['sonarqube']['web']['https']['port'] %>

# HTTPS - the alias used to for the server certificate in the keystore.
# If not specified the first key read in the keystore is used.
sonar.web.https.keyAlias=<%= node['sonarqube']['web']['https']['keyAlias'] %>

# HTTPS - the password used to access the server certificate from the
# specified keystore file. The default value is "changeit".
sonar.web.https.keyPass=<%= node['sonarqube']['web']['https']['keyPass'] %>

# HTTPS - the pathname of the keystore file where is stored the server certificate.
# By default, the pathname is the file ".keystore" in the user home.
# If keystoreType doesn't need a file use empty value.
sonar.web.https.keystoreFile=<%= node['sonarqube']['web']['https']['keystoreFile'] %>

# HTTPS - the password used to access the specified keystore file. The default
# value is the value of sonar.web.https.keyPass.
sonar.web.https.keystorePass=<%= node['sonarqube']['web']['https']['keystorePass'] %>

# HTTPS - the type of keystore file to be used for the server certificate.
# The default value is JKS (Java KeyStore).
sonar.web.https.keystoreType=<%= node['sonarqube']['web']['https']['keystoreType'] %>

# HTTPS - the name of the keystore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the keystore type is used (see sonar.web.https.keystoreType).
sonar.web.https.keystoreProvider=<%= node['sonarqube']['web']['https']['keystoreProvider'] %>

# HTTPS - the pathname of the truststore file which contains trusted certificate authorities.
# By default, this would be the cacerts file in your JRE.
# If truststoreFile doesn't need a file use empty value.
sonar.web.https.truststoreFile=<%= node['sonarqube']['web']['https']['truststoreFile'] %>

# HTTPS - the password used to access the specified truststore file.
sonar.web.https.truststorePass=<%= node['sonarqube']['web']['https']['truststorePass'] %>

# HTTPS - the type of truststore file to be used.
# The default value is JKS (Java KeyStore).
sonar.web.https.truststoreType=<%= node['sonarqube']['web']['https']['truststoreType'] %>

# HTTPS - the name of the truststore provider to be used for the server certificate.
# If not specified, the list of registered providers is traversed in preference order
# and the first provider that supports the truststore type is used (see sonar.web.https.truststoreType).
sonar.web.https.truststoreProvider=<%= node['sonarqube']['web']['https']['truststoreProvider'] %>

# HTTPS - whether to enable client certificate authentication.
# The default is false (client certificates disabled).
# Other possible values are 'want' (certificates will be requested, but not required),
# and 'true' (certificates are required).
sonar.web.https.clientAuth=<%= node['sonarqube']['web']['https']['clientAuth'] %>

# The maximum number of connections that the server will accept and process at any given time.
# When this number has been reached, the server will not accept any more connections until
# the number of connections falls below this value. The operating system may still accept connections
# based on the sonar.web.connections.acceptCount property. The default value is 50 for each
# enabled connector.
sonar.web.http.maxThreads=<%= node['sonarqube']['web']['http']['maxThreads'] %>
sonar.web.https.maxThreads=<%= node['sonarqube']['web']['https']['maxThreads'] %>

# The minimum number of threads always kept running. The default value is 5 for each
# enabled connector.
sonar.web.http.minThreads=<%= node['sonarqube']['web']['http']['minThreads'] %>
sonar.web.https.minThreads=<%= node['sonarqube']['web']['https']['minThreads'] %>

# The maximum queue length for incoming connection requests when all possible request processing
# threads are in use. Any requests received when the queue is full will be refused.
# The default value is 25 for each enabled connector.
sonar.web.http.acceptCount=<%= node['sonarqube']['web']['http']['acceptCount'] %>
sonar.web.https.acceptCount=<%= node['sonarqube']['web']['https']['acceptCount'] %>

# Access logs are generated in the file logs/access.log. This file is rolled over when it's 5Mb.
# An archive of 3 files is kept in the same directory.
# Access logs are enabled by default.
sonar.web.accessLogs.enable=<%= node['sonarqube']['web']['accessLogs']['enable'] %>

# TCP port for incoming AJP connections. Disabled when value is -1.
sonar.ajp.port=<%= node['sonarqube']['ajp']['port'] %>



#--------------------------------------------------------------------------------------------------
# UPDATE CENTER

# The Update Center requires an internet connection to request https://update.sonarsource.org
# It is enabled by default.
sonar.updatecenter.activate=<%= node['sonarqube']['updatecenter']['activate'] %>

# HTTP proxy (default none)
http.proxyHost=<%= node['sonarqube']['http']['proxyHost'] %>
http.proxyPort=<%= node['sonarqube']['http']['proxyPort'] %>

# NT domain name if NTLM proxy is used
http.auth.ntlm.domain=<%= node['sonarqube']['http']['auth']['ntlm']['domain'] %>

# SOCKS proxy (default none)
socksProxyHost=<%= node['sonarqube']['socksProxyHost'] %>
socksProxyPort=<%= node['sonarqube']['socksProxyPort'] %>

# proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies.
http.proxyUser=<%= node['sonarqube']['http']['proxyUser'] %>
http.proxyPassword=<%= node['sonarqube']['http']['proxyPassword'] %>


#--------------------------------------------------------------------------------------------------
# NOTIFICATIONS

# Delay (in seconds) between processing of notification queue
sonar.notifications.delay=<%= node['sonarqube']['notifications']['delay'] %>

#--------------------------------------------------------------------------------------------------
# PROFILING
# Level of information displayed in the logs: NONE (default), BASIC (functional information) and FULL (functional and technical details)
sonar.log.profilingLevel=<%= node['sonarqube']['log']['profilingLevel'] %>


#--------------------------------------------------------------------------------------------------
# DEVELOPMENT MODE
# Only for debugging

# Set to true to apply Ruby on Rails code changes on the fly
sonar.rails.dev=<%= node['sonarqube']['rails']['dev'] %>
<% node['sonarqube']['extra_properties'].each do |p| %>
<%= p %>
<% end %>

0 comments on commit 247773f

Please sign in to comment.