]> git.openstreetmap.org Git - chef.git/blob - cookbooks/owl/recipes/default.rb
Bring supybot under chef control
[chef.git] / cookbooks / owl / recipes / default.rb
1 #
2 # Cookbook Name:: owl
3 # Recipe:: default
4 #
5 # Copyright 2012, 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 "apache"
21 include_recipe "postgresql"
22
23 package "python"
24 package "python-psycopg2"
25
26 package "libxslt-dev"
27
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]}"
32
33 gem_package "bundler#{node[:owl][:ruby]}" do
34   package_name "bundler"
35   gem_binary "gem#{node[:owl][:ruby]}"
36   options "--format-executable"
37 end
38
39 apache_module "deflate"
40
41 apache_module "passenger" do
42   conf "passenger.conf.erb"
43 end
44
45 munin_plugin "passenger_memory"
46 munin_plugin "passenger_processes"
47 munin_plugin "passenger_queues"
48 munin_plugin "passenger_requests"
49
50 postgresql_user "tomh" do
51   cluster "9.1/main"
52   superuser true
53 end
54
55 postgresql_user "matt" do
56   cluster "9.1/main"
57   superuser true
58 end
59
60 postgresql_user "ppawel" do
61   cluster "9.1/main"
62   superuser true
63 end
64
65 postgresql_user "owl" do
66   cluster "9.1/main"
67 end
68
69 postgresql_database "owl" do
70   cluster "9.1/main"
71   owner "owl"
72 end
73
74 postgresql_munin "owl" do
75   cluster "9.1/main"
76   database "owl"
77 end
78
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;
83
84 directory "/srv/owl.openstreetmap.org" do
85   owner "owl"
86   group "owl"
87   mode 02775
88 end
89
90 file "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt" do
91   action :nothing
92 end
93
94 execute "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile" do
95   action :nothing
96   command "bundle#{node[:owl][:ruby]} install"
97   cwd "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails"
98   user "root"
99   group "root"
100   notifies :touch, resources(:file => "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt")
101 end
102
103 git "/srv/owl.openstreetmap.org/openstreetmap-watch-list" do
104   action :sync
105   repository "git://github.com/ppawel/openstreetmap-watch-list.git"
106   revision "owl.osm.org"
107   user "owl"
108   group "owl"
109   notifies :run, resources(:execute => "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile")
110 end
111
112 directory "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp" do
113   owner "owl"
114   group "owl"
115 end
116
117 file "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/environment.rb" do
118   owner "owl"
119   group "owl"
120 end
121
122 template "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/database.yml" do
123   source "database.yml.erb"
124   owner "owl"
125   group "owl"
126   mode 0664
127   notifies :run, resources(:execute => "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile")
128   only_if { node[:postgresql][:clusters]["9.1/main"] }
129 end
130
131 apache_site "owl.openstreetmap.org" do
132   template "apache.erb"
133   variables :aliases => [ "owl.osm.org" ]
134 end