Skip to content
Snippets Groups Projects
Verified Commit b7566558 authored by Balasankar 'Balu' C's avatar Balasankar 'Balu' C
Browse files

Remove Unicorn and related code


Changelog: removed
Signed-off-by: default avatarBalasankar "Balu" C <balasankar@gitlab.com>
parent 9fae94b6
No related branches found
No related tags found
1 merge request!5295Remove Unicorn and related code
Showing
with 21 additions and 190 deletions
......@@ -122,7 +122,7 @@ main() {
return
fi
if ( [ -d ${DEST_DIR}/service/unicorn ] || [ -d ${DEST_DIR}/service/puma ] ) && [ ! -e "${skip_backup_file}" ] ; then
if [ -d ${DEST_DIR}/service/puma ] && [ ! -e "${skip_backup_file}" ] ; then
notify "Automatically backing up only the GitLab SQL database (excluding everything else!)"
if ! ${DEST_DIR}/bin/gitlab-rake gitlab:backup:create SKIP=repositories,uploads,builds,artifacts,lfs,registry,pages ; then
backup_failed "Database"
......
......@@ -32,3 +32,12 @@ following settings in `gitlab.rb` is being removed:
1. `sidekiq['concurrency']` setting. The limits should be controlled using the
two settings `sidekiq['min_concurrency']` and `sidekiq['max_concurrency']`.
### Removing support for using Unicorn as web server
In GitLab 13.0, Puma became the default web server for GitLab, but users were
still able to continue using Unicorn if needed. Starting with GitLab 14.0,
Unicorn is no longer supported as a webserver for GitLab and is no longer
shipped with the `omnibus-gitlab` packages. Users must migrate to Puma following
[documentation](https://docs.gitlab.com/ee/administration/operations/puma.html)
to upgrade to GitLab 14.0.
......@@ -69,7 +69,7 @@ external_url 'GENERATED_EXTERNAL_URL'
### Request duration
###! Tells the rails application how long it has to complete a request
###! This value needs to be lower than the worker timeout set in unicorn/puma.
###! This value needs to be lower than the worker timeout set in puma.
###! By default, we'll allow 95% of the the worker timeout
# gitlab_rails['max_request_duration_seconds'] = 57
......@@ -187,7 +187,7 @@ external_url 'GENERATED_EXTERNAL_URL'
### GraphQL Settings
###! Tells the rails application how long it has to complete a GraphQL request.
###! We suggest this value to be higher than the database timeout value
###! and lower than the worker timeout set in unicorn/puma. (default: 30)
###! and lower than the worker timeout set in puma. (default: 30)
# gitlab_rails['graphql_timeout'] = 30
### Trusted proxies
......@@ -233,8 +233,6 @@ external_url 'GENERATED_EXTERNAL_URL'
### Monitoring settings
###! IP whitelist controlling access to monitoring endpoints
# gitlab_rails['monitoring_whitelist'] = ['127.0.0.0/8', '::1/128']
###! Time between sampling of unicorn socket metrics, in seconds
# gitlab_rails['monitoring_unicorn_sampler_interval'] = 10
### Shutdown settings
###! Defines an interval to block healthcheck,
......@@ -919,42 +917,6 @@ external_url 'GENERATED_EXTERNAL_URL'
# user['git_user_name'] = "GitLab"
# user['git_user_email'] = "gitlab@#{node['fqdn']}"
################################################################################
## GitLab Unicorn
##! Tweak unicorn settings.
##! Docs: https://docs.gitlab.com/omnibus/settings/unicorn.html
################################################################################
# unicorn['enable'] = false
# unicorn['worker_timeout'] = 60
###! Minimum worker_processes is 2 at this moment
###! See https://gitlab.com/gitlab-org/gitlab-foss/issues/18771
# unicorn['worker_processes'] = 2
### Advanced settings
# unicorn['listen'] = 'localhost'
# unicorn['port'] = 8080
# unicorn['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
# unicorn['pidfile'] = '/opt/gitlab/var/unicorn/unicorn.pid'
# unicorn['tcp_nopush'] = true
# unicorn['backlog_socket'] = 1024
###! **Make sure somaxconn is equal or higher then backlog_socket**
# unicorn['somaxconn'] = 1024
###! **We do not recommend changing this setting**
# unicorn['log_directory'] = "/var/log/gitlab/unicorn"
### **Only change these settings if you understand well what they mean**
###! Docs: https://docs.gitlab.com/ee/administration/operations/unicorn.html#unicorn-worker-killer
###! https://github.com/kzk/unicorn-worker-killer
# unicorn['worker_memory_limit_min'] = "1024 * 1 << 20"
# unicorn['worker_memory_limit_max'] = "1280 * 1 << 20"
# unicorn['exporter_enabled'] = false
# unicorn['exporter_address'] = "127.0.0.1"
# unicorn['exporter_port'] = 8083
################################################################################
## GitLab Puma
##! Tweak puma settings. You should only use Unicorn or Puma, not both.
......
......@@ -58,5 +58,5 @@ execute 'restart geo-logcursor' do
command '/opt/gitlab/bin/gitlab-ctl restart geo-logcursor'
action :nothing
dependent_services.map { |svc| subscribes :run, "runit_service[#{svc}]" }
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
notifies :restart, "runit_service[puma]" if omnibus_helper.should_notify?('puma')
end
......@@ -27,7 +27,7 @@ gitlab_rails_source_dir = '/opt/gitlab/embedded/service/gitlab-rails'
gitlab_rails_dir = node['gitlab']['gitlab-rails']['dir']
gitlab_rails_etc_dir = File.join(gitlab_rails_dir, "etc")
dependent_services = %w(unicorn puma geo-logcursor sidekiq)
dependent_services = %w(puma geo-logcursor sidekiq)
templatesymlink 'Create a database_geo.yml and create a symlink to Rails root' do
link_from File.join(gitlab_rails_source_dir, 'config/database_geo.yml')
......
......@@ -20,7 +20,7 @@ gitlab_rails_source_dir = '/opt/gitlab/embedded/service/gitlab-rails'
gitlab_rails_dir = node['gitlab']['gitlab-rails']['dir']
gitlab_rails_etc_dir = File.join(gitlab_rails_dir, "etc")
dependent_services = %w(puma unicorn sidekiq)
dependent_services = %w(puma sidekiq)
templatesymlink 'Removes database_geo.yml symlink' do
link_from File.join(gitlab_rails_source_dir, 'config/database_geo.yml')
......
......@@ -19,7 +19,6 @@ omnibus_helper = OmnibusHelper.new(node)
migration_helper = GitlabGeoHelper.new(node)
dependent_services = []
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "runit_service[puma]" if omnibus_helper.should_notify?("puma")
dependent_services << "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
dependent_services << "sidekiq_service[sidekiq]" if omnibus_helper.should_notify?("sidekiq")
......
......@@ -486,7 +486,6 @@ default['gitlab']['gitlab-rails']['allowed_hosts'] = []
# List of ips and subnets that are allowed to access Gitlab monitoring endpoints
default['gitlab']['gitlab-rails']['monitoring_whitelist'] = ['127.0.0.0/8', '::1/128']
default['gitlab']['gitlab-rails']['monitoring_unicorn_sampler_interval'] = 10
default['gitlab']['gitlab-rails']['shutdown_blackout_seconds'] = 10
# Default dependent services to restart in the event that files-of-interest change
default['gitlab']['gitlab-rails']['dependent_services'] = %w{puma actioncable}
......@@ -511,29 +510,6 @@ default['gitlab']['gitlab-rails']['gitlab_kas_enabled'] = nil
default['gitlab']['gitlab-rails']['gitlab_kas_external_url'] = nil
default['gitlab']['gitlab-rails']['gitlab_kas_internal_url'] = nil
####
# Unicorn
####
default['gitlab']['unicorn']['enable'] = false
default['gitlab']['unicorn']['ha'] = false
default['gitlab']['unicorn']['log_directory'] = "/var/log/gitlab/unicorn"
default['gitlab']['unicorn']['listen'] = "127.0.0.1"
default['gitlab']['unicorn']['port'] = 8080
default['gitlab']['unicorn']['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
# Path to the unicorn server Process ID file
# defaults to /opt/gitlab/var/unicorn/unicorn.pid. The install-dir path is set at build time
default['gitlab']['unicorn']['pidfile'] = "#{node['package']['install-dir']}/var/unicorn/unicorn.pid"
default['gitlab']['unicorn']['tcp_nopush'] = true
default['gitlab']['unicorn']['backlog_socket'] = 1024
default['gitlab']['unicorn']['somaxconn'] = 1024
default['gitlab']['unicorn']['worker_timeout'] = 60
default['gitlab']['unicorn']['worker_memory_limit_min'] = "1024 * 1 << 20"
default['gitlab']['unicorn']['worker_memory_limit_max'] = "1280 * 1 << 20"
default['gitlab']['unicorn']['worker_processes'] = nil
default['gitlab']['unicorn']['exporter_enabled'] = false
default['gitlab']['unicorn']['exporter_address'] = "127.0.0.1"
default['gitlab']['unicorn']['exporter_port'] = 8083
####
# Puma
####
......@@ -793,7 +769,7 @@ default['gitlab']['remote-syslog']['dir'] = "/var/opt/gitlab/remote-syslog"
default['gitlab']['remote-syslog']['log_directory'] = "/var/log/gitlab/remote-syslog"
default['gitlab']['remote-syslog']['destination_host'] = "localhost"
default['gitlab']['remote-syslog']['destination_port'] = 514
default['gitlab']['remote-syslog']['services'] = %w(redis nginx puma unicorn gitlab-rails gitlab-shell postgresql sidekiq gitlab-workhorse gitlab-pages praefect gitlab-kas)
default['gitlab']['remote-syslog']['services'] = %w(redis nginx puma gitlab-rails gitlab-shell postgresql sidekiq gitlab-workhorse gitlab-pages praefect gitlab-kas)
###
# High Availability
......
......@@ -51,8 +51,8 @@ module GitlabMattermost
Gitlab['mattermost']['gitlab_token_endpoint'] ||= "#{gitlab_url}/oauth/token"
Gitlab['mattermost']['gitlab_user_api_endpoint'] ||= "#{gitlab_url}/api/v4/user"
# If mattermost is running on the same box as unicorn, allow it to communicate locally
if Services.enabled?('unicorn') || Services.enabled?('puma')
# If mattermost is running on the same box as puma, allow it to communicate locally
if Services.enabled?('puma')
Gitlab['mattermost']['service_allowed_untrusted_internal_connections'] ||= ''
Gitlab['mattermost']['service_allowed_untrusted_internal_connections'] << " #{URI(gitlab_url.to_s).host}"
end
......
class WebServerHelper
class << self
def enabled?
Services.enabled?('puma') || Services.enabled?('unicorn')
Services.enabled?('puma')
end
def service_name
# We are defaulting to Puma here if unicorn isn't explicitly enabled
if Services.enabled?('unicorn')
'unicorn'
else
'puma'
end
'puma'
end
def internal_api_url(node)
......
......@@ -61,7 +61,6 @@ module Logging
remote-syslog
sentinel
sidekiq
unicorn
puma
storage-check
).each do |runit_sv|
......
......@@ -18,19 +18,11 @@
module Puma
class << self
def parse_variables
only_one_allowed!
return unless Services.enabled?('puma')
parse_listen_address
end
def only_one_allowed!
return unless Services.enabled?('unicorn') && Services.enabled?('puma')
raise 'Only one web server (Puma or Unicorn) can be enabled at the same time!'
end
def parse_listen_address
puma_socket = Gitlab['puma']['socket'] || Gitlab['node']['gitlab']['puma']['socket']
Gitlab['gitlab_workhorse']['auth_socket'] = puma_socket if Gitlab['gitlab_workhorse']['auth_backend'].nil?
......
#
# Copyright:: Copyright (c) 2016 GitLab Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
module Unicorn
class << self
def parse_variables
parse_unicorn_listen_address
end
def parse_unicorn_listen_address
unicorn_socket = Gitlab['unicorn']['socket'] || Gitlab['node']['gitlab']['unicorn']['socket']
# The user has no custom settings for connecting workhorse to unicorn. Let's
# do what we think is best.
Gitlab['gitlab_workhorse']['auth_socket'] = unicorn_socket if Gitlab['gitlab_workhorse']['auth_backend'].nil?
end
def workers(total_memory = Gitlab['node']['memory']['total'].to_i)
[
2, # Two is the minimum or web editor will no longer work.
[
worker_cpus,
worker_memory(total_memory)
].min # min because we want to exceed neither CPU nor RAM
].max # max because we need at least 2 workers
end
# Number of cpus to use for a worker.
def worker_cpus
cpus = Gitlab['node']['cpu']['total'].to_i
# Oversubscribe CPUs by 50% based on typical performance.
(cpus * 1.5 + 1).to_i
end
# See how many worker processes fit in the system.
# Currently, Unicorn boots at 500-600 MB per process at startup.
def worker_memory(total_memory, retained_memory = 1572864, per_worker_ram = 614400)
(total_memory - retained_memory) / per_worker_ram
end
end
end
......@@ -34,7 +34,6 @@ ruby_block "Move existing certs and link to #{ssl_certs_dir}" do
cert_helper.link_certificates
end
only_if { cert_helper.new_certificate_added? }
notifies :restart, "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
notifies :restart, "runit_service[puma]" if omnibus_helper.should_notify?("puma")
notifies :restart, "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
notifies :restart, "runit_service[gitlab-pages]" if omnibus_helper.should_notify?("gitlab-pages")
......
......@@ -24,7 +24,6 @@ initial_license_file = node['gitlab']['gitlab-rails']['initial_license_file'] ||
initial_runner_token = node['gitlab']['gitlab-rails']['initial_shared_runners_registration_token']
dependent_services = []
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?("unicorn")
dependent_services << "runit_service[puma]" if omnibus_helper.should_notify?("puma")
dependent_services << "runit_service[actioncable]" if omnibus_helper.should_notify?("actioncable")
dependent_services << "sidekiq_service[sidekiq]" if omnibus_helper.should_notify?("sidekiq")
......
......@@ -96,7 +96,6 @@ include_recipe "gitlab::add_trusted_certs"
# Create dummy services to receive notifications, in case
# the corresponding service recipe is not loaded below.
%w(
unicorn
puma
actioncable
sidekiq
......@@ -136,7 +135,6 @@ include_recipe "gitlab::database_migrations" if node['gitlab']['gitlab-rails']['
# Configure Services
%w[
unicorn
puma
sidekiq
gitlab-workhorse
......
......@@ -145,7 +145,6 @@ node['gitlab']['gitlab-rails']['dependent_services'].each do |name|
end
dependent_services << "sidekiq_service[sidekiq]" if omnibus_helper.should_notify?('sidekiq')
dependent_services << "unicorn_service[unicorn]" if omnibus_helper.should_notify?('unicorn')
secret_file = File.join(gitlab_rails_etc_dir, "secret")
secret_symlink = File.join(gitlab_rails_source_dir, ".secret")
......@@ -298,7 +297,6 @@ templatesymlink "Create a gitlab.yml and create a symlink to Rails root" do
mattermost_host: mattermost_host,
mattermost_enabled: node['mattermost']['enable'] || !mattermost_host.nil?,
sidekiq: node['gitlab']['sidekiq'],
unicorn: node['gitlab']['unicorn'],
puma: node['gitlab']['puma'],
actioncable: node['gitlab']['actioncable'],
gitlab_shell_authorized_keys_file: node['gitlab']['gitlab-shell']['auth_file'],
......@@ -432,7 +430,7 @@ remote_file File.join(gitlab_rails_dir, 'REVISION') do
end
# If a version of ruby changes restart dependent services. Otherwise, services like
# unicorn will fail to reload until restarted
# Puma will fail to reload until restarted
version_file 'Create version file for Rails' do
version_file_path File.join(gitlab_rails_dir, 'RUBY_VERSION')
version_check_cmd '/opt/gitlab/embedded/bin/ruby --version'
......
......@@ -100,8 +100,6 @@ runit_service svc do
clean_metrics_dir: false
}.merge(params))
log_options node['gitlab']['logging'].to_hash.merge(node['gitlab'][svc].to_hash)
notifies :stop, 'unicorn_service[unicorn]', :before
end
if node['gitlab']['bootstrap']['enable']
......
......@@ -21,7 +21,6 @@ runit_service "puma" do
end
consul_service 'rails' do
not_if { node["gitlab"]["unicorn"]["enable"] }
action :delete
reload_service false unless node['consul']['enable']
end
#
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# Copyright:: Copyright (c) 2014 GitLab.com
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
account_helper = AccountHelper.new(node)
node.default['gitlab']['unicorn']['worker_processes'] = Unicorn.workers unless node['gitlab']['unicorn']['worker_processes']
unicorn_service 'unicorn' do
rails_app 'gitlab-rails'
user account_helper.gitlab_user
group account_helper.gitlab_group
end
consul_service 'rails' do
action Prometheus.service_discovery_action
ip_address node['gitlab']['unicorn']['listen']
port node['gitlab']['unicorn']['port']
reload_service false unless node['consul']['enable']
end
gitlab_sysctl "net.core.somaxconn" do
value node['gitlab']['unicorn']['somaxconn']
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment