Skip to content
Snippets Groups Projects
Commit 8a3e4fb7 authored by Ian Baum's avatar Ian Baum
Browse files

Merge branch 'restart-unicorn-service' into 'master'

Ensure we are properly restarting the unicorn service

Closes #5462

See merge request gitlab-org/omnibus-gitlab!4354
parents 252de8a3 e403ed1b
No related branches found
No related tags found
No related merge requests found
Showing
with 37 additions and 11 deletions
---
title: Ensure we are properly restarting the unicorn service
merge_request: 4354
author:
type: fixed
......@@ -15,6 +15,7 @@
# limitations under the License.
account_helper = AccountHelper.new(node)
omnibus_helper = OmnibusHelper.new(node)
working_dir = "#{node['package']['install-dir']}/embedded/service/gitlab-rails"
log_directory = node['gitlab']['geo-logcursor']['log_directory']
......@@ -57,4 +58,5 @@
command '/opt/gitlab/bin/gitlab-ctl restart geo-logcursor'
action :nothing
dependent_services.map { |svc| subscribes :run, "runit_service[#{svc}]" }
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
end
......@@ -23,7 +23,7 @@
gitlab_rails_dir = node['gitlab']['gitlab-rails']['dir']
gitlab_rails_etc_dir = File.join(gitlab_rails_dir, "etc")
dependent_services = %w(unicorn puma sidekiq geo-logcursor)
dependent_services = %w(puma sidekiq geo-logcursor)
templatesymlink 'Create a database_geo.yml and create a symlink to Rails root' do
link_from File.join(gitlab_rails_source_dir, 'config/database_geo.yml')
......@@ -42,6 +42,7 @@
dependent_services.each do |svc|
notifies :restart, "runit_service[#{svc}]" if omnibus_helper.should_notify?(svc)
end
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
end
action :nothing
end
......
......@@ -23,7 +23,6 @@
dependent_services = []
%w(
puma
unicorn
sidekiq
).each do |svc|
dependent_services << "runit_service[#{svc}]" if omnibus_helper.should_notify?(svc)
......@@ -33,6 +32,7 @@
link_from File.join(gitlab_rails_source_dir, 'config/database_geo.yml')
link_to File.join(gitlab_rails_etc_dir, 'database_geo.yml')
dependent_services.each { |svc| notifies :restart, svc }
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
action :delete
end
......@@ -19,7 +19,7 @@
gitlab_geo_helper = GitlabGeoHelper.new(node)
dependent_services = []
dependent_services << "runit_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "runit_service[puma]" if omnibus_helper.should_notify?("puma")
dependent_services << "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
dependent_services << "runit_service[sidekiq]" if omnibus_helper.should_notify?("sidekiq")
......
......@@ -413,7 +413,7 @@
default['gitlab']['gitlab-rails']['monitoring_unicorn_sampler_interval'] = 10
default['gitlab']['gitlab-rails']['shutdown_blackout_seconds'] = 10
# Default dependent services to restart in the event that files-of-interest change
default['gitlab']['gitlab-rails']['dependent_services'] = %w{unicorn puma actioncable sidekiq sidekiq-cluster}
default['gitlab']['gitlab-rails']['dependent_services'] = %w{puma actioncable sidekiq sidekiq-cluster}
###
# Unleash
......
......@@ -34,7 +34,7 @@
cert_helper.link_certificates
end
only_if { cert_helper.new_certificate_added? }
notifies :restart, "runit_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
notifies :restart, "runit_service[puma]" if omnibus_helper.should_notify?("puma")
notifies :restart, "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
notifies :restart, "runit_service[gitlab-pages]" if omnibus_helper.should_notify?("gitlab-pages")
......
......@@ -24,7 +24,7 @@
initial_runner_token = node['gitlab']['gitlab-rails']['initial_shared_runners_registration_token']
dependent_services = []
dependent_services << "runit_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "runit_service[puma]" if omnibus_helper.should_notify?("puma")
dependent_services << "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
dependent_services << "runit_service[sidekiq]" if omnibus_helper.should_notify?("sidekiq")
......
......@@ -150,6 +150,8 @@
dependent_services << "runit_service[#{name}]" if omnibus_helper.should_notify?(name)
end
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
secret_file = File.join(gitlab_rails_etc_dir, "secret")
secret_symlink = File.join(gitlab_rails_source_dir, ".secret")
otp_key_base = node['gitlab']['gitlab-rails']['otp_key_base']
......
......@@ -97,7 +97,7 @@
}.merge(params))
log_options node['gitlab']['logging'].to_hash.merge(node['gitlab'][svc].to_hash)
notifies :stop, 'runit_service[unicorn]', :before
notifies :stop, 'unicorn_service[unicorn]', :before
end
if node['gitlab']['bootstrap']['enable']
......
......@@ -16,7 +16,7 @@
# limitations under the License.
#
runit_service "unicorn" do
unicorn_service "unicorn" do
action :disable
end
......
......@@ -11,7 +11,6 @@
property :stderr_path
property :stdout_path
property :relative_url
property :notifies_services
property :owner
property :group
property :mode
......@@ -40,6 +39,5 @@
group new_resource.group if new_resource.group
mode new_resource.mode if new_resource.mode
variables new_resource.to_hash
notifies(*new_resource.notifies_services) if new_resource.notifies_services
end
end
......@@ -62,7 +62,7 @@
owner "root"
group "root"
mode "0644"
notifies_services :restart, "runit_service[#{new_resource.svc}]" if omnibus_helper.should_notify?(new_resource.svc)
notifies :restart, "runit_service[#{new_resource.svc}]" if omnibus_helper.should_notify?(new_resource.svc)
end
runit_service new_resource.svc do
......@@ -93,3 +93,21 @@
end
end
end
action :restart do
runit_service new_resource.svc do
action :restart
end
end
action :stop do
runit_service new_resource.svc do
action :stop
end
end
action :disable do
runit_service new_resource.svc do
action :disable
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment