This repository has been archived by the owner on Jul 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
fabfile.py
66 lines (51 loc) · 1.99 KB
/
fabfile.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from fabric.api import env, settings, cd, run, sudo, prefix, local, put
from contextlib import contextmanager
env.use_ssh_config = True
env.hosts = ['seedraid']
REPO = 'http://github.com/wow-sweetlie/seed_raid.git'
APP_DIR = '/home/seedraid/app'
ASSETS_DIR = '/home/seedraid/app/assets'
def seed():
sync_changes()
with cd(APP_DIR):
run("MIX_ENV=prod PORT=4000 mix run priv/repo/seeds.exs")
local("$HOME/bin/sentry-seedraid-release")
def backend():
sync_changes()
with cd(APP_DIR):
run("MIX_ENV=prod mix deps.get --only prod")
run("MIX_ENV=prod mix compile")
run("sudo systemctl stop seedraid.service")
run("MIX_ENV=prod mix ecto.migrate")
run("MIX_ENV=prod PORT=4001 mix run priv/repo/seeds.exs")
run("MIX_ENV=prod PORT=4001 mix discord.all_members")
run("MIX_ENV=prod PORT=4001 mix pins.parse_all")
run("sudo systemctl start seedraid.service")
def deploy():
sync_changes()
with cd(APP_DIR):
run("MIX_ENV=prod mix deps.get --only prod")
run("MIX_ENV=prod mix compile")
run("MIX_ENV=prod mix ecto.migrate")
with cd(ASSETS_DIR):
run("yarn install")
run("sudo systemctl stop seedraid.service")
run("rm -rf priv/static/*")
run("yarn deploy")
run("MIX_ENV=prod mix phx.digest")
run("MIX_ENV=prod PORT=4000 mix run priv/repo/seeds.exs")
local("$HOME/bin/sentry-seedraid-release")
run("MIX_ENV=prod PORT=4000 mix discord.all_members")
run("MIX_ENV=prod PORT=4000 mix pins.parse_all")
run("sudo systemctl start seedraid.service")
def sync_changes():
local("git push")
with settings(warn_only=True):
app_exists = not run('test -d %s' % APP_DIR).failed
if not app_exists:
run('git clone %s %s' % (REPO, APP_DIR))
else:
with cd(APP_DIR):
run('git pull')
# with cd(APP_DIR):
# put("./config/prod.secret.exs", "./config/prod.secret.exs")