Commit 36b2f2e3c2fe5e34dfa334f27f459dcb3a469cbd
1 parent
886f7b63
Exists in
master
and in
4 other branches
add deploy recipe extracted from staging server
Showing
1 changed file
with
44 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,44 @@ |
1 | +# This is deploy script we use to update staging server | |
2 | +# You can always modify it for your needs :) | |
3 | + | |
4 | +# If any command return non-zero status - stop deploy | |
5 | +set -e | |
6 | + | |
7 | +echo 'Deploy: Stoping sidekiq..' | |
8 | +cd /home/git/gitlab/ && sudo -u git -H bundle exec rake sidekiq:stop RAILS_ENV=production | |
9 | + | |
10 | +echo 'Deploy: Show deploy index page' | |
11 | +sudo -u git -H cp /home/git/gitlab/public/deploy.html /home/git/gitlab/public/index.html | |
12 | + | |
13 | +echo 'Deploy: Starting backup...' | |
14 | +cd /home/git/gitlab/ && sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production | |
15 | + | |
16 | +echo 'Deploy: Stop GitLab server' | |
17 | +sudo service gitlab stop | |
18 | + | |
19 | +echo 'Deploy: Get latest code' | |
20 | +cd /home/git/gitlab/ | |
21 | + | |
22 | +# clean working directory | |
23 | +sudo -u git -H git stash | |
24 | + | |
25 | +# change branch to | |
26 | +sudo -u git -H git pull origin master | |
27 | + | |
28 | +echo 'Deploy: Bundle and migrate' | |
29 | + | |
30 | +# change it to your needs | |
31 | +sudo -u git -H bundle --without postgres | |
32 | + | |
33 | +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production | |
34 | + | |
35 | +# return stashed changes (if necessary) | |
36 | +# sudo -u git -H git stash pop | |
37 | + | |
38 | + | |
39 | +echo 'Deploy: Starting GitLab server...' | |
40 | +sudo service gitlab start | |
41 | + | |
42 | +sleep 10 | |
43 | +sudo -u git -H rm /home/git/gitlab/public/index.html | |
44 | +echo 'Deploy: Done' | ... | ... |