update deploy script

This commit is contained in:
Martin
2019-05-16 10:48:00 +02:00
parent 35a7c3798d
commit f77aa995a3
Vendored
+7 -4
View File
@@ -4,7 +4,7 @@ env.user = 'ubuntu'
env.key_filename = '~/.ssh/ukad.pem' env.key_filename = '~/.ssh/ukad.pem'
env.hosts = ( env.hosts = (
'ec2-52-51-154-66.eu-west-1.compute.amazonaws.com', #api2-dev 'ec2-34-254-173-59.eu-west-1.compute.amazonaws.com', #api2-dev
) )
@@ -12,10 +12,13 @@ def deploy():
branch = local('git rev-parse --abbrev-ref HEAD', capture=True) branch = local('git rev-parse --abbrev-ref HEAD', capture=True)
local('git archive --format tar.gz -o /tmp/api.tar.gz {0}'.format(branch), capture=False) local('git archive --format tar.gz -o /tmp/api.tar.gz {0}'.format(branch), capture=False)
put('/tmp/api.tar.gz', '/tmp/api.tar.gz') put('/tmp/api.tar.gz', '/tmp/api.tar.gz')
with warn_only():
sudo('service nginx stop')
sudo('service api-uwsgi stop')
with cd('/srv/api'): with cd('/srv/api'):
run('tar xzf /tmp/api.tar.gz') run('tar xzf /tmp/api.tar.gz')
run('rm /tmp/api.tar.gz') run('rm /tmp/api.tar.gz')
sudo('service nginx stop') with warn_only():
sudo('service api-uwsgi restart') sudo('service api-uwsgi start')
sudo('service nginx start') sudo('service nginx start')
local('rm /tmp/api.tar.gz') local('rm /tmp/api.tar.gz')