Skip to content
config.ru 924 B
Newer Older
gitlabhq's avatar
gitlabhq committed
# This file is used by Rack-based servers to start the application.

  require 'unicorn'
  if ENV['RAILS_ENV'] == 'production' || ENV['RAILS_ENV'] == 'staging'
    # Unicorn self-process killer
    require 'unicorn/worker_killer'

    min = (ENV['GITLAB_UNICORN_MEMORY_MIN'] || 400 * 1 << 20).to_i
    max = (ENV['GITLAB_UNICORN_MEMORY_MAX'] || 650 * 1 << 20).to_i
    # Max memory size (RSS) per worker
    use Unicorn::WorkerKiller::Oom, min, max

  # Monkey patch for fixing Rack 2.0.6 bug:
  # https://gitlab.com/gitlab-org/gitlab-ee/issues/8539
  Unicorn::StreamInput.send(:public, :eof?) # rubocop:disable GitlabSecurity/PublicSend
require ::File.expand_path('../config/environment', __FILE__)
warmup do |app|
  client = Rack::MockRequest.new(app)
  client.get('/')
end

map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
Lin Jen-Shin's avatar
Lin Jen-Shin committed
  use Gitlab::Middleware::ReleaseEnv
  run Gitlab::Application
end