diff --git a/files/gitlab-cookbooks/nginx/recipes/enable.rb b/files/gitlab-cookbooks/nginx/recipes/enable.rb index a7496e7c1829419dbce26ef3935b7c31505383d8_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9uZ2lueC9yZWNpcGVzL2VuYWJsZS5yYg==..8bf45c71ddde3b6d0ad02733dd459e2058e06e16_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9uZ2lueC9yZWNpcGVzL2VuYWJsZS5yYg== 100644 --- a/files/gitlab-cookbooks/nginx/recipes/enable.rb +++ b/files/gitlab-cookbooks/nginx/recipes/enable.rb @@ -26,6 +26,12 @@ log_options logging_settings[:options] end +version_file 'Create version file for NGINX' do + version_file_path File.join(node['gitlab']['nginx']['dir'], 'VERSION') + version_check_cmd '/opt/gitlab/embedded/sbin/nginx -ver 2>&1' + notifies :restart, 'runit_service[nginx]' +end + execute 'reload nginx' do command 'gitlab-ctl hup nginx' action :nothing diff --git a/spec/chef/cookbooks/gitlab/recipes/nginx_spec.rb b/spec/chef/cookbooks/gitlab/recipes/nginx_spec.rb index a7496e7c1829419dbce26ef3935b7c31505383d8_c3BlYy9jaGVmL2Nvb2tib29rcy9naXRsYWIvcmVjaXBlcy9uZ2lueF9zcGVjLnJi..8bf45c71ddde3b6d0ad02733dd459e2058e06e16_c3BlYy9jaGVmL2Nvb2tib29rcy9naXRsYWIvcmVjaXBlcy9uZ2lueF9zcGVjLnJi 100644 --- a/spec/chef/cookbooks/gitlab/recipes/nginx_spec.rb +++ b/spec/chef/cookbooks/gitlab/recipes/nginx_spec.rb @@ -505,6 +505,15 @@ expect(chef_run).to render_file(gitlab_http_config).with_content('return 301 https://fauxhai.local:80$request_uri;') end + it 'creates a default VERSION file and restarts service' do + expect(chef_run).to create_version_file('Create version file for NGINX').with( + version_file_path: '/var/opt/gitlab/nginx/VERSION', + version_check_cmd: '/opt/gitlab/embedded/sbin/nginx -ver 2>&1' + ) + + expect(chef_run.version_file('Create version file for NGINX')).to notify('runit_service[nginx]').to(:restart) + end + context 'when smartcard authentication is enabled' do let(:gitlab_smartcard_http_config) { '/var/opt/gitlab/nginx/conf/gitlab-smartcard-http.conf' }