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 "passenger" do
 
  40   conf "passenger.conf.erb"
 
  43 munin_plugin "passenger_memory"
 
  44 munin_plugin "passenger_processes"
 
  45 munin_plugin "passenger_queues"
 
  46 munin_plugin "passenger_requests"
 
  48 postgresql_user "tomh" do
 
  53 postgresql_user "matt" do
 
  58 postgresql_user "ppawel" do
 
  63 postgresql_user "owl" do
 
  67 postgresql_database "owl" do
 
  72 postgresql_munin "owl" do
 
  77 # grant select on changeset_tiles to owl;
 
  78 # grant select on geometry_columns to owl;
 
  79 # grant select on changesets to owl;
 
  80 # grant select on users to owl;
 
  82 directory "/srv/owl.openstreetmap.org" do
 
  88 file "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt" do
 
  92 execute "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile" do
 
  94   command "bundle#{node[:owl][:ruby]} install"
 
  95   cwd "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails"
 
  98   notifies :touch, "file[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt]"
 
 101 git "/srv/owl.openstreetmap.org/openstreetmap-watch-list" do
 
 103   repository "git://github.com/ppawel/openstreetmap-watch-list.git"
 
 104   revision "owl.osm.org"
 
 107   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
 
 110 directory "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp" do
 
 115 file "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/environment.rb" do
 
 120 template "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/database.yml" do
 
 121   source "database.yml.erb"
 
 125   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
 
 126   only_if { node[:postgresql][:clusters][:"9.1/main"] }
 
 129 apache_site "owl.openstreetmap.org" do
 
 130   template "apache.erb"
 
 131   variables :aliases => ["owl.osm.org"]