From 70492f34e9191d942a8ec775614f897f6ac3256f Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Mon, 20 Jan 2014 18:58:47 +0000 Subject: [PATCH] scripts: update deployment script --- script/deploy.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/script/deploy.sh b/script/deploy.sh index 5c4c121..3721790 100755 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -1,6 +1,8 @@ #!/bin/bash - -server='master0.entrydns.net' +if [[ $(whoami) != 'root' ]]; then + echo 'Must be run with sudo.' + exit 1 +fi if [[ $# != 1 ]]; then echo 'Specify rpm file to deploy' @@ -9,7 +11,9 @@ else: package=${1} fi -scp ${package} ${server}:/tmp +yum update -y ${package} +su - entrydns -c 'bundle exec rake db:migrate RAILS_ENV=production' + +systemctl reload unicorn-entrydns.service -ssh -t ${server} "sudo yum update -y /tmp/${package}" -ssh -t ${server} "su - entrydns -c 'cd ${HOME} && bundle exec rake db:migrate RAILS_ENV=production' +systemctl status unicorn-entrydns.service