Skip to content
Snippets Groups Projects
Commit 9cbce97f authored by Stan Hu's avatar Stan Hu
Browse files

Restart Gitaly when Ruby version changes

We saw in production that Gitaly didn't restart when we upgraded from
Ruby v2.6.6 to v2.7.2. We now signal a HUP to restart Gitaly gracefully
when the version changes.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/273108
parent 0cb950d3
No related branches found
No related tags found
No related merge requests found
---
title: Restart Gitaly when Ruby version changes
merge_request: 4696
author:
type: fixed
Loading
Loading
@@ -116,6 +116,13 @@ version_file 'Create version file for Gitaly' do
notifies :hup, "runit_service[gitaly]"
end
 
# If a version of ruby changes restart gitaly-ruby
version_file 'Create Ruby version file for Gitaly' do
version_file_path File.join(working_dir, 'RUBY_VERSION')
version_check_cmd '/opt/gitlab/embedded/bin/ruby --version'
notifies :hup, "runit_service[gitaly]"
end
consul_service 'gitaly' do
action Prometheus.service_discovery_action
socket_address node['gitaly']['prometheus_listen_addr']
Loading
Loading
Loading
Loading
@@ -77,6 +77,15 @@ RSpec.describe 'gitaly' do
expect(chef_run.version_file('Create version file for Gitaly')).to notify('runit_service[gitaly]').to(:hup)
end
 
it 'creates a default RUBY_VERSION file and restarts service' do
expect(chef_run).to create_version_file('Create Ruby version file for Gitaly').with(
version_file_path: '/var/opt/gitlab/gitaly/RUBY_VERSION',
version_check_cmd: '/opt/gitlab/embedded/bin/ruby --version'
)
expect(chef_run.version_file('Create Ruby version file for Gitaly')).to notify('runit_service[gitaly]').to(:hup)
end
it 'populates gitaly config.toml with defaults' do
expect(chef_run).to render_file(config_path).with_content { |content|
expect(content).to include("socket_path = '/var/opt/gitlab/gitaly/gitaly.socket'")
Loading
Loading
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