5 # Copyright 2012, 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 "apache"
 
  21 include_recipe "postgresql"
 
  24 package "python-psycopg2"
 
  28 package "ruby#{node[:owl][:ruby]}"
 
  29 package "ruby#{node[:owl][:ruby]}-dev"
 
  30 package "rubygems#{node[:owl][:ruby]}"
 
  31 package "irb#{node[:owl][:ruby]}"
 
  33 gem_package "bundler#{node[:owl][:ruby]}" do
 
  34   package_name "bundler"
 
  35   gem_binary "gem#{node[:owl][:ruby]}"
 
  36   options "--format-executable"
 
  39 apache_module "deflate"
 
  41 apache_module "passenger" do
 
  42   conf "passenger.conf.erb"
 
  45 munin_plugin "passenger_memory"
 
  46 munin_plugin "passenger_processes"
 
  47 munin_plugin "passenger_queues"
 
  48 munin_plugin "passenger_requests"
 
  50 postgresql_user "tomh" do
 
  55 postgresql_user "matt" do
 
  60 postgresql_user "ppawel" do
 
  65 postgresql_user "owl" do
 
  69 postgresql_database "owl" do
 
  74 postgresql_munin "owl" do
 
  79 # grant select on changeset_tiles to owl;
 
  80 # grant select on geometry_columns to owl;
 
  81 # grant select on changesets to owl;
 
  82 # grant select on users to owl;
 
  84 directory "/srv/owl.openstreetmap.org" do
 
  90 file "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt" do
 
  94 execute "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile" do
 
  96   command "bundle#{node[:owl][:ruby]} install"
 
  97   cwd "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails"
 
 100   notifies :touch, "file[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt]"
 
 103 git "/srv/owl.openstreetmap.org/openstreetmap-watch-list" do
 
 105   repository "git://github.com/ppawel/openstreetmap-watch-list.git"
 
 106   revision "owl.osm.org"
 
 109   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
 
 112 directory "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp" do
 
 117 file "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/environment.rb" do
 
 122 template "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/database.yml" do
 
 123   source "database.yml.erb"
 
 127   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
 
 128   only_if { node[:postgresql][:clusters][:"9.1/main"] }
 
 131 apache_site "owl.openstreetmap.org" do
 
 132   template "apache.erb"
 
 133   variables :aliases => [ "owl.osm.org" ]