Commit 5fed5323c840fefabbe5a05d5410ceed4f334da6
1 parent
25eeab5c
Exists in
master
and in
17 other branches
Adapt runit cookbook to GitLab
Showing
5 changed files
with
16 additions
and
16 deletions
Show diff stats
files/gitlab-cookbooks/runit/attributes/default.rb
| @@ -17,8 +17,8 @@ | @@ -17,8 +17,8 @@ | ||
| 17 | # limitations under the License. | 17 | # limitations under the License. |
| 18 | # | 18 | # |
| 19 | 19 | ||
| 20 | -default[:runit][:sv_bin] = "/opt/chef-server/embedded/bin/sv" | ||
| 21 | -default[:runit][:chpst_bin] = "/opt/chef-server/embedded/bin/chpst" | ||
| 22 | -default[:runit][:service_dir] = "/opt/chef-server/service" | ||
| 23 | -default[:runit][:sv_dir] = "/opt/chef-server/sv" | 20 | +default[:runit][:sv_bin] = "/opt/gitlab/embedded/bin/sv" |
| 21 | +default[:runit][:chpst_bin] = "/opt/gitlab/embedded/bin/chpst" | ||
| 22 | +default[:runit][:service_dir] = "/opt/gitlab/service" | ||
| 23 | +default[:runit][:sv_dir] = "/opt/gitlab/sv" | ||
| 24 | 24 |
files/gitlab-cookbooks/runit/definitions/runit_service.rb
| @@ -135,7 +135,7 @@ define :runit_service, :directory => nil, :only_if => false, :finish_script => f | @@ -135,7 +135,7 @@ define :runit_service, :directory => nil, :only_if => false, :finish_script => f | ||
| 135 | end | 135 | end |
| 136 | 136 | ||
| 137 | if params[:init_script_template] | 137 | if params[:init_script_template] |
| 138 | - template "/opt/chef-server/init/#{params[:name]}" do | 138 | + template "/opt/gitlab/init/#{params[:name]}" do |
| 139 | owner params[:owner] | 139 | owner params[:owner] |
| 140 | group params[:group] | 140 | group params[:group] |
| 141 | mode 0755 | 141 | mode 0755 |
| @@ -146,7 +146,7 @@ define :runit_service, :directory => nil, :only_if => false, :finish_script => f | @@ -146,7 +146,7 @@ define :runit_service, :directory => nil, :only_if => false, :finish_script => f | ||
| 146 | end | 146 | end |
| 147 | else | 147 | else |
| 148 | if params[:active_directory] == node[:runit][:service_dir] | 148 | if params[:active_directory] == node[:runit][:service_dir] |
| 149 | - link "/opt/chef-server/init/#{params[:name]}" do | 149 | + link "/opt/gitlab/init/#{params[:name]}" do |
| 150 | to node[:runit][:sv_bin] | 150 | to node[:runit][:sv_bin] |
| 151 | end | 151 | end |
| 152 | end | 152 | end |
files/gitlab-cookbooks/runit/files/default/chef-server-runsvdir.conf
| @@ -7,4 +7,4 @@ post-stop script | @@ -7,4 +7,4 @@ post-stop script | ||
| 7 | # now owned by init (process 1). | 7 | # now owned by init (process 1). |
| 8 | pkill -HUP -P 1 runsv$ | 8 | pkill -HUP -P 1 runsv$ |
| 9 | end script | 9 | end script |
| 10 | -exec /opt/chef-server/embedded/bin/runsvdir-start | 10 | +exec /opt/gitlab/embedded/bin/runsvdir-start |
files/gitlab-cookbooks/runit/recipes/sysvinit.rb
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # | 18 | # |
| 19 | 19 | ||
| 20 | # We assume you are sysvinit | 20 | # We assume you are sysvinit |
| 21 | -svdir_line = 'CS:123456:respawn:/opt/chef-server/embedded/bin/runsvdir-start' | 21 | +svdir_line = 'CS:123456:respawn:/opt/gitlab/embedded/bin/runsvdir-start' |
| 22 | execute "echo '#{svdir_line}' >> /etc/inittab" do | 22 | execute "echo '#{svdir_line}' >> /etc/inittab" do |
| 23 | not_if "grep '#{svdir_line}' /etc/inittab" | 23 | not_if "grep '#{svdir_line}' /etc/inittab" |
| 24 | notifies :run, "execute[init q]", :immediately | 24 | notifies :run, "execute[init q]", :immediately |
files/gitlab-cookbooks/runit/recipes/upstart.rb
| @@ -18,30 +18,30 @@ | @@ -18,30 +18,30 @@ | ||
| 18 | # | 18 | # |
| 19 | 19 | ||
| 20 | # Ensure the previous named iteration of the system job is nuked | 20 | # Ensure the previous named iteration of the system job is nuked |
| 21 | -execute "initctl stop opscode-runsvdir" do | ||
| 22 | - only_if "initctl status opscode-runsvdir | grep start" | 21 | +execute "initctl stop gitlab-runsvdir" do |
| 22 | + only_if "initctl status gitlab-runsvdir | grep start" | ||
| 23 | retries 30 | 23 | retries 30 |
| 24 | end | 24 | end |
| 25 | -file "/etc/init/opscode-runsvdir.conf" do | 25 | +file "/etc/init/gitlab-runsvdir.conf" do |
| 26 | action :delete | 26 | action :delete |
| 27 | end | 27 | end |
| 28 | 28 | ||
| 29 | -cookbook_file "/etc/init/chef-server-runsvdir.conf" do | 29 | +cookbook_file "/etc/init/gitlab-runsvdir.conf" do |
| 30 | owner "root" | 30 | owner "root" |
| 31 | group "root" | 31 | group "root" |
| 32 | mode "0644" | 32 | mode "0644" |
| 33 | - source "chef-server-runsvdir.conf" | 33 | + source "gitlab-runsvdir.conf" |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | # Keep on trying till the job is found :( | 36 | # Keep on trying till the job is found :( |
| 37 | -execute "initctl status chef-server-runsvdir" do | 37 | +execute "initctl status gitlab-runsvdir" do |
| 38 | retries 30 | 38 | retries 30 |
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | # If we are stop/waiting, start | 41 | # If we are stop/waiting, start |
| 42 | # | 42 | # |
| 43 | # Why, upstart, aren't you idempotent? :( | 43 | # Why, upstart, aren't you idempotent? :( |
| 44 | -execute "initctl start chef-server-runsvdir" do | ||
| 45 | - only_if "initctl status chef-server-runsvdir | grep stop" | 44 | +execute "initctl start gitlab-runsvdir" do |
| 45 | + only_if "initctl status gitlab-runsvdir | grep stop" | ||
| 46 | retries 30 | 46 | retries 30 |
| 47 | end | 47 | end |