about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/version-management/gitlab/remove-hardcoded-locations.patch
blob: 83e3d7fe1414cd83835e85a33d3cfba95e0cd424 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d9b3ee354b0..1eb0507488b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -69,10 +69,10 @@
 
   config.action_mailer.delivery_method = :sendmail
   # Defaults to:
-  # # config.action_mailer.sendmail_settings = {
-  # #   location: '/usr/sbin/sendmail',
-  # #   arguments: '-i -t'
-  # # }
+  config.action_mailer.sendmail_settings = {
+    location: '/run/wrappers/bin/sendmail',
+    arguments: '-i -t'
+  }
   config.action_mailer.perform_deliveries = true
   config.action_mailer.raise_delivery_errors = true
 
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 92e7501d49d..4ee5a1127df 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -1168,7 +1168,7 @@ production: &base
   # CAUTION!
   # Use the default values unless you really know what you are doing
   git:
-    bin_path: /usr/bin/git
+    bin_path: git
 
   ## Webpack settings
   # If enabled, this will tell rails to serve frontend assets from the webpack-dev-server running
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index bbed08f5044..2906e5c44af 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -183,7 +183,7 @@
 Settings.gitlab['user_home'] ||= begin
   Etc.getpwnam(Settings.gitlab['user']).dir
                                  rescue ArgumentError # no user configured
-                                   '/home/' + Settings.gitlab['user']
+                                   '/homeless-shelter'
 end
 Settings.gitlab['time_zone'] ||= nil
 Settings.gitlab['signup_enabled'] ||= true if Settings.gitlab['signup_enabled'].nil?
@@ -751,7 +751,7 @@
 # Git
 #
 Settings['git'] ||= Settingslogic.new({})
-Settings.git['bin_path'] ||= '/usr/bin/git'
+Settings.git['bin_path'] ||= 'git'
 
 # Important: keep the satellites.path setting until GitLab 9.0 at
 # least. This setting is fed to 'rm -rf' in
diff --git a/config/puma.rb.example b/config/puma.rb.example
index 9fc354a8fe8..2352ca9b58c 100644
--- a/config/puma.rb.example
+++ b/config/puma.rb.example
@@ -5,12 +5,8 @@
 # The default is "config.ru".
 #
 rackup 'config.ru'
-pidfile '/home/git/gitlab/tmp/pids/puma.pid'
-state_path '/home/git/gitlab/tmp/pids/puma.state'
-
-stdout_redirect '/home/git/gitlab/log/puma.stdout.log',
-  '/home/git/gitlab/log/puma.stderr.log',
-  true
+pidfile ENV['PUMA_PATH'] + '/tmp/pids/puma.pid'
+state_path ENV['PUMA_PATH'] + '/tmp/pids/puma.state'
 
 # Configure "min" to be the minimum number of threads to use to answer
 # requests and "max" the maximum.
@@ -31,12 +27,12 @@ queue_requests false
 
 # Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
 # accepted protocols.
-bind 'unix:///home/git/gitlab/tmp/sockets/gitlab.socket'
+bind "unix://#{ENV['PUMA_PATH']}/tmp/sockets/gitlab.socket"
 
 workers 3
 
-require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
-require_relative "/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initializer"
+require_relative ENV['GITLAB_PATH'] + "lib/gitlab/cluster/lifecycle_events"
+require_relative ENV['GITLAB_PATH'] + "lib/gitlab/cluster/puma_worker_killer_initializer"
 
 on_restart do
   # Signal application hooks that we're about to restart
@@ -80,7 +76,7 @@ if defined?(nakayoshi_fork)
 end
 
 # Use json formatter
-require_relative "/home/git/gitlab/lib/gitlab/puma_logging/json_formatter"
+require_relative ENV['GITLAB_PATH'] + "lib/gitlab/puma_logging/json_formatter"
 
 json_formatter = Gitlab::PumaLogging::JSONFormatter.new
 log_formatter do |str|
diff --git a/lib/api/api.rb b/lib/api/api.rb
index ada0da28749..8a3f5824008 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -4,7 +4,7 @@ module API
   class API < ::API::Base
     include APIGuard
 
-    LOG_FILENAME = Rails.root.join("log", "api_json.log")
+    LOG_FILENAME = File.join(ENV["GITLAB_LOG_PATH"], "api_json.log")
 
     NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze
     NAMESPACE_OR_PROJECT_REQUIREMENTS = { id: NO_SLASH_URL_PART_REGEX }.freeze
