Commit d9cb02f1a232b6dcb144332b3c7ec59e2a11ce37

Authored by Jacob Vosmaer
1 parent 83878066

Add a combined update doc from 5.1 to 6.0

Showing 1 changed file with 153 additions and 0 deletions   Show diff stats
doc/update/5.1-to-6.0.md 0 → 100644
... ... @@ -0,0 +1,153 @@
  1 +# From 5.1 to 6.0
  2 +
  3 +### Deprecations
  4 +
  5 +#### Global projects
  6 +
  7 +The root (global) namespace for projects is deprecated.
  8 +So you need to move all your global projects under groups or users manually before update or they will be automatically moved to the project owner namespace during the update. When a project is moved all its members will receive an email with instructions how to update their git remote url. Please make sure you disable sending email when you do a test of the upgrade.
  9 +
  10 +#### Teams
  11 +
  12 +We introduce group membership in 6.0 as a replacement for teams.
  13 +The old combination of groups and teams was confusing for a lot of people.
  14 +And when the members of a team where changed this wasn't reflected in the project permissions.
  15 +In GitLab 6.0 you will be able to add members to a group with a permission level for each member.
  16 +These group members will have access to the projects in that group.
  17 +Any changes to group members will immediately be reflected in the project permissions.
  18 +You can even have multiple owners for a group, greatly simplifying administration.
  19 +
  20 +### 0. Backup
  21 +
  22 +It's useful to make a backup just in case things go south:
  23 +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version)
  24 +
  25 +```bash
  26 +cd /home/git/gitlab
  27 +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
  28 +```
  29 +
  30 +### 1. Stop server
  31 +
  32 + sudo service gitlab stop
  33 +
  34 +### 2. Get latest code
  35 +
  36 +```bash
  37 +cd /home/git/gitlab
  38 +sudo -u git -H git fetch
  39 +sudo -u git -H git checkout 6-0-stable
  40 +```
  41 +
  42 +### 3. Update gitlab-shell
  43 +
  44 +```bash
  45 +cd /home/git/gitlab-shell
  46 +sudo -u git -H git fetch
  47 +sudo -u git -H git checkout v1.7.0
  48 +```
  49 +
  50 +### 4. Install additional packages
  51 +
  52 +```bash
  53 +# For reStructuredText markup language support install required package:
  54 +sudo apt-get install python-docutils
  55 +```
  56 +
  57 +### 5. Install libs, migrations, etc.
  58 +
  59 +```bash
  60 +cd /home/git/gitlab
  61 +
  62 +# MySQL
  63 +sudo -u git -H bundle install --without development test postgres --deployment
  64 +
  65 +#PostgreSQL
  66 +sudo -u git -H bundle install --without development test mysql --deployment
  67 +
  68 +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
  69 +sudo -u git -H bundle exec rake migrate_groups RAILS_ENV=production
  70 +sudo -u git -H bundle exec rake migrate_global_projects RAILS_ENV=production
  71 +sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production
  72 +sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production
  73 +sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production
  74 +
  75 +# Clear redis cache
  76 +sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
  77 +
  78 +# Clear and precompile assets
  79 +sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
  80 +sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
  81 +```
  82 +
  83 +### 6. Update config files
  84 +
  85 +Note: We switched from Puma in GitLab 5.x to unicorn in GitLab 6.0.
  86 +
  87 +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://github.com/gitlabhq/gitlabhq/blob/master/config/gitlab.yml.example but with your settings.
  88 +* Make `/home/git/gitlab/config/unicorn.rb` the same as https://github.com/gitlabhq/gitlabhq/blob/master/config/unicorn.rb.example but with your settings.
  89 +
  90 +### 7. Update Init script
  91 +
  92 +```bash
  93 +cd /home/git/gitlab
  94 +sudo rm /etc/init.d/gitlab
  95 +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
  96 +sudo chmod +x /etc/init.d/gitlab
  97 +```
  98 +
  99 +### 8. Create uploads directory
  100 +
  101 +```bash
  102 +cd /home/git/gitlab
  103 +sudo -u git -H mkdir -p public/uploads
  104 +sudo chmod -R u+rwX public/uploads
  105 +```
  106 +
  107 +### 9. Start application
  108 +
  109 + sudo service gitlab start
  110 + sudo service nginx restart
  111 +
  112 +### 10. Check application status
  113 +
  114 +Check if GitLab and its environment are configured correctly:
  115 +
  116 + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
  117 +
  118 +To make sure you didn't miss anything run a more thorough check with:
  119 +
  120 + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
  121 +
  122 +If all items are green, then congratulations upgrade complete!
  123 +
  124 +## Things went south? Revert to previous version (5.1)
  125 +
  126 +### 1. Revert the code to the previous version
  127 +Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration
  128 +(The backup is already migrated to the previous version)
  129 +
  130 +### 2. Restore from the backup:
  131 +
  132 +```bash
  133 +cd /home/git/gitlab
  134 +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
  135 +```
  136 +
  137 +### Troubleshooting
  138 +The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following commands can be run in the rails console to look for 'bad' data.
  139 +
  140 +All project owners should have an owner
  141 +```
  142 +Project.all.select { |project| project.owner.blank? }
  143 +```
  144 +
  145 +Every user should have a namespace
  146 +```
  147 +User.all.select { |u| u.namespace.blank? }
  148 +```
  149 +
  150 +Projects in the global namespace should not conflict with projects in the owner namespace
  151 +```
  152 +Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? }
  153 +```
... ...