GitLab 5.0
3 most important changes in GitLab 5.0
- GitLab-shell replaces Gitolite
- Instead of needing gitlab & git users accounts on the system we now only need git user to run GitLab
- The wiki is stored in a git repository using the gollum library
Upgrade steps for 4.2
1. Stop GitLab
sudo service gitlab stop
2. Enable Bash for git user
# chsh sudo chsh -s /bin/bash git # or use usermod sudo usermod -s /bin/bash git
3. Set up gitlab-shell
# check out gitlab-shell from github sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git /home/git/gitlab-shell # chmod all repos and files under git sudo chown git:git -R /home/git/repositories/ # login as git sudo su git cd /home/git/gitlab-shell # copy config cp config.yml.example config.yml # change url to gitlab instance # ! make sure url end with '/' like 'https://devops.au.oracle.com/' vim config.yml # rewrite hooks ./support/rewrite-hooks.sh # exit from git user exit
Use rsync to copy ~gitlab/.rbenv to ~git/, modify ~git/.profile to load rbenv.
4. Copy ~gitlab/gitlab to ~git/
sudo rsync -av --progress --stats /home/gitlab/gitlab /home/git sudo chown git:git -R /home/git/gitlab sudo rm -rf /home/gitlab/gitlab-satellites # if exists sudo rm /tmp/sockets/gitlab.socket
5. Upgrade GitLab
cd /home/git/gitlab su git # backup current config cp config/gitlab.yml{,.old} # update git pull git checkout 5-0-stable # replace config with recent one cp config/gitlab.yml.example config/gitlab.yml # edit it to reflect the FQDN hostname vim config/gitlab.yml bundle install --without development test postgres --deployment bundle exec rake db:migrate RAILS_ENV=production bundle exec rake gitlab:shell:setup RAILS_ENV=production bundle exec rake gitlab:shell:build_missing_projects RAILS_ENV=production mkdir /home/git/gitlab-satellites bundle exec rake gitlab:satellites:create RAILS_ENV=production # migrate wiki to git bundle exec rake gitlab:wiki:migrate RAILS_ENV=production # check permissions for /home/git/.ssh/ chmod 700 /home/git/.ssh chmod 600 /home/git/.ssh/authorized_keys # check permissions for /home/git/gitlab/ sudo chown -R git /home/git/gitlab/log/ sudo chown -R git /home/git/gitlab/tmp/ sudo chmod -R u+rwX /home/git/gitlab/log/ sudo chmod -R u+rwX /home/git/gitlab/tmp/ mkdir /home/git/gitlab/tmp/pids/ sudo chmod -R u+rwX /home/git/gitlab/tmp/pids
6. Update startup script and nignx config
# init.d sudo rm /etc/init.d/gitlab sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # unicorn sudo cp /home/git/gitlab/config/unicorn.rb /home/git/gitlab/config/unicorn.rb.old sudo cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/config/unicorn.rb # nginx # Replace path from '/home/gitlab/' to '/home/git/' sudo vim /etc/nginx/sites-enabled/gitlab sudo service nginx restart
7. Start gitlab instance
sudo service gitlab start # check if unicorn and sidekiq started # If not try to logout, also check replaced path from '/home/gitlab/' to '/home/git/' # in nginx, unicorn, init.d etc ps aux | grep unicorn ps aux | grep sidekiq
8. Check installation
# In 5-10 seconds lets check gitlab-shell sudo -u git -H /home/git/gitlab-shell/bin/check # Example of success output # Check GitLab API access: OK # Check directories and files: # /home/git/repositories: OK # /home/git/.ssh/authorized_keys: OK # Now check gitlab instance sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Troubleshooting
Failed to clone gollum via git protocol. Change to HTTPS.
By default bundler clone gollum via git protocol (stupid, especially for people who live behind firewalls).
To fix the problem, the easiest workaround is to edit the Gemfile and Gemfile.lock and update the repository URL.
# Gemfile gem "gollum", "~> 2.4.0", git: "https://github.com/gollum/gollum.git", ref: "5dcd3c8c8f" # Gemfile.lock GIT remote: https://github.com/gollum/gollum.git revision: 5dcd3c8c8f68158e43ff79861279088ee56d0ebe ref: 5dcd3c8c8f specs: gollum (2.4.11) github-markdown (~> 0.5.3) github-markup (>= 0.7.5, < 1.0.0) grit (~> 2.5.0) mustache (>= 0.99.4, < 1.0.0) nokogiri (~> 1.5.6) pygments.rb (~> 0.4.2) sanitize (~> 2.0.3) sinatra (~> 1.3.5) stringex (~> 1.5.1) useragent (~> 0.4.16)