annotate service/environment/tasks.py @ 1523:0da337780f22

dep updates; graph url renames; and other build updates Ignore-this: 4603ef3d8db650a13e543dad8580ade8 darcs-hash:0840491cd6a4e4966f47a2abca0ed30ec434022a
author drewp <drewp@bigasterisk.com>
date Wed, 05 Feb 2020 00:23:06 -0800
parents
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}')