Skip to content

Commit 5066e95

Browse files
committed
Merge branch 'master' of /mnt/ebs/repositories/arifali1/gitlab-recipes
2 parents 1211761 + 5a240fb commit 5066e95

File tree

1 file changed

+27
-41
lines changed

1 file changed

+27
-41
lines changed

misc/homedir/movedir.md renamed to misc/change-git-home-directory/README.md

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ or you can run the following command
2020
groupmod -g 500 git
2121
```
2222

23-
Amended the `/etc/passwd` file to change the uid, gid and the home directory for git
23+
Amend the `/etc/passwd` file to change the uid, gid and the home directory for git
2424

2525
```bash
2626
git:x:500:500:GitLab,,,:/var/lib/git:/bin/bash
@@ -31,7 +31,7 @@ or you can run the following command
3131
usermod -d /var/lib/git -g 500 -u 500 git
3232
```
3333

34-
### 2. Move the git folder
34+
### 2. Copy the git folder
3535

3636
```bash
3737
cp -r /home/git /var/lib/
@@ -44,7 +44,8 @@ chown -R git:git /var/lib/git
4444
```
4545

4646
### 4. Update Gitlab config files
47-
update `~git/gitlab/config/gitlab.yml`, using the following command
47+
48+
Update `~git/gitlab/config/gitlab.yml`, using the following command
4849

4950
```bash
5051
sed -i -e 's/\/home/\/var\/lib/g' ~git/gitlab/config/gitlab.yml
@@ -123,7 +124,8 @@ You should see the following difference after running the command
123124
```
124125

125126
### 5. Update Gitlab shell config file
126-
update `~git/gitlab-shell/config.yml`, using the following command
127+
128+
Update `~git/gitlab-shell/config.yml`, using the following command
127129

128130
```bash
129131
sed -i -e 's/\/home/\/var\/lib/g' ~git/gitlab-shell/config.yml
@@ -159,42 +161,14 @@ sed -i -e 's/\/home/\/var\/lib/g' ~git/.ssh/authorized_keys
159161

160162
### 7. Update nginx config file
161163

162-
update `/etc/nginx/sites-enabled/gitlab`, using the following command
164+
Update `/etc/nginx/sites-enabled/gitlab`, using the following command
163165

164166
```bash
165167
sed -i -e 's/\/home/\/var\/lib/g' /etc/nginx/sites-enabled/gitlab
166168
```
167169

168170
### 8. Add/Update gitlab service and default files
169171

170-
We need to apply the following patch to `/etc/init.d/gitlab`, This has been submitted as a
171-
PR already to gitlabhq. This enables to read the default file, and initialises other variables.
172-
Without this diff, other variables then also need to be defined in `/etc/default/gitlab`
173-
174-
```diff
175-
--- gitlab 2013-12-20 16:27:14.919395198 -0500
176-
+++ /etc/init.d/gitlab 2014-01-06 08:51:18.253120785 -0500
177-
@@ -31,14 +31,15 @@
178-
# internal /bin/sh variables such as PATH, EDITOR or SHELL.
179-
app_user="git"
180-
app_root="/home/$app_user/gitlab"
181-
+
182-
+# Read configuration variable file if it is present
183-
+test -f /etc/default/gitlab && . /etc/default/gitlab
184-
+
185-
pid_path="$app_root/tmp/pids"
186-
socket_path="$app_root/tmp/sockets"
187-
web_server_pid_path="$pid_path/unicorn.pid"
188-
sidekiq_pid_path="$pid_path/sidekiq.pid"
189-
190-
-# Read configuration variable file if it is present
191-
-test -f /etc/default/gitlab && . /etc/default/gitlab
192-
-
193-
# Switch to the app_user if it is not he/she who is running the script.
194-
if [ "$USER" != "$app_user" ]; then
195-
sudo -u "$app_user" -H -i $0 "$@"; exit;
196-
```
197-
198172
If you haven't already, copy the service default file, then do so, and then update the file to point to the new home directory
199173

200174
```bash
@@ -217,27 +191,39 @@ cd ~git
217191
sudo -u git -H gitlab-shell/support/rewrite-hooks.sh
218192
```
219193

220-
### 10. Restart application
194+
### 11. Update logrotate files
195+
196+
```
197+
sed -i -e 's/\/home/\/var\/lib/g' /etc/logrotate.d/gitlab
198+
```
199+
200+
### 12. Restart application
221201

222202
```bash
223203
sudo service gitlab restart
224204
sudo service nginx restart
225205
```
226206

227-
### 11. Check application status
207+
### 13. Check application status
228208

229209
Check if GitLab and its environment are configured correctly:
230210

231-
cd ~git/gitlab
232-
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
211+
```bash
212+
cd ~git/gitlab
213+
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
214+
```
233215

234216
To make sure you didn't miss anything run a more thorough check with:
235217

236-
cd ~git/gitlab
237-
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
218+
```bash
219+
cd ~git/gitlab
220+
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
221+
```
238222

239-
### 12. Remove old home
223+
### 14. Remove old home
240224

241225
Once you are happy that everything is now working in the new directory, you can remove the old `/home/git`
242226

243-
rm -rf /home/git
227+
```bash
228+
rm -rf /home/git
229+
```

0 commit comments

Comments
 (0)