~ihabunek/triglav

ref: 3a62b8feb3be418cf9f3fb176ac6c84a36e66a2f triglav/fabfile.py -rw-r--r-- 684 bytes
3a62b8feIvan Habunek Validate tags on platforms 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import getpass

from fabric import task
from invoke import Collection, run


@task()
def deploy(c):
    print("\nStopping triglav service...")
    c.sudo("service triglav stop")

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

    print("\nRunning migrations...")
    with c.cd("projects/triglav"):
        c.run('source .envrc && ./triglav eval "Triglav.Release.migrate()"')

    print("\nStarting triglav service...")
    c.sudo("service triglav start")


sudo_pass = getpass.getpass("What's your sudo password? ")

ns = Collection(deploy)
ns.configure({'sudo': {'password': sudo_pass}})