Skip to content

Commit ce92d2c

Browse files
committed
sync config/gitlabhq/puma.rb to gitlab v18.7.0
Without those changes puma (and then gitlab itself) does not starts See following upstream changes: - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128619 (overwritten by gitlab-org/gitlab!132581) - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132581 - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/211331
1 parent baa49e0 commit ce92d2c

File tree

1 file changed

+39
-24
lines changed
  • assets/runtime/config/gitlabhq

1 file changed

+39
-24
lines changed

assets/runtime/config/gitlabhq/puma.rb

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,50 @@
3434
# Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
3535
# accepted protocols.
3636
bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket'
37-
bind 'tcp://127.0.0.1:8080'
3837

3938
workers {{PUMA_WORKERS}}
4039

4140
require_relative "{{GITLAB_INSTALL_DIR}}/lib/gitlab/cluster/lifecycle_events"
4241

43-
on_restart do
44-
# Signal application hooks that we're about to restart
45-
Gitlab::Cluster::LifecycleEvents.do_before_master_restart
46-
end
42+
if Gem::Version.new(Puma::Const::PUMA_VERSION) < Gem::Version.new('7.0')
43+
Gitlab::Cluster::LifecycleEvents.set_puma_options @config.options
4744

48-
before_fork do
49-
# Signal to the puma killer
50-
Gitlab::Cluster::PumaWorkerKillerInitializer.start(@config.options, puma_per_worker_max_memory_mb: {{PUMA_PER_WORKER_MAX_MEMORY_MB}}, puma_master_max_memory_mb: {{PUMA_MASTER_MAX_MEMORY_MB}}) unless ENV['DISABLE_PUMA_WORKER_KILLER']
45+
on_restart do
46+
# Signal application hooks that we're about to restart
47+
Gitlab::Cluster::LifecycleEvents.do_before_master_restart
48+
end
5149

52-
# Signal application hooks that we're about to fork
53-
Gitlab::Cluster::LifecycleEvents.do_before_fork
54-
end
50+
on_worker_boot do
51+
# Signal application hooks of worker start
52+
Gitlab::Cluster::LifecycleEvents.do_worker_start
53+
end
5554

56-
Gitlab::Cluster::LifecycleEvents.set_puma_options @config.options
57-
on_worker_boot do
58-
# Signal application hooks of worker start
59-
Gitlab::Cluster::LifecycleEvents.do_worker_start
55+
on_worker_shutdown do
56+
# Signal application hooks that a worker is shutting down
57+
Gitlab::Cluster::LifecycleEvents.do_worker_stop
58+
end
59+
else
60+
Gitlab::Cluster::LifecycleEvents.set_puma_worker_count(3)
61+
62+
before_restart do
63+
# Signal application hooks that we're about to restart
64+
Gitlab::Cluster::LifecycleEvents.do_before_master_restart
65+
end
66+
67+
before_worker_boot do
68+
# Signal application hooks of worker start
69+
Gitlab::Cluster::LifecycleEvents.do_worker_start
70+
end
71+
72+
before_worker_shutdown do
73+
# Signal application hooks that a worker is shutting down
74+
Gitlab::Cluster::LifecycleEvents.do_worker_stop
75+
end
6076
end
6177

62-
on_worker_shutdown do
63-
# Signal application hooks that a worker is shutting down
64-
Gitlab::Cluster::LifecycleEvents.do_worker_stop
78+
before_fork do
79+
# Signal application hooks that we're about to fork
80+
Gitlab::Cluster::LifecycleEvents.do_before_fork
6581
end
6682

6783
# Preload the application before starting the workers; this conflicts with
@@ -87,11 +103,10 @@
87103
json_formatter.call(str)
88104
end
89105

90-
lowlevel_error_handler do |ex, env|
91-
if Raven.configuration.capture_allowed?
92-
Raven.capture_exception(ex, tags: { 'handler': 'puma_low_level' }, extra: { puma_env: env })
93-
end
106+
require_relative "{{GITLAB_INSTALL_DIR}}/lib/gitlab/puma/error_handler"
107+
108+
error_handler = Gitlab::Puma::ErrorHandler.new(ENV['RAILS_ENV'] == 'production')
94109

95-
# note the below is just a Rack response
96-
[500, {}, ["An error has occurred and reported in the system's low-level error handler."]]
110+
lowlevel_error_handler do |ex, env, status_code|
111+
error_handler.execute(ex, env, status_code)
97112
end

0 commit comments

Comments
 (0)