File: deploy.sh

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (45 lines) | stat: -rwxr-xr-x 1,394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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

echo 'Deploy: Stopping sidekiq..'
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
sudo -u git -H bundle --without aws development test --deployment

sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
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
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'