]> git.openstreetmap.org Git - chef.git/blob - cookbooks/git/recipes/server.rb
dulcy: move to postgresql 18
[chef.git] / cookbooks / git / recipes / server.rb
1 #
2 # Cookbook:: git
3 # Recipe:: server
4 #
5 # Copyright:: 2011, 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 "apt"
21 include_recipe "networking"
22
23 git_directory = node[:git][:directory]
24
25 group "git" do
26   gid 508
27   append true
28 end
29
30 user "git" do
31   uid 508
32   gid 508
33   comment "git.openstreetmap.org"
34   home git_directory
35   shell "/usr/sbin/nologin"
36   manage_home false
37 end
38
39 directory git_directory do
40   owner "root"
41   group "root"
42   mode "775"
43 end
44
45 directory "#{git_directory}/public" do
46   owner node[:git][:public_user]
47   group node[:git][:public_group]
48   mode "2775"
49 end
50
51 directory "#{git_directory}/private" do
52   owner node[:git][:private_user]
53   group node[:git][:private_group]
54   mode "2775"
55 end
56
57 template "/etc/gitconfig" do
58   source "gitconfig.erb"
59   owner "root"
60   group "root"
61   mode "644"
62 end
63
64 Dir.glob("#{git_directory}/*/*.git").each do |repository|
65   template "#{repository}/hooks/post-update" do
66     source "post-update.erb"
67     owner "root"
68     group node[:git][:group]
69     mode "755"
70   end
71 end
72
73 template "/etc/cron.daily/git-backup" do
74   source "backup.cron.erb"
75   owner "root"
76   group "root"
77   mode "755"
78 end