diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:06:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:06:17 +0300 |
commit | 00c78fb814d7ce00989ac04edd6cdaa3239da284 (patch) | |
tree | f04920f08eb4e481ce27bd1d96862676dff735dc /config | |
parent | d2ffc30fd583e86d4122bb5061098f4f3ca7b3f1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r-- | config/gitlab.yml.example | 6 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | config/initializers/7_prometheus_metrics.rb | 10 | ||||
-rw-r--r-- | config/initializers/cluster_events_before_phased_restart.rb | 14 |
4 files changed, 30 insertions, 1 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index f2acfef80e9..f6814262b7a 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1024,6 +1024,12 @@ production: &base # enabled: true # address: localhost # port: 8083 + # # blackout_seconds: + # # defines an interval to block healthcheck, + # # but continue accepting application requests + # # this allows Load Balancer to notice service + # # being shutdown and not interrupt any of the clients + # blackout_seconds: 10 ## Prometheus settings # Do not modify these settings here. They should be modified in /etc/gitlab/gitlab.rb diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index b22391e3e63..7ee4a4e3610 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -668,6 +668,7 @@ Settings.monitoring['web_exporter'] ||= Settingslogic.new({}) Settings.monitoring.web_exporter['enabled'] ||= false Settings.monitoring.web_exporter['address'] ||= 'localhost' Settings.monitoring.web_exporter['port'] ||= 8083 +Settings.monitoring.web_exporter['blackout_seconds'] ||= 10 # # Testing settings diff --git a/config/initializers/7_prometheus_metrics.rb b/config/initializers/7_prometheus_metrics.rb index d58fb54f71c..974eff1a528 100644 --- a/config/initializers/7_prometheus_metrics.rb +++ b/config/initializers/7_prometheus_metrics.rb @@ -70,9 +70,18 @@ if defined?(::Unicorn) || defined?(::Puma) Gitlab::Metrics::Exporter::WebExporter.instance.start end + Gitlab::Cluster::LifecycleEvents.on_before_phased_restart do + # We need to ensure that before we re-exec server + # we do stop the exporter + Gitlab::Metrics::Exporter::WebExporter.instance.stop + end + Gitlab::Cluster::LifecycleEvents.on_before_master_restart do # We need to ensure that before we re-exec server # we do stop the exporter + # + # We do it again, for being extra safe, + # but it should not be needed Gitlab::Metrics::Exporter::WebExporter.instance.stop end @@ -81,7 +90,6 @@ if defined?(::Unicorn) || defined?(::Puma) # but this does not happen for Ruby fork # # This does stop server, as it is running on master. - # However, ensures that we close the TCPSocket. Gitlab::Metrics::Exporter::WebExporter.instance.stop end end diff --git a/config/initializers/cluster_events_before_phased_restart.rb b/config/initializers/cluster_events_before_phased_restart.rb new file mode 100644 index 00000000000..cbb1dd1a53a --- /dev/null +++ b/config/initializers/cluster_events_before_phased_restart.rb @@ -0,0 +1,14 @@ +# Technical debt, this should be ideally upstreamed. +# +# However, there's currently no way to hook before doing +# graceful shutdown today. +# +# Follow-up the issue: https://gitlab.com/gitlab-org/gitlab/issues/34107 + +if defined?(::Puma) + Puma::Cluster.prepend(::Gitlab::Cluster::Mixins::PumaCluster) +end + +if defined?(::Unicorn::HttpServer) + Unicorn::HttpServer.prepend(::Gitlab::Cluster::Mixins::UnicornHttpServer) +end |