debian-mirror-gitlab/lib/support/deploy/deploy.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
Bash
Raw Normal View History

2014-09-02 18:07:02 +05:30
# This is deploy script we use to update staging server
# You can always modify it for your needs :)
# If any command return non-zero status - stop deploy
set -e
2015-04-26 12:48:37 +05:30
echo 'Deploy: Stopping sidekiq..'
2014-09-02 18:07:02 +05:30
cd /home/git/gitlab/ && sudo -u git -H bundle exec rake sidekiq:stop RAILS_ENV=production
echo 'Deploy: Show deploy index page'
sudo -u git -H cp /home/git/gitlab/public/deploy.html /home/git/gitlab/public/index.html
echo 'Deploy: Starting backup...'
cd /home/git/gitlab/ && sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
echo 'Deploy: Stop GitLab server'
sudo service gitlab stop
echo 'Deploy: Get latest code'
cd /home/git/gitlab/
# clean working directory
sudo -u git -H git stash
# change branch to
sudo -u git -H git pull origin master
echo 'Deploy: Bundle and migrate'
# change it to your needs
2019-10-12 21:52:04 +05:30
sudo -u git -H bundle --without aws development test --deployment
2014-09-02 18:07:02 +05:30
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
2017-08-17 22:00:37 +05:30
sudo -u git -H bundle exec rake gitlab:assets:clean RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production
2014-09-02 18:07:02 +05:30
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
# return stashed changes (if necessary)
# sudo -u git -H git stash pop
echo 'Deploy: Starting GitLab server...'
sudo service gitlab start
sudo -u git -H rm /home/git/gitlab/public/index.html
echo 'Deploy: Done'