diff --git a/lib/gitlab/authorized_keys.rb b/lib/gitlab/authorized_keys.rb
index 50cd15b7a10..3ac89e5b8e9 100644
--- a/lib/gitlab/authorized_keys.rb
+++ b/lib/gitlab/authorized_keys.rb
@@ -157,7 +157,7 @@ def command(id)
         raise KeyError, "Invalid ID: #{id.inspect}"
       end
 
-      "#{File.join(Gitlab.config.gitlab_shell.path, 'bin', 'gitlab-shell')} #{id}"
+      "#{File.join('/run/current-system/sw/bin', 'gitlab-shell')} #{id}"
     end
 
     def strip(key)
diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb
index 89a4e36a232..ae379ffb27a 100644
--- a/lib/gitlab/logger.rb
+++ b/lib/gitlab/logger.rb
@@ -37,7 +37,7 @@ def self.build
     end
 
     def self.full_log_path
-      Rails.root.join("log", file_name)
+      File.join(ENV["GITLAB_LOG_PATH"], file_name)
     end
 
     def self.cache_key
diff --git a/lib/gitlab/uploads_transfer.rb b/lib/gitlab/uploads_transfer.rb
index e0e7084e27e..19fab855b90 100644
--- a/lib/gitlab/uploads_transfer.rb
+++ b/lib/gitlab/uploads_transfer.rb
@@ -3,7 +3,7 @@
 module Gitlab
   class UploadsTransfer < ProjectTransfer
     def root_dir
-      FileUploader.root
+      ENV['GITLAB_UPLOADS_PATH'] || FileUploader.root
     end
   end
 end
diff --git a/lib/system_check/app/log_writable_check.rb b/lib/system_check/app/log_writable_check.rb
index 2c108f0c18d..3a16ff52d01 100644
--- a/lib/system_check/app/log_writable_check.rb
+++ b/lib/system_check/app/log_writable_check.rb
@@ -23,7 +23,7 @@ def show_error
       private
 
       def log_path
-        Rails.root.join('log')
+        ENV["GITLAB_LOG_PATH"]
       end
     end
   end
diff --git a/lib/system_check/app/uploads_directory_exists_check.rb b/lib/system_check/app/uploads_directory_exists_check.rb
index 54dff63ab61..882da702f29 100644
--- a/lib/system_check/app/uploads_directory_exists_check.rb
+++ b/lib/system_check/app/uploads_directory_exists_check.rb
@@ -6,12 +6,13 @@ class UploadsDirectoryExistsCheck < SystemCheck::BaseCheck
       set_name 'Uploads directory exists?'
 
       def check?
-        File.directory?(Rails.root.join('public/uploads'))
+        File.directory?(ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads'))
       end
 
       def show_error
+        uploads_dir = ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads')
         try_fixing_it(
-          "sudo -u #{gitlab_user} mkdir #{Rails.root}/public/uploads"
+          "sudo -u #{gitlab_user} mkdir #{uploads_dir}"
         )
         for_more_information(
           see_installation_guide_section('GitLab')
diff --git a/lib/system_check/app/uploads_path_permission_check.rb b/lib/system_check/app/uploads_path_permission_check.rb
index 2e1cc687c43..ca69d63bcf6 100644
--- a/lib/system_check/app/uploads_path_permission_check.rb
+++ b/lib/system_check/app/uploads_path_permission_check.rb
@@ -27,7 +27,7 @@ def show_error
       private
 
       def rails_uploads_path
-        Rails.root.join('public/uploads')
+        ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads')
       end
 
       def uploads_fullpath
diff --git a/lib/system_check/app/uploads_path_tmp_permission_check.rb b/lib/system_check/app/uploads_path_tmp_permission_check.rb
index 567c7540777..29906b1c132 100644
--- a/lib/system_check/app/uploads_path_tmp_permission_check.rb
+++ b/lib/system_check/app/uploads_path_tmp_permission_check.rb
@@ -35,7 +35,7 @@ def upload_path_tmp
       end
 
       def uploads_fullpath
-        File.realpath(Rails.root.join('public/uploads'))
+        File.realpath(ENV['GITLAB_UPLOADS_PATH'] || Rails.root.join('public/uploads'))
       end
     end
   end