]> git.openstreetmap.org Git - chef.git/blob - cookbooks/owl/recipes/default.rb
Disable tracking of loopback connections
[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 #     https://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 "passenger" do
40   conf "passenger.conf.erb"
41 end
42
43 munin_plugin "passenger_memory"
44 munin_plugin "passenger_processes"
45 munin_plugin "passenger_queues"
46 munin_plugin "passenger_requests"
47
48 postgresql_user "tomh" do
49   cluster "9.1/main"
50   superuser true
51 end
52
53 postgresql_user "matt" do
54   cluster "9.1/main"
55   superuser true
56 end
57
58 postgresql_user "ppawel" do
59   cluster "9.1/main"
60   superuser true
61 end
62
63 postgresql_user "owl" do
64   cluster "9.1/main"
65 end
66
67 postgresql_database "owl" do
68   cluster "9.1/main"
69   owner "owl"
70 end
71
72 postgresql_munin "owl" do
73   cluster "9.1/main"
74   database "owl"
75 end
76
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;
81
82 directory "/srv/owl.openstreetmap.org" do
83   owner "owl"
84   group "owl"
85   mode 0o2775
86 end
87
88 file "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt" do
89   action :nothing
90 end
91
92 execute "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile" do
93   action :nothing
94   command "bundle#{node[:owl][:ruby]} install"
95   cwd "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails"
96   user "root"
97   group "root"
98   notifies :touch, "file[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp/restart.txt]"
99 end
100
101 git "/srv/owl.openstreetmap.org/openstreetmap-watch-list" do
102   action :sync
103   repository "git://github.com/ppawel/openstreetmap-watch-list.git"
104   revision "owl.osm.org"
105   user "owl"
106   group "owl"
107   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
108 end
109
110 directory "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/tmp" do
111   owner "owl"
112   group "owl"
113 end
114
115 file "srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/environment.rb" do
116   owner "owl"
117   group "owl"
118 end
119
120 template "/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/config/database.yml" do
121   source "database.yml.erb"
122   owner "owl"
123   group "owl"
124   mode 0o664
125   notifies :run, "execute[/srv/owl.openstreetmap.org/openstreetmap-watch-list/rails/Gemfile]"
126   only_if { node[:postgresql][:clusters][:"9.1/main"] }
127 end
128
129 apache_site "owl.openstreetmap.org" do
130   template "apache.erb"
131   variables :aliases => ["owl.osm.org"]
132 end