Commit 37c6348d332d3eaaf70149be2ccfc62ae4d00eb0
1 parent
6654db2c
update upgrade guide with backup, db specific commands, config changes, check, and restore
Showing
1 changed file
with
57 additions
and
2 deletions
Show diff stats
doc/update/5.1-to-5.2.md
| 1 | # From 5.1 to 5.2 | 1 | # From 5.1 to 5.2 |
| 2 | 2 | ||
| 3 | +### 0. Backup | ||
| 4 | + | ||
| 5 | +It's useful to make a backup just in case things go south: | ||
| 6 | +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) | ||
| 7 | + | ||
| 8 | +```bash | ||
| 9 | +cd /home/git/gitlab | ||
| 10 | +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create | ||
| 11 | +``` | ||
| 12 | + | ||
| 3 | ### 1. Stop server | 13 | ### 1. Stop server |
| 4 | 14 | ||
| 5 | sudo service gitlab stop | 15 | sudo service gitlab stop |
| @@ -20,14 +30,59 @@ sudo -u git -H git fetch | @@ -20,14 +30,59 @@ sudo -u git -H git fetch | ||
| 20 | sudo -u git -H git checkout v1.4.0 | 30 | sudo -u git -H git checkout v1.4.0 |
| 21 | ``` | 31 | ``` |
| 22 | 32 | ||
| 23 | -### 4. Install libs, migrations etc | 33 | +### 4. Install libs, migrations, etc. |
| 24 | 34 | ||
| 25 | ```bash | 35 | ```bash |
| 26 | cd /home/git/gitlab | 36 | cd /home/git/gitlab |
| 37 | + | ||
| 38 | +# MySQL | ||
| 27 | sudo -u git -H bundle install --without development test postgres --deployment | 39 | sudo -u git -H bundle install --without development test postgres --deployment |
| 40 | + | ||
| 41 | +#PostgreSQL | ||
| 42 | +sudo -u git -H bundle install --without development test mysql --deployment | ||
| 43 | + | ||
| 28 | sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production | 44 | sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production |
| 29 | ``` | 45 | ``` |
| 30 | 46 | ||
| 31 | -### 5. Start application | 47 | +### 5. Update config files |
| 48 | + | ||
| 49 | +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-2-stable/config/gitlab.yml.example but with your settings. | ||
| 50 | +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-2-stable/config/puma.rb.example but with your settings. | ||
| 51 | + | ||
| 52 | +### 6. Update Init script | ||
| 53 | + | ||
| 54 | +```bash | ||
| 55 | +sudo rm /etc/init.d/gitlab | ||
| 56 | +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-2-stable/lib/support/init.d/gitlab | ||
| 57 | +sudo chmod +x /etc/init.d/gitlab | ||
| 58 | +``` | ||
| 59 | + | ||
| 60 | +### 6. Start application | ||
| 32 | 61 | ||
| 33 | sudo service gitlab start | 62 | sudo service gitlab start |
| 63 | + sudo service nginx restart | ||
| 64 | + | ||
| 65 | +### 7. Check application status | ||
| 66 | + | ||
| 67 | +Check if GitLab and its environment are configured correctly: | ||
| 68 | + | ||
| 69 | + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production | ||
| 70 | + | ||
| 71 | +To make sure you didn't miss anything run a more thorough check with: | ||
| 72 | + | ||
| 73 | + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production | ||
| 74 | + | ||
| 75 | +If all items are green, then congratulations upgrade complete! | ||
| 76 | + | ||
| 77 | +## Things went south? Revert to previous version (5.1) | ||
| 78 | + | ||
| 79 | +### 1. Revert the code to the previous version | ||
| 80 | +Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration | ||
| 81 | +(The backup is already migrated to the previous version) | ||
| 82 | + | ||
| 83 | +### 2. Restore from the backup: | ||
| 84 | + | ||
| 85 | +```bash | ||
| 86 | +cd /home/git/gitlab | ||
| 87 | +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:restore | ||
| 88 | +``` |