Skip to content

Commit

Permalink
Merge branch 'master' into hobodave/COOK-230
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Jan 6, 2010
2 parents 71deaf6 + 3bc45e8 commit 18388bb
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bootstrap/templates/default/client.rb.erb
Expand Up @@ -25,6 +25,6 @@ role_url "http://<%= @node[:bootstrap][:chef][:server_fqdn] %>:4000"

file_cache_path "<%= @node[:bootstrap][:chef][:cache_path] %>"

pid_file "<%= @node[:bootstrap][:chef][:run_path] %>/chef-client.pid"
pid_file "<%= @node[:bootstrap][:chef][:run_path] %>/client.pid"

Chef::Log::Formatter.show_time = <%= @show_time %>
2 changes: 1 addition & 1 deletion chef/templates/default/client.rb.erb
Expand Up @@ -25,6 +25,6 @@ role_url "http://<%= @node[:chef][:server_fqdn] %>:4000"

file_cache_path "<%= @node[:chef][:cache_path] %>"

pid_file "<%= @node[:chef][:run_path] %>/chef-client.pid"
pid_file "<%= @node[:chef][:run_path] %>/client.pid"

Chef::Log::Formatter.show_time = <%= @show_time %>
33 changes: 33 additions & 0 deletions instiki/README.rdoc
@@ -0,0 +1,33 @@
= DESCRIPTION:

Installs instiki, a Ruby on Rails wiki server under passenger+Apache2.

= REQUIREMENTS:

Opscode cookbooks:

* apache2
* passenger_apache2
* sqlite
* rails

= USAGE:

Simply apply the 'instiki' recipe. This installs version 0.17 in /srv/instiki/instiki-0.17. A later version of this cookbook might support setting the version and a different installation path, but for now these are hardcoded.

= LICENSE and AUTHOR:

Author:: Joshua Timberman <joshua@opscode.com>

Copyright 2009, Opscode, Inc

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
10 changes: 10 additions & 0 deletions instiki/metadata.rb
@@ -0,0 +1,10 @@
maintainer "Opscode"
maintainer_email "joshua@opscode.com"
license "Apache 2.0"
description "Installs instiki, a Ruby on Rails wiki server under passenger+Apache2."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.1"

%w{ apache2 passenger_apache2 sqlite rails }.each do |cb|
depends cb
end
50 changes: 50 additions & 0 deletions instiki/recipes/default.rb
@@ -0,0 +1,50 @@
#
# Cookbook Name:: instiki
# Recipe:: default
#
# Copyright 2009, Opscode
#
# 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.
#

include_recipe "sqlite"
include_recipe "rails"
include_recipe "apache2"
include_recipe "apache2::mod_rewrite"
include_recipe "passenger_apache2"
include_recipe "passenger_apache2::mod_rails"

remote_file "/tmp/instiki-0.17.tar.gz" do
source "http://rubyforge.org/frs/download.php/59127/instiki-0.17.tgz"
mode 0644
owner "root"
group "root"
not_if { ::FileTest.exists?("/tmp/instiki-0.17.tar.gz") }
end

directory "/srv/instiki" do
owner node[:apache][:user]
end

execute "tar zxf /tmp/instiki-0.17.tar.gz -C /srv/instiki" do
user node[:apache][:user]
creates "/srv/instiki/instiki-0.17/instiki"
end

web_app "instiki" do
docroot "/srv/instiki/instiki-0.17/public"
template "instiki.conf.erb"
server_name "wiki.#{node[:domain]}"
server_aliases [ "wiki", "instiki", node[:hostname] ]
rails_env "production"
end
20 changes: 20 additions & 0 deletions instiki/templates/default/instiki.conf.erb
@@ -0,0 +1,20 @@
<VirtualHost *:80>
ServerName <%= @params[:server_name] %>
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>
DocumentRoot <%= @params[:docroot] %>

RailsBaseURI /
RailsEnv <%= @params[:rails_env] %>

<Directory <%= @params[:docroot] %>>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

LogLevel info
ErrorLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
CustomLog <%= @node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
</VirtualHost>

1 change: 0 additions & 1 deletion mysql/recipes/client.rb
Expand Up @@ -43,7 +43,6 @@

else
r = gem_package "mysql" do
version "2.7"
action :nothing
end

Expand Down
22 changes: 14 additions & 8 deletions mysql/recipes/server.rb
Expand Up @@ -91,15 +91,21 @@

end

begin
t = resources(:template => "/etc/mysql/grants.sql")
rescue
Chef::Log.warn("Could not find previously defined grants.sql resource")
t = template "/etc/mysql/grants.sql" do
source "grants.sql.erb"
owner "root"
group "root"
mode "0600"
action :create
end
end

execute "mysql-install-privileges" do
command "/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} < /etc/mysql/grants.sql"
action :nothing
end

template "/etc/mysql/grants.sql" do
source "grants.sql.erb"
owner "root"
group "root"
mode "0600"
notifies :run, resources(:execute => "mysql-install-privileges"), :immediately
subscribes :run, resources(:template => "/etc/mysql/grants.sql")
end

0 comments on commit 18388bb

Please sign in to comment.