Gitlab Omnibus, Nginx worker_processes defaults to 0
Summary
I've updated our gitlab omnibus installation from 15.0.1 to 15.1.1.
After that the server completely stopped receiving requests.
The interesting part of the upgrade output:
Recipe: gitlab::nginx
* directory[/var/opt/gitlab/nginx] action create (up to date)
* directory[/var/opt/gitlab/nginx/conf] action create (up to date)
* directory[/var/log/gitlab/nginx] action create (up to date)
* link[/var/opt/gitlab/nginx/logs] action create (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-http.conf] action create (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-smartcard-http.conf] action delete (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-health.conf] action create (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-pages.conf] action create (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-registry.conf] action create (up to date)
* template[/var/opt/gitlab/nginx/conf/gitlab-mattermost-http.conf] action delete (up to date)
* template[/var/opt/gitlab/nginx/conf/nginx-status.conf] action create (up to date)
* consul_service[nginx] action delete
* file[/var/opt/gitlab/consul/config.d/nginx-service.json] action delete (up to date)
(up to date)
* template[/var/opt/gitlab/nginx/conf/nginx.conf] action create[2022-07-01T21:59:11+00:00] INFO: template[/var/opt/gitlab/nginx/conf/nginx.conf] backed up to /opt/gitlab/embedded/cookbooks/cache/backup/var/opt/gitlab/nginx/conf/nginx.conf.chef-20220701215911.843843
[2022-07-01T21:59:11+00:00] INFO: template[/var/opt/gitlab/nginx/conf/nginx.conf] removed backup at /opt/gitlab/embedded/cookbooks/cache/backup/var/opt/gitlab/nginx/conf/nginx.conf.chef-20210607210917.140311
[2022-07-01T21:59:11+00:00] INFO: template[/var/opt/gitlab/nginx/conf/nginx.conf] updated file contents /var/opt/gitlab/nginx/conf/nginx.conf
- update content in file /var/opt/gitlab/nginx/conf/nginx.conf from 49f2f9 to 07ecc0
--- /var/opt/gitlab/nginx/conf/nginx.conf 2022-07-01 21:42:37.592178902 +0000
+++ /var/opt/gitlab/nginx/conf/.chef-nginx20220701-56149-74qkvh.conf 2022-07-01 21:59:11.813121118 +0000
@@ -3,7 +3,7 @@
# and run `sudo gitlab-ctl reconfigure`.
user gitlab-www gitlab-www;
-worker_processes 4;
+worker_processes 0;
error_log stderr;
pid nginx.pid;
inside the /etc/gitlab/gitlab.rb I have this option not set, so relying on the default
# nginx['worker_processes'] = 4
But after this upgrade the server does not respond to any requests since the nginx is not starting any worker processes.
I've verified that this happens with a fresh install of gitlab 15.1.1 on ubuntu 20.04
I would expect it to use 4 as the default, since that is what is commented in the gitlab.rb template.
Steps to reproduce
- Open
/etc/gitlab/gitlab.rbin an editor, and comment out the line regardingnginx['worker_processes'] = 4 - Run
gitlab-ctl reconfigure
And the bug will show.
Workaround
I don't know if I can call it a workaround, but if you actually configure the setting in /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure it will work perfectly well.