Commit a7ad0954 authored by Yves Senn's avatar Yves Senn

move the update guides from the wiki into the repo

parent e7adcaa5
# From 2.6 to 3.0
### 1. Stop server & resque
sudo service gitlab stop
### 2. Update code & db
```bash
# Get latest code
git fetch origin
git checkout v3.0.3
# Install libs
sudo -u gitlab bundle install --without development test postgres
# update db
sudo -u gitlab bundle exec rake db:migrate RAILS_ENV=production
# !!! Config should be replaced with a new one. Check it after replace
cp config/gitlab.yml.example config/gitlab.yml
# update gitolite hooks
# GITOLITE v2:
sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive
sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive
# GITOLITE v3:
sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
sudo chown git:git /home/git/.gitolite/hooks/common/post-receive
# set valid path to hooks in gitlab.yml in git_host section
# like this
git_host:
# gitolite 2
hooks_path: /home/git/share/gitolite/hooks
# gitolite 3
hooks_path: /home/git/.gitolite/hooks/
# Make some changes to gitolite config
# For more information visit https://github.com/gitlabhq/gitlabhq/pull/1719
# gitolite v2
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\\1"\.\*"/g' /home/git/.gitolite.rc
# gitlite v3
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\\1'\.\*'/g" /home/git/.gitolite.rc
# Check app status
sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production
```
### 3. Start all
sudo service gitlab start
# From 2.9 to 3.0
### 1. Stop server & resque
sudo service gitlab stop
### 2. Follow instructions
```bash
# Get latest code
sudo -u gitlab -H git fetch origin
sudo -u gitlab -H git checkout v3.0.3
# Install gems
sudo -u gitlab -H bundle install --without development test postgres
# Migrate db
sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
# Make some changes to gitolite v3 config
# For more information visit https://github.com/gitlabhq/gitlabhq/pull/1719
# Gitolite version 3
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\\1'\.\*'/g" /home/git/.gitolite.rc
# If you still use gitolite v2
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\\1"\.\*"/g' /home/git/.gitolite.rc
# Check APP Status
sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production
```
### 3. Start all
sudo service gitlab start
# From 3.0 to 3.1
__IMPORTANT!__
In this release __we moved Resque jobs under own gitlab namespace__.
Despite a lot of advantages it requires from our users to __replace gitolite post-receive hook with new one__.
Most of projects has post-receive file as symlink to gitolite `/home/git/.gitolite/hooks/post-receive`.
But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook.
I wrote a bash script which will do it automatically for you. Just make sure all path inside is valid for you
- - -
### 1. Stop server & resque
sudo service gitlab stop
### 2. Update GitLab
```bash
# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout v3.1.0
# Install new charlock_holmes
sudo gem install charlock_holmes --version '0.6.9'
# Install gems for MySQL
sudo -u gitlab -H bundle install --without development test postgres sqlite
# Migrate db
sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
```
### 3. Update post-receive hooks
#### Gitolite 3
Step 1: Rewrite post-receive hook
```bash
# Rewrite hook for gitolite 3
sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
sudo chown git:git /home/git/.gitolite/hooks/common/post-receive
```
Step 2: Rewrite hooks in all projects to symlink gitolite hook
```bash
# 1. Check for valid path
sudo -u gitlab -H vim lib/support/rewrite-hooks.sh
# 2. Run script
sudo -u git -H lib/support/rewrite-hooks.sh
```
#### Gitolite v2
Step 1: rewrite post-receive hook for gitolite 2
```
sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive
sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive
```
Step 2: Replace symlinks in project to valid place
#!/bin/bash
src="/home/git/repositories"
for dir in `ls "$src/"`
do
if [ -d "$src/$dir" ]; then
if [ "$dir" = "gitolite-admin.git" ]
then
continue
fi
project_hook="$src/$dir/hooks/post-receive"
gitolite_hook="/home/git/share/gitolite/hooks/common/post-receive"
ln -s -f $gitolite_hook $project_hook
fi
done
### 4. Check app status
```bash
# Check APP Status
sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production
```
### 5. Start all
sudo service gitlab start
# From 3.1 to 4.0
## Important changes
* Support for SQLite was dropped
* Support for gitolite 2 was dropped
* Projects are organized in namespaces
* The GitLab post-receive hook needs to be updated
* The configuration file needs to be updated
* Availability of `python2` executable
Most of projects has post-receive file as symlink to gitolite `/home/git/.gitolite/hooks/post-receive`.
But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook.
I wrote a bash script which will do it automatically for you. Just make sure all path inside is valid for you
- - -
### 1. Stop GitLab & Resque
sudo service gitlab stop
### 2. Update GitLab
```bash
# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout 4-0-stable
# Install gems for MySQL
sudo -u gitlab -H bundle install --without development test postgres
# Update repos permissions
sudo chmod -R ug+rwXs /home/git/repositories/
sudo chown -R git:git /home/git/repositories/
# Migrate db
sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
# Enable namespaces (**Warning!** All projects in groups will be moved to subdirectories)
sudo -u gitlab -H bundle exec rake gitlab:enable_namespaces RAILS_ENV=production
```
### 3. Update post-receive hooks (Requires gitolite v3 )
Step 1: Rewrite post-receive hook
```bash
sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
sudo chown git:git /home/git/.gitolite/hooks/common/post-receive
```
Step 2: Update project hooks to be symlinks to the Gitolite hook
```bash
# 1. Check paths in script
sudo -u gitlab -H vim lib/support/rewrite-hooks.sh
# 2. Run script
sudo -u git -H lib/support/rewrite-hooks.sh
```
### 4. Replace config with new one
# backup old one
sudo -u gitlab -H cp config/gitlab.yml config/gitlab.yml.old
# copy new one
sudo -u gitlab -H cp config/gitlab.yml.example config/gitlab.yml
# edit it
sudo -u gitlab -H vim config/gitlab.yml
### 5. Disable ssh known_host check for own domain
echo "Host localhost
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config
echo "Host YOUR_DOMAIN_NAME
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config
### 6. Check GitLab's status
sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production
### 7. Start GitLab & Resque
sudo service gitlab start
# From 4.0 to 4.1
## Important changes
* Resque replaced with Sidekiq
* New options for configuration file added
* Init.d script should be updated
* __requires ruby1.9.3-p327__
- - -
### 1. Stop GitLab & Resque
sudo service gitlab stop
### 2. Update GitLab
```bash
# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout 4-1-stable
# Install gems for MySQL
sudo -u gitlab -H bundle install --without development test postgres
# Migrate db
sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
```
### 3. Replace init.d script with a new one
```
# backup old one
sudo mv /etc/init.d/gitlab /etc/init.d/gitlab.old
# get new one usign sidekiq
sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
### 4. Check GitLab's status
sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production
### 5. Start GitLab & Sidekiq
sudo service gitlab start
### 6. Remove old init.d script
sudo rm /etc/init.d/gitlab.old
# From 4.1 to 4.2
### 1. Stop server & resque
sudo service gitlab stop
### 2. Update code & db
```bash
# Get latest code
sudo -u gitlab git fetch
sudo -u gitlab git checkout 4-2-stable
# Install libs
sudo -u gitlab bundle install --without development test postgres --deployment
# update db
sudo -u gitlab bundle exec rake db:migrate RAILS_ENV=production
```
### 3. Check GitLab's status
```bash
sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production
```
### 4. Start all
sudo service gitlab start
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment