5 # Copyright 2011, OpenStreetMap Foundation
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 include_recipe "tools"
21 include_recipe "web::base"
23 include_recipe "apache"
26 web_passwords = data_bag_item("web", "passwords")
27 db_passwords = data_bag_item("db", "passwords")
29 directory "#{node[:web][:base_directory]}/bin" do
35 template "#{node[:web][:base_directory]}/bin/ruby" do
40 notifies :reload, "service[apache2]"
43 apache_module "passenger" do
44 conf "passenger.conf.erb"
47 package "passenger-common#{node[:web][:ruby_version]}"
49 munin_plugin "passenger_memory"
50 munin_plugin "passenger_processes"
51 munin_plugin "passenger_queues"
52 munin_plugin "passenger_requests"
54 template "/etc/cron.hourly/passenger" do
56 source "passenger.cron.erb"
62 rails_directory = "#{node[:web][:base_directory]}/rails"
64 piwik_configuration = data_bag_item("web", "piwik").to_hash.reject do |k,v|
65 ["chef_type", "data_bag", "id"].include?(k)
68 rails_port "www.openstreetmap.org" do
69 ruby node[:web][:ruby_version]
70 directory rails_directory
73 repository "git://git.openstreetmap.org/rails.git"
75 database_host node[:web][:database_host]
76 database_name "openstreetmap"
77 database_username "rails"
78 database_password db_passwords["rails"]
79 email_from "OpenStreetMap <web@noreply.openstreetmap.org>"
80 status node[:web][:status]
81 messages_domain "messages.openstreetmap.org"
82 quova_username "ws360602"
83 quova_password web_passwords["quova"]
84 soft_memory_limit node[:web][:rails_soft_memory_limit]
85 hard_memory_limit node[:web][:rails_hard_memory_limit]
86 gpx_dir "/store/rails/gpx"
87 attachments_dir "/store/rails/attachments"
88 log_path "#{node[:web][:log_directory]}/rails.log"
89 memcache_servers [ "rails1", "rails2", "rails3" ]
90 potlatch2_key web_passwords["potlatch2_key"]
91 id_key web_passwords["id_key"]
92 oauth_key web_passwords["oauth_key"]
93 piwik_location "piwik.openstreetmap.org"
96 piwik_configuration piwik_configuration