]> git.openstreetmap.org Git - chef.git/blob - cookbooks/web/recipes/rails.rb
Require version 1.3.5 of bundler for ruby 2.0 support
[chef.git] / cookbooks / web / recipes / rails.rb
1 #
2 # Cookbook Name:: web
3 # Recipe:: rails
4 #
5 # Copyright 2011, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "tools"
21 include_recipe "web::base"
22
23 include_recipe "apache"
24 include_recipe "git"
25
26 web_passwords = data_bag_item("web", "passwords")
27 db_passwords = data_bag_item("db", "passwords")
28
29 directory "#{node[:web][:base_directory]}/bin" do
30   owner "root"
31   group "root"
32   mode 0755
33 end
34
35 template "#{node[:web][:base_directory]}/bin/ruby" do
36   source "ruby.erb"
37   owner "root"
38   group "root"
39   mode 0755
40   notifies :reload, "service[apache2]"
41 end
42
43 apache_module "passenger" do
44   conf "passenger.conf.erb"
45 end
46
47 package "passenger-common#{node[:web][:ruby_version]}"
48
49 munin_plugin "passenger_memory"
50 munin_plugin "passenger_processes"
51 munin_plugin "passenger_queues"
52 munin_plugin "passenger_requests"
53
54 template "/etc/cron.hourly/passenger" do
55   cookbook "web"
56   source "passenger.cron.erb"
57   owner "root"
58   group "root"
59   mode 0755
60 end
61
62 rails_directory = "#{node[:web][:base_directory]}/rails"
63
64 rails_port "www.openstreetmap.org" do
65   ruby node[:web][:ruby_version]
66   directory rails_directory
67   user "rails"
68   group "rails"
69   repository "git://git.openstreetmap.org/rails.git"
70   revision "live"
71   database_host node[:web][:database_host]
72   database_name "openstreetmap"
73   database_username "rails"
74   database_password db_passwords["rails"]
75   email_from "OpenStreetMap <web@noreply.openstreetmap.org>"
76   status node[:web][:status]
77   messages_domain "messages.openstreetmap.org"
78   quova_username "ws360602"
79   quova_password web_passwords["quova"]
80   soft_memory_limit node[:web][:rails_soft_memory_limit]
81   hard_memory_limit node[:web][:rails_hard_memory_limit]
82   gpx_dir "/store/rails/gpx"
83   attachments_dir "/store/rails/attachments"
84   log_path "#{node[:web][:log_directory]}/rails.log"
85   memcache_servers [ "rails1", "rails2", "rails3" ]
86   potlatch2_key web_passwords["potlatch2_key"]
87   id_key web_passwords["id_key"]
88   oauth_key web_passwords["oauth_key"]
89   piwik_location "piwik.openstreetmap.org"
90   piwik_site 1
91   piwik_signup_goal 1
92 end