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 rails_port "www.openstreetmap.org" do
 
  65   ruby node[:web][:ruby_version]
 
  66   directory rails_directory
 
  69   repository "git://git.openstreetmap.org/rails.git"
 
  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"