annotate service/environment/tasks.py @ 1537:f119ed48194b

cors support Ignore-this: 8f628d753d9770b3b9b22be1194f3307 darcs-hash:d277bc36a7c9d5a672bf326f43ece710ec75c6ca
author drewp <drewp@bigasterisk.com>
date Mon, 10 Feb 2020 00:03:11 -0800
parents 0da337780f22
children 4857e22137c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1523
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
1 from invoke import task
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
2
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
3 JOB='environment'
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
4 PORT=9075
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
5
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
6 TAG=f'bang6:5000/{JOB}_x86:latest'
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
7
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
8
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
9
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
10 @task
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
11 def build_image(ctx):
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
12 ctx.run(f'docker build --network=host -t {TAG} .')
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
13
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
14 @task(pre=[build_image])
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
15 def push_image(ctx):
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
16 ctx.run(f'docker push {TAG}')
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
17
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
18 @task
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
19 def shell(ctx):
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
20 ctx.run(f'docker run --rm -it --cap-add SYS_PTRACE -v `pwd`:/opt/homeauto_store --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} /bin/bash', pty=True)
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
21
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
22 @task(pre=[build_image])
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
23 def local_run(ctx):
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
24 ctx.run(f'docker run --rm -it -p {PORT}:{PORT} -v `pwd`:/opt/homeauto_store --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} python3 {JOB}.py -v', pty=True)
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
25
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
26 @task(pre=[push_image])
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
27 def redeploy(ctx):
0da337780f22 dep updates; graph url renames; and other build updates
drewp <drewp@bigasterisk.com>
parents:
diff changeset
28 ctx.run(f'supervisorctl -s http://bang:9001/ restart envgraph_{PORT}')