summaryrefslogtreecommitdiff
path: root/lib/support
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-16 12:45:30 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-05-16 12:45:30 +0300
commit36b2f2e3c2fe5e34dfa334f27f459dcb3a469cbd (patch)
treea062b0a4b3ed940a41c14be086f1933e320d9513 /lib/support
parent886f7b63b52ca61c241d7b0ac2b6b9a0d360b05c (diff)
downloadgitlab-ce-36b2f2e3c2fe5e34dfa334f27f459dcb3a469cbd.tar.gz
add deploy recipe extracted from staging server
Diffstat (limited to 'lib/support')
-rwxr-xr-xlib/support/deploy/deploy.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/support/deploy/deploy.sh b/lib/support/deploy/deploy.sh
new file mode 100755
index 00000000000..0d2f8418bcf
--- /dev/null
+++ b/lib/support/deploy/deploy.sh
@@ -0,0 +1,44 @@
+# 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: Stoping 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 postgres
+
+sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
+
+# return stashed changes (if necessary)
+# sudo -u git -H git stash pop
+
+
+echo 'Deploy: Starting GitLab server...'
+sudo service gitlab start
+
+sleep 10
+sudo -u git -H rm /home/git/gitlab/public/index.html
+echo 'Deploy: Done'