|
| 1 | +# From 5.1 to 5.4 |
| 2 | +Also works starting from 5.2. |
| 3 | + |
| 4 | +## Notice |
| 5 | +Security vulnerabilities CVE-2013-4490 and CVE-2013-4489 have been patched in the latest version of GitLab 5.4. |
| 6 | + |
| 7 | +### 0. Backup |
| 8 | + |
| 9 | +It's useful to make a backup just in case things go south: |
| 10 | +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) |
| 11 | + |
| 12 | +```bash |
| 13 | +cd /home/git/gitlab |
| 14 | +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production |
| 15 | +``` |
| 16 | + |
| 17 | +### 1. Stop server |
| 18 | + |
| 19 | + sudo service gitlab stop |
| 20 | + |
| 21 | +### 2. Get latest code |
| 22 | + |
| 23 | +```bash |
| 24 | +cd /home/git/gitlab |
| 25 | +sudo -u git -H git fetch |
| 26 | +sudo -u git -H git checkout 5-4-stable # Latest version of 5-4-stable addresses CVE-2013-4489 |
| 27 | +``` |
| 28 | + |
| 29 | +### 3. Update gitlab-shell |
| 30 | + |
| 31 | +```bash |
| 32 | +cd /home/git/gitlab-shell |
| 33 | +sudo -u git -H git fetch |
| 34 | +sudo -u git -H git checkout v1.7.4 # Addresses CVE-2013-4490 |
| 35 | +``` |
| 36 | + |
| 37 | +### 4. Install libs, migrations, etc. |
| 38 | + |
| 39 | +```bash |
| 40 | +cd /home/git/gitlab |
| 41 | + |
| 42 | +# MySQL |
| 43 | +sudo -u git -H bundle install --without development test postgres --deployment |
| 44 | + |
| 45 | +#PostgreSQL |
| 46 | +sudo -u git -H bundle install --without development test mysql --deployment |
| 47 | + |
| 48 | +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production |
| 49 | + |
| 50 | +sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production |
| 51 | +``` |
| 52 | + |
| 53 | +### 5. Update config files |
| 54 | + |
| 55 | +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-4-stable/config/gitlab.yml.example but with your settings. |
| 56 | +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-4-stable/config/puma.rb.example but with your settings. |
| 57 | + |
| 58 | +### 6. Update Init script |
| 59 | + |
| 60 | +```bash |
| 61 | +sudo rm /etc/init.d/gitlab |
| 62 | +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab |
| 63 | +sudo chmod +x /etc/init.d/gitlab |
| 64 | +``` |
| 65 | + |
| 66 | +### 7. Create uploads directory |
| 67 | + |
| 68 | +```bash |
| 69 | +cd /home/git/gitlab |
| 70 | +sudo -u git -H mkdir public/uploads |
| 71 | +sudo chmod -R u+rwX public/uploads |
| 72 | +``` |
| 73 | + |
| 74 | + |
| 75 | +### 8. Start application |
| 76 | + |
| 77 | + sudo service gitlab start |
| 78 | + sudo service nginx restart |
| 79 | + |
| 80 | +### 9. Check application status |
| 81 | + |
| 82 | +Check if GitLab and its environment are configured correctly: |
| 83 | + |
| 84 | + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production |
| 85 | + |
| 86 | +To make sure you didn't miss anything run a more thorough check with: |
| 87 | + |
| 88 | + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production |
| 89 | + |
| 90 | +If all items are green, then congratulations upgrade complete! |
| 91 | + |
| 92 | +## Things went south? Revert to previous version (5.3) |
| 93 | + |
| 94 | +### 1. Revert the code to the previous version |
| 95 | +Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration |
| 96 | +(The backup is already migrated to the previous version) |
| 97 | + |
| 98 | +### 2. Restore from the backup: |
| 99 | + |
| 100 | +```bash |
| 101 | +cd /home/git/gitlab |
| 102 | +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production |
| 103 | +``` |
0 commit comments