default.rb
2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
if node['platform'] == 'centos'
cookbook_file '/etc/yum.repos.d/gitlab.repo' do
action :delete
end
end
package 'gitlab'
template '/etc/gitlab/database.yml' do
owner 'root'
group 'root'
mode 0644
notifies :run, 'execute[gitlab:setup]', :immediately
end
execute 'gitlab:setup' do
user 'git'
cwd '/usr/lib/gitlab'
command 'yes yes | bundle exec rake db:setup RAILS_ENV=production && touch /var/lib/gitlab/setup.done'
not_if { File.exists?('/var/lib/gitlab/setup.done') }
action :nothing
notifies :restart, 'service[gitlab]'
end
# gitlab-shell configuration
template '/etc/gitlab-shell/config.yml' do
source 'gitlab-shell.yml.erb'
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[gitlab]'
end
# gitlab redis configuration
template '/usr/lib/gitlab/config/resque.yml' do
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[gitlab]'
end
####################################################
# Run under /gitlab
####################################################
template '/etc/gitlab/gitlab.yml' do
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[gitlab]'
end
cookbook_file '/usr/lib/gitlab/config/initializers/gitlab_path.rb' do
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[gitlab]'
end
cookbook_file '/etc/gitlab/unicorn.rb' do
owner 'root'
group 'root'
mode 0644
notifies :restart, 'service[gitlab]'
end
####################################################
# Run under /gitlab (END)
####################################################
# serve static files with nginx
template '/etc/nginx/conf.d/gitlab.conf' do
source 'nginx.conf.erb'
mode 0644
notifies :reload, 'service[nginx]'
end
service 'gitlab' do
action :enable
supports :restart => true
end
####################################################
# SELinux: allow gitlab to use '/tmp'
####################################################
cookbook_file '/etc/selinux/local/gitlab.te' do
notifies :run, 'execute[selinux-gitlab]'
end
execute 'selinux-gitlab' do
command 'selinux-install-module /etc/selinux/local/gitlab.te'
action :nothing
end