1 diff --git a/config/environments/production.rb b/config/environments/production.rb
2 index e1a7db8d860..5823f170410 100644
3 --- a/config/environments/production.rb
4 +++ b/config/environments/production.rb
7 config.action_mailer.delivery_method = :sendmail
9 - # # config.action_mailer.sendmail_settings = {
10 - # # location: '/usr/sbin/sendmail',
11 - # # arguments: '-i -t'
13 + config.action_mailer.sendmail_settings = {
14 + location: '/run/wrappers/bin/sendmail',
17 config.action_mailer.perform_deliveries = true
18 config.action_mailer.raise_delivery_errors = true
20 diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
21 index da1a15302da..c846db93e5c 100644
22 --- a/config/gitlab.yml.example
23 +++ b/config/gitlab.yml.example
24 @@ -1191,7 +1191,7 @@ production: &base
26 # Use the default values unless you really know what you are doing
28 - bin_path: /usr/bin/git
32 # If enabled, this will tell rails to serve frontend assets from the webpack-dev-server running
33 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
34 index d096174fca3a..02d0f689c523 100644
35 --- a/config/initializers/1_settings.rb
36 +++ b/config/initializers/1_settings.rb
38 Settings.gitlab['user_home'] ||= begin
39 Etc.getpwnam(Settings.gitlab['user']).dir
40 rescue ArgumentError # no user configured
41 - '/home/' + Settings.gitlab['user']
44 Settings.gitlab['time_zone'] ||= nil
45 Settings.gitlab['signup_enabled'] ||= true if Settings.gitlab['signup_enabled'].nil?
49 Settings['git'] ||= {}
50 -Settings.git['bin_path'] ||= '/usr/bin/git'
51 +Settings.git['bin_path'] ||= 'git'
53 # Important: keep the satellites.path setting until GitLab 9.0 at
54 # least. This setting is fed to 'rm -rf' in
55 diff --git a/config/puma.rb.example b/config/puma.rb.example
56 index 07a6f6a25015..14a718a43202 100644
57 --- a/config/puma.rb.example
58 +++ b/config/puma.rb.example
60 # The default is "config.ru".
63 -pidfile '/home/git/gitlab/tmp/pids/puma.pid'
64 -state_path '/home/git/gitlab/tmp/pids/puma.state'
66 -stdout_redirect '/home/git/gitlab/log/puma.stdout.log',
67 - '/home/git/gitlab/log/puma.stderr.log',
69 +pidfile ENV['PUMA_PATH'] + '/tmp/pids/puma.pid'
70 +state_path ENV['PUMA_PATH'] + '/tmp/pids/puma.state'
72 # Configure "min" to be the minimum number of threads to use to answer
73 # requests and "max" the maximum.
74 @@ -31,11 +27,11 @@ queue_requests false
76 # Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
78 -bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket'
79 +bind "unix://#{ENV['PUMA_PATH']}/tmp/sockets/gitlab.socket"
83 -require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
84 +require_relative ENV['GITLAB_PATH'] + "lib/gitlab/cluster/lifecycle_events"
87 # Signal application hooks that we're about to restart
88 @@ -74,7 +70,7 @@ worker_timeout 60
89 wait_for_less_busy_worker ENV.fetch('PUMA_WAIT_FOR_LESS_BUSY_WORKER', 0.001).to_f
92 -require_relative "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter"
93 +require_relative ENV['GITLAB_PATH'] + "lib/gitlab/puma_logging/json_formatter"
95 json_formatter = Gitlab::PumaLogging::JSONFormatter.new
96 log_formatter do |str|
97 diff --git a/lib/api/api.rb b/lib/api/api.rb
98 index a287ffbfcd8..1a5ca59183a 100644
101 @@ -4,7 +4,7 @@ module API
102 class API < ::API::Base
105 - LOG_FILENAME = Rails.root.join("log", "api_json.log")
106 + LOG_FILENAME = File.join(ENV["GITLAB_LOG_PATH"], "api_json.log")
108 NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze
109 NAMESPACE_OR_PROJECT_REQUIREMENTS = { id: NO_SLASH_URL_PART_REGEX }.freeze
110 diff --git a/lib/gitlab/authorized_keys.rb b/lib/gitlab/authorized_keys.rb
111 index 50cd15b7a10..3ac89e5b8e9 100644
112 --- a/lib/gitlab/authorized_keys.rb
113 +++ b/lib/gitlab/authorized_keys.rb
114 @@ -157,7 +157,7 @@ def command(id)
115 raise KeyError, "Invalid ID: #{id.inspect}"
118 - "#{File.join(Gitlab.config.gitlab_shell.path, 'bin', 'gitlab-shell')} #{id}"
119 + "#{File.join('/run/current-system/sw/bin', 'gitlab-shell')} #{id}"
123 diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb
124 index 89a4e36a232..ae379ffb27a 100644
125 --- a/lib/gitlab/logger.rb
126 +++ b/lib/gitlab/logger.rb
127 @@ -37,7 +37,7 @@ def self.build
130 def self.full_log_path
131 - Rails.root.join("log", file_name)
132 + File.join(ENV["GITLAB_LOG_PATH"], file_name)
136 diff --git a/lib/gitlab/uploads_transfer.rb b/lib/gitlab/uploads_transfer.rb
137 index e0e7084e27e..19fab855b90 100644
138 --- a/lib/gitlab/uploads_transfer.rb
139 +++ b/lib/gitlab/uploads_transfer.rb
142 class UploadsTransfer < ProjectTransfer
145 + ENV['GITLAB_UPLOADS_PATH'] || FileUploader.root
149 diff --git a/lib/system_check/app/log_writable_check.rb b/lib/system_check/app/log_writable_check.rb
150 index 2c108f0c18d..3a16ff52d01 100644
151 --- a/lib/system_check/app/log_writable_check.rb
152 +++ b/lib/system_check/app/log_writable_check.rb
153 @@ -23,7 +23,7 @@ def show_error
157 - Rails.root.join('log')
158 + ENV["GITLAB_LOG_PATH"]
162 diff --git a/lib/system_check/app/uploads_directory_exists_check.rb b/lib/system_check/app/uploads_directory_exists_check.rb
163 index 54dff63ab61..882da702f29 100644
164 --- a/lib/system_check/app/uploads_directory_exists_check.rb
165 +++ b/lib/system_check/app/uploads_directory_exists_check.rb
166 @@ -6,12 +6,13 @@ class UploadsDirectoryExistsCheck < SystemCheck::BaseCheck
167 set_name 'Uploads directory exists?'
170 - File.directory?(Rails.root.join('public/uploads'))
171 + File.directory?(ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads'))
175 + uploads_dir = ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads')
177 - "sudo -u #{gitlab_user} mkdir #{Rails.root}/public/uploads"
178 + "sudo -u #{gitlab_user} mkdir #{uploads_dir}"
180 for_more_information(
181 see_installation_guide_section('GitLab')
182 diff --git a/lib/system_check/app/uploads_path_permission_check.rb b/lib/system_check/app/uploads_path_permission_check.rb
183 index 2e1cc687c43..ca69d63bcf6 100644
184 --- a/lib/system_check/app/uploads_path_permission_check.rb
185 +++ b/lib/system_check/app/uploads_path_permission_check.rb
186 @@ -27,7 +27,7 @@ def show_error
189 def rails_uploads_path
190 - Rails.root.join('public/uploads')
191 + ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads')
195 diff --git a/lib/system_check/app/uploads_path_tmp_permission_check.rb b/lib/system_check/app/uploads_path_tmp_permission_check.rb
196 index 567c7540777..29906b1c132 100644
197 --- a/lib/system_check/app/uploads_path_tmp_permission_check.rb
198 +++ b/lib/system_check/app/uploads_path_tmp_permission_check.rb
199 @@ -35,7 +35,7 @@ def upload_path_tmp
203 - File.realpath(Rails.root.join('public/uploads'))
204 + File.realpath(ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads'))
208 diff --git a/scripts/decomposition/generate-loose-foreign-key b/scripts/decomposition/generate-loose-foreign-key
209 index 35f84c64ce1..c2fecf3404c 100755
210 --- a/scripts/decomposition/generate-loose-foreign-key
211 +++ b/scripts/decomposition/generate-loose-foreign-key
213 -#!/usr/bin/env -S ENABLE_SPRING=0 bin/rails runner -e test
214 +#!/usr/bin/env rails
216 # This is helper script to swap foreign key to loose foreign key