Ostatnio aktywny 6 months ago

Rewizja 3032de8dd025e4529f5b3daecd1dbdbb84605e56

gitlab_source_minor_version_update.sh Surowy
1#!/bin/sh
2if [ -z "${1}" ]
3then
4 echo "Specify which database are you using: [ --mysql | --postgresql ]"
5 exit 0
6fi
7case ${1} in
8 --mysql)
9 BUNDLE_EXCLUDE="postgres"
10 ;;
11 --postgresql)
12 BUNDLE_EXCLUDE="mysql"
13 ;;
14 *)
15 echo "Specify which database are you using: [ --mysql | --postgresql ]"
16 exit 0
17 ;;
18esac
19
20# backup
21cd /home/git/gitlab
22sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
23# stop server
24sudo service gitlab stop
25# get latest code from stable branch
26cd /home/git/gitlab
27sudo -u git -H git fetch --all
28sudo -u git -H git checkout -- Gemfile.lock db/schema.rb
29LATEST_TAG=$(git tag -l 'v*.[0-9]' --sort='v:refname'| tail -1)
30#LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
31sudo -u git -H git checkout $LATEST_TAG -b $LATEST_TAG
32# updating git-shell to corresponding version
33cd /home/git/gitlab-shell
34sudo -u git -H git fetch
35sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION` -b v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
36# install libs, migrations, etc.
37cd /home/git/gitlab
38sudo -u git -H bundle install --without development test ${BUNDLE_EXCLUDE} --deployment
39sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
40sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
41sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
42sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
43# start application
44sudo service gitlab start
45sudo service nginx restart
46# check application status
47sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
48sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production