Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql and sonar-plugin support #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# General settings
default['sonar']['dir'] = "/opt/sonar"
default['sonar']['version'] = "2.11"
default['sonar']['version'] = "2.13.1"
default['sonar']['checksum'] = "9d05e25ca79c33d673004444d89c8770"
default['sonar']['os_kernel'] = "linux-x86-32"
default['sonar']['mirror'] = "http://dist.sonar.codehaus.org"
default['sonar']['plugins_repo'] = "http://repository.codehaus.org/org/codehaus/sonar-plugins"
default['sonar']['plugins_dir'] = "extensions/plugins"

# Web settings
# The default listen port is 9000, the default context path is / and Sonar listens by default to all network interfaces : '0.0.0.0'.
Expand Down
10 changes: 10 additions & 0 deletions definitions/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define :sonar_plugin, :version => "1.0" do
remote_file "#{node[:sonar][:dir]}/#{node[:sonar][:plugins_dir]}/#{params[:name]}-#{params[:version]}.jar" do
source "#{node[:sonar][:plugins_repo]}/#{params[:name]}/#{params[:version]}/#{params[:name]}-#{params[:version]}.jar"
owner "root"
group "root"
mode 0755
notifies :restart, resources(:service => "sonar")
not_if "test -f #{node[:sonar][:dir]}/#{node[:sonar][:plugins_dir]}/#{params[:name]}-#{params[:version]}.jar"
end
end
11 changes: 6 additions & 5 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
to "/opt/sonar-#{node['sonar']['version']}"
end

link "/etc/init.d/sonar" do
to "/opt/sonar/bin/#{node['sonar']['os_kernel']}/sonar.sh"
end

service "sonar" do
stop_command "sh /opt/sonar/bin/#{node['sonar']['os_kernel']}/sonar.sh stop"
start_command "sh /opt/sonar/bin/#{node['sonar']['os_kernel']}/sonar.sh start"
status_command "sh /opt/sonar/bin/#{node['sonar']['os_kernel']}/sonar.sh status"
restart_command "sh /opt/sonar/bin/#{node['sonar']['os_kernel']}/sonar.sh restart"
action :start
supports :status => true, :restart => true
action :enable
end

template "sonar.properties" do
Expand Down
27 changes: 27 additions & 0 deletions recipes/mysql.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Cookbook Name:: sonar
# Recipe:: mysql
#
# Copyright 2011, Srinivasan Raguraman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Database settings
# @see conf/sonar.properties for examples for different databases
node.default['sonar']['jdbc_url'] = "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"
node.default['sonar']['jdbc_driverClassName'] = "com.mysql.jdbc.Driver"
node.default['sonar']['jdbc_validationQuery'] = "select 1"

include_recipe "sonar::default"
include_recipe "sonar::database_mysql"
5 changes: 5 additions & 0 deletions recipes/plugins.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# installs common sonar plugins used enterprise wide
#

sonar_plugin "sonar-build-breaker-plugin"
sonar_plugin "sonar-taglist-plugin"