Commit e7adcaa55b01ced9139135aeef072c2ee776ed0d
Exists in
master
and in
4 other branches
Merge pull request #3771 from senny/move-4-2-to-5-0-from-wiki-to-repo
move the update instructions for 4.2 to 5.0 from the Wiki into the Repo
Showing
1 changed file
with
163 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,163 @@ |
1 | +# From 4.2 to 5.0 | |
2 | + | |
3 | +## Important changes | |
4 | + | |
5 | +* We dont use `gitlab` user any more. Everything will be moved to `git` user | |
6 | +* __requires ruby1.9.3__ | |
7 | + | |
8 | + | |
9 | +__0. Stop gitlab__ | |
10 | + | |
11 | + sudo service gitlab stop | |
12 | + | |
13 | +__1. add bash to git user__ | |
14 | + | |
15 | +``` | |
16 | +sudo chsh -s /bin/bash git | |
17 | +``` | |
18 | + | |
19 | +__2. git clone gitlab-shell__ | |
20 | + | |
21 | +``` | |
22 | +sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git /home/git/gitlab-shell | |
23 | +``` | |
24 | + | |
25 | +__3. setup gitlab-shell__ | |
26 | + | |
27 | +```bash | |
28 | +# chmod all repos and files under git | |
29 | +sudo chown git:git -R /home/git/repositories/ | |
30 | + | |
31 | +# login as git | |
32 | +sudo su git | |
33 | +cd /home/git/gitlab-shell | |
34 | + | |
35 | +# copy config | |
36 | +cp config.yml.example config.yml | |
37 | + | |
38 | +# change url to gitlab instance | |
39 | +# ! make sure url end with '/' like 'https://gitlab.example/' | |
40 | +vim config.yml | |
41 | + | |
42 | +# rewrite hooks | |
43 | +./support/rewrite-hooks.sh | |
44 | + | |
45 | +# check ruby version for git user ( 1.9 required!! ) | |
46 | +# gitlab shell requires system ruby 1.9 | |
47 | +ruby -v | |
48 | + | |
49 | +# exit from git user | |
50 | +exit | |
51 | +``` | |
52 | + | |
53 | +__4. Copy gitlab instance to git user__ | |
54 | + | |
55 | +```bash | |
56 | +sudo cp -R /home/gitlab/gitlab /home/git/gitlab | |
57 | +sudo chown git:git -R /home/git/gitlab | |
58 | +sudo rm -rf /home/gitlab/gitlab-satellites | |
59 | + | |
60 | +# if exists | |
61 | +sudo rm /tmp/gitlab.socket | |
62 | +``` | |
63 | + | |
64 | +__5. Update gitlab to recent version__ | |
65 | + | |
66 | +```bash | |
67 | +cd /home/git/gitlab | |
68 | + | |
69 | +# backup current config | |
70 | +sudo -u git -H cp config/gitlab.yml config/gitlab.yml.old | |
71 | + | |
72 | +sudo -u git -H git fetch | |
73 | +sudo -u git -H git checkout 5-0-stable | |
74 | + | |
75 | +# replace config with recent one | |
76 | +sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml | |
77 | + | |
78 | +# edit it | |
79 | +sudo -u git -H vim config/gitlab.yml | |
80 | + | |
81 | + | |
82 | +sudo -u git -H bundle install --without development test postgres --deployment | |
83 | +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production | |
84 | +sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production | |
85 | +sudo -u git -H bundle exec rake gitlab:shell:build_missing_projects RAILS_ENV=production | |
86 | + | |
87 | +sudo -u git -H mkdir /home/git/gitlab-satellites | |
88 | +sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production | |
89 | + | |
90 | +# migrate wiki to git | |
91 | +sudo -u git -H bundle exec rake gitlab:wiki:migrate RAILS_ENV=production | |
92 | + | |
93 | + | |
94 | +# check permissions for /home/git/.ssh/ | |
95 | +sudo -u git -H chmod 700 /home/git/.ssh | |
96 | +sudo -u git -H chmod 600 /home/git/.ssh/authorized_keys | |
97 | + | |
98 | +# check permissions for /home/git/gitlab/ | |
99 | +sudo chown -R git /home/git/gitlab/log/ | |
100 | +sudo chown -R git /home/git/gitlab/tmp/ | |
101 | +sudo chmod -R u+rwX /home/git/gitlab/log/ | |
102 | +sudo chmod -R u+rwX /home/git/gitlab/tmp/ | |
103 | +sudo -u git -H mkdir /home/git/gitlab/tmp/pids/ | |
104 | +sudo chmod -R u+rwX /home/git/gitlab/tmp/pids | |
105 | + | |
106 | +``` | |
107 | + | |
108 | +__6. Update init.d script and nginx config__ | |
109 | + | |
110 | +```bash | |
111 | +# init.d | |
112 | +sudo rm /etc/init.d/gitlab | |
113 | +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab | |
114 | +sudo chmod +x /etc/init.d/gitlab | |
115 | + | |
116 | +# unicorn | |
117 | +sudo -u git -H cp /home/git/gitlab/config/unicorn.rb /home/git/gitlab/config/unicorn.rb.old | |
118 | +sudo -u git -H cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/config/unicorn.rb | |
119 | + | |
120 | +#nginx | |
121 | +# Replace path from '/home/gitlab/' to '/home/git/' | |
122 | +sudo vim /etc/nginx/sites-enabled/gitlab | |
123 | +sudo service nginx restart | |
124 | + | |
125 | + | |
126 | +``` | |
127 | + | |
128 | +__7. Start gitlab instace__ | |
129 | + | |
130 | +``` | |
131 | + | |
132 | + | |
133 | +sudo service gitlab start | |
134 | + | |
135 | +# check if unicorn and sidekiq started | |
136 | +# If not try to logout, also check replaced path from '/home/gitlab/' to '/home/git/' | |
137 | +# in nginx, unicorn, init.d etc | |
138 | +ps aux | grep unicorn | |
139 | +ps aux | grep sidekiq | |
140 | + | |
141 | +``` | |
142 | + | |
143 | +__8. Check installation__ | |
144 | + | |
145 | + | |
146 | +```bash | |
147 | +# In 5-10 seconds lets check gitlab-shell | |
148 | +sudo -u git -H /home/git/gitlab-shell/bin/check | |
149 | + | |
150 | +# Example of success output | |
151 | +# Check GitLab API access: OK | |
152 | +# Check directories and files: | |
153 | +# /home/git/repositories: OK | |
154 | +# /home/git/.ssh/authorized_keys: OK | |
155 | + | |
156 | + | |
157 | +# Now check gitlab instance | |
158 | +sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production | |
159 | + | |
160 | +``` | |
161 | + | |
162 | + | |
163 | +__P.S. If everything works as expected you can remove gitlab user from system__ | ... | ... |