~ihabunek/harvey

c4031a8a8f77397cdd5bcb4775c2492a5ccef74c — Ivan Habunek a month ago 247f330
Update deploy script
2 files changed, 16 insertions(+), 4 deletions(-)

M .gitignore
M fabfile.py
M .gitignore => .gitignore +1 -0
@@ 34,3 34,4 @@ npm-debug.log

/.envrc
/tmp/
harvey.tar.gz

M fabfile.py => fabfile.py +15 -4
@@ 1,6 1,7 @@
from datetime import date
from fabric import task
from invoke import run
from os.path import exists


@task()


@@ 8,14 9,24 @@ def deploy(c):
    # Fail early if sudo password is not valid
    c.sudo("echo")

    if exists("harvey.tar.gz"):
        print("Deploying release: harvey.tar.gz")
    else:
        print("harvey.tar.gz not found, aborting")
        return

    print("Copying release...")
    run("scp harvey.tar.gz bezdomni:projects/harvey/")

    print("\nStopping harvey service...")
    c.sudo("service harvey stop")

    print("\nSyncing release files...")
    run("rsync --archive --compress --delete --links --stats _build/prod bezdomni:projects/harvey")

    print("\nRunning migrations...")
    with c.cd("projects/harvey"):
        print("\nExtracting release...")
        c.run("rm -rf prod")
        c.run("tar xzf harvey.tar.gz")

        print("\nRunning migrations...")
        c.run("source .envrc && ./prod/rel/harvey/bin/migrate")

    print("\nStarting harvey service...")