]> git.openstreetmap.org Git - chef.git/blob - cookbooks/trac/recipes/default.rb
Make renew-hook send knife upload output to STDOUT
[chef.git] / cookbooks / trac / recipes / default.rb
1 #
2 # Cookbook Name:: trac
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
22 package "trac"
23 package "trac-git"
24 package "ruby"
25
26 site_name = "trac.openstreetmap.org"
27 site_directory = "/srv/#{site_name}"
28
29 template "/var/lib/trac/conf/trac.ini" do
30   source "trac.ini.erb"
31   owner "trac"
32   group "www-data"
33   mode 0o644
34   variables :name => site_name
35 end
36
37 remote_directory "/var/lib/trac/htdocs" do
38   source "htdocs"
39   owner "trac"
40   group "trac"
41   mode 0o755
42   files_owner "trac"
43   files_group "trac"
44   files_mode 0o644
45   purge true
46 end
47
48 remote_directory "/var/lib/trac/templates" do
49   source "templates"
50   owner "trac"
51   group "trac"
52   mode 0o755
53   files_owner "trac"
54   files_group "trac"
55   files_mode 0o644
56   purge true
57 end
58
59 execute "trac-deploy-#{site_name}" do
60   command "trac-admin /var/lib/trac deploy #{site_directory}"
61   user "root"
62   group "root"
63   not_if { File.exist?(site_directory) }
64 end
65
66 cookbook_file "/usr/local/bin/trac-authenticate" do
67   owner "root"
68   group "root"
69   mode 0o755
70 end
71
72 apache_module "wsgi"
73
74 ssl_certificate "trac.openstreetmap.org" do
75   domains "trac.openstreetmap.org"
76   notifies :reload, "service[apache2]"
77 end
78
79 apache_site site_name do
80   template "apache.erb"
81   directory site_directory
82   variables :user => "trac", :group => "trac"
83 end
84
85 template "/etc/sudoers.d/trac" do
86   source "sudoers.erb"
87   owner "root"
88   group "root"
89   mode 0o440
90 end
91
92 template "/etc/cron.daily/trac-backup" do
93   source "backup.cron.erb"
94   owner "root"
95   group "root"
96   mode 0o755
97 end