]> git.openstreetmap.org Git - chef.git/blob - cookbooks/trac/recipes/default.rb
Enable version control plugins for trac
[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::ssl"
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 0644
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 0755
42   files_owner "trac"
43   files_group "trac"
44   files_mode 0644
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 0755
53   files_owner "trac"
54   files_group "trac"
55   files_mode 0644
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.exists?(site_directory) }
64 end
65
66 cookbook_file "/usr/local/bin/trac-authenticate" do
67   owner "root"
68   group "root"
69   mode 0755
70 end
71
72 apache_module "wsgi"
73
74 apache_site site_name do
75   template "apache.erb"
76   directory site_directory
77   variables :user => "trac", :group => "trac"
78 end
79
80 template "/etc/sudoers.d/trac" do
81   source "sudoers.erb"
82   owner "root"
83   group "root"
84   mode 0440
85 end
86
87 template "/etc/cron.daily/trac-backup" do
88   source "backup.cron.erb"
89   owner "root"
90   group "root"
91   mode 0755
92 end