Bug 247564 - www/gitlab-ce Switch application server from unicorn to puma
Summary: www/gitlab-ce Switch application server from unicorn to puma
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-26 14:51 UTC by hakan
Modified: 2020-06-27 09:01 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hakan 2020-06-26 14:51:15 UTC
Greetings,

upstream GitLab switched their default application server in the 13.0 release [0] and it would be great if this port would also switch to it.
While Unicorn still works fine, switching to Puma might reduce GitLab's memory consumption by a lot, and it might even allow users to run GitLab on smaller VPS instances.

[0] https://about.gitlab.com/releases/2020/05/22/gitlab-13-0-released/#reduced-memory-consumption-of-gitlab-with-puma
Comment 1 Matthias Fechner freebsd_committer 2020-06-27 08:25:51 UTC
You can try it be changing the option or environment variable USE_WEB_SERVER in file /usr/local/etc/rc.d/gitlab.

This should use puma instead of unicorn.
But as gitlab does not use the standard puma package:
https://gitlab.com/gitlab-org/gitlab/-/blob/master/Gemfile#L174

And the rails60 package fetches the standard puma package:
https://svnweb.freebsd.org/ports/head/www/rubygem-rails60/Makefile?view=markup&pathrev=539880#l36

we have here a conflict for executables and that is the reason why the executable for the rubygem-gitlab-puma is changed from puma to gpuma.

Maybe it is enough to modify the startup script for gitlab.

If you like you can test it and report back if it works or not.
Comment 2 hakan 2020-06-27 09:01:31 UTC
I changed the USE_WEB_SERVER value in /usr/local/etc/rc.d/gitlab to 'puma' and got this error:

```
sudo service gitlab start
Removing stale Sidekiq job dispatcher pid. This is most likely caused by Sidekiq crashing the last time it ran.
Starting GitLab web server (puma)
Starting GitLab Sidekiq
Starting GitLab Workhorse
Starting Gitaly
bundler: failed to load command: puma (/usr/local/bin/puma)
LoadError: cannot load such file -- /home/git/gitlab/lib/gitlab/puma_logging/json_formatter
  /usr/local/www/gitlab-ce/config/puma.rb:73:in `require_relative'
  /usr/local/www/gitlab-ce/config/puma.rb:73:in `_load_from'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/dsl.rb:46:in `instance_eval'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/dsl.rb:46:in `_load_from'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/configuration.rb:195:in `block in load'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/configuration.rb:195:in `each'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/configuration.rb:195:in `load'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/launcher.rb:58:in `initialize'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/cli.rb:71:in `new'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/lib/puma/cli.rb:71:in `initialize'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/bin/puma:8:in `new'
  /usr/local/lib/ruby/gems/2.6/gems/gitlab-puma-4.3.3.gitlab.2/bin/puma:8:in `<top (required)>'
  /usr/local/bin/puma:23:in `load'
  /usr/local/bin/puma:23:in `<top (required)>'
Sidekiq output will be written to /usr/local/www/gitlab-ce/log/sidekiq.log
..............................Waited 30s for the processes to write their pids, something probably went wrong.
```


Then I ran the stop script and changed USE_WEB_SERVER to 'gpuma' while also adjusting the case condition that comes right after it.
Then I got: 

```
sudo service gitlab start
Removing stale Sidekiq job dispatcher pid. This is most likely caused by Sidekiq crashing the last time it ran.
Starting GitLab web server (gpuma)
Starting GitLab Sidekiq
Starting GitLab Workhorse
Starting Gitaly
Unkown web server used by USE_WEB_SERVER: gpuma.
Sidekiq output will be written to /usr/local/www/gitlab-ce/log/sidekiq.log
..............................Waited 30s for the processes to write their pids, something probably went wrong.
```

This "Unkown web server used by USE_WEB_SERVER:" error seems to originate from outside the rc.d script.