diff --git a/changelogs/unreleased/restart-unicorn-service.yml b/changelogs/unreleased/restart-unicorn-service.yml new file mode 100644 index 0000000000000000000000000000000000000000..8a3e4fb77c331682bada70f5378650c226720c06_Y2hhbmdlbG9ncy91bnJlbGVhc2VkL3Jlc3RhcnQtdW5pY29ybi1zZXJ2aWNlLnltbA== --- /dev/null +++ b/changelogs/unreleased/restart-unicorn-service.yml @@ -0,0 +1,5 @@ +--- +title: Ensure we are properly restarting the unicorn service +merge_request: 4354 +author: +type: fixed diff --git a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-logcursor.rb b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-logcursor.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tbG9nY3Vyc29yLnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tbG9nY3Vyc29yLnJi 100644 --- a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-logcursor.rb +++ b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-logcursor.rb @@ -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 diff --git a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary.rb b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tc2Vjb25kYXJ5LnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tc2Vjb25kYXJ5LnJi 100644 --- a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary.rb +++ b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary.rb @@ -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 diff --git a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary_disable.rb b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary_disable.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tc2Vjb25kYXJ5X2Rpc2FibGUucmI=..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW8tc2Vjb25kYXJ5X2Rpc2FibGUucmI= 100644 --- a/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary_disable.rb +++ b/files/gitlab-cookbooks/gitlab-ee/recipes/geo-secondary_disable.rb @@ -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 diff --git a/files/gitlab-cookbooks/gitlab-ee/recipes/geo_database_migrations.rb b/files/gitlab-cookbooks/gitlab-ee/recipes/geo_database_migrations.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW9fZGF0YWJhc2VfbWlncmF0aW9ucy5yYg==..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWItZWUvcmVjaXBlcy9nZW9fZGF0YWJhc2VfbWlncmF0aW9ucy5yYg== 100644 --- a/files/gitlab-cookbooks/gitlab-ee/recipes/geo_database_migrations.rb +++ b/files/gitlab-cookbooks/gitlab-ee/recipes/geo_database_migrations.rb @@ -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") diff --git a/files/gitlab-cookbooks/gitlab/attributes/default.rb b/files/gitlab-cookbooks/gitlab/attributes/default.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvYXR0cmlidXRlcy9kZWZhdWx0LnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvYXR0cmlidXRlcy9kZWZhdWx0LnJi 100644 --- a/files/gitlab-cookbooks/gitlab/attributes/default.rb +++ b/files/gitlab-cookbooks/gitlab/attributes/default.rb @@ -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 diff --git a/files/gitlab-cookbooks/gitlab/recipes/add_trusted_certs.rb b/files/gitlab-cookbooks/gitlab/recipes/add_trusted_certs.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9hZGRfdHJ1c3RlZF9jZXJ0cy5yYg==..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9hZGRfdHJ1c3RlZF9jZXJ0cy5yYg== 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/add_trusted_certs.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/add_trusted_certs.rb @@ -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") diff --git a/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb b/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9kYXRhYmFzZV9taWdyYXRpb25zLnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9kYXRhYmFzZV9taWdyYXRpb25zLnJi 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/database_migrations.rb @@ -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") diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9naXRsYWItcmFpbHMucmI=..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9naXRsYWItcmFpbHMucmI= 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb @@ -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'] diff --git a/files/gitlab-cookbooks/gitlab/recipes/puma.rb b/files/gitlab-cookbooks/gitlab/recipes/puma.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9wdW1hLnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy9wdW1hLnJi 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/puma.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/puma.rb @@ -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'] diff --git a/files/gitlab-cookbooks/gitlab/recipes/unicorn_disable.rb b/files/gitlab-cookbooks/gitlab/recipes/unicorn_disable.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy91bmljb3JuX2Rpc2FibGUucmI=..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVjaXBlcy91bmljb3JuX2Rpc2FibGUucmI= 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/unicorn_disable.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/unicorn_disable.rb @@ -16,7 +16,7 @@ # limitations under the License. # -runit_service "unicorn" do +unicorn_service "unicorn" do action :disable end diff --git a/files/gitlab-cookbooks/gitlab/resources/unicorn_config.rb b/files/gitlab-cookbooks/gitlab/resources/unicorn_config.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVzb3VyY2VzL3VuaWNvcm5fY29uZmlnLnJi..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVzb3VyY2VzL3VuaWNvcm5fY29uZmlnLnJi 100644 --- a/files/gitlab-cookbooks/gitlab/resources/unicorn_config.rb +++ b/files/gitlab-cookbooks/gitlab/resources/unicorn_config.rb @@ -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 diff --git a/files/gitlab-cookbooks/gitlab/resources/unicorn_service.rb b/files/gitlab-cookbooks/gitlab/resources/unicorn_service.rb index 252de8a3494a7ab356c7205e0a4d233d50501870_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVzb3VyY2VzL3VuaWNvcm5fc2VydmljZS5yYg==..8a3e4fb77c331682bada70f5378650c226720c06_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9naXRsYWIvcmVzb3VyY2VzL3VuaWNvcm5fc2VydmljZS5yYg== 100644 --- a/files/gitlab-cookbooks/gitlab/resources/unicorn_service.rb +++ b/files/gitlab-cookbooks/gitlab/resources/unicorn_service.rb @@ -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