Mercurial > code > home > repos > homeauto
annotate service/reasoning/tasks.py @ 722:a93fbf0d0daa
dep updates; graph url renames; and other build updates
Ignore-this: 4603ef3d8db650a13e543dad8580ade8
author | drewp@bigasterisk.com |
---|---|
date | Wed, 05 Feb 2020 00:23:06 -0800 |
parents | 62171aa2bc4e |
children | f3f667769aef |
rev | line source |
---|---|
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
1 from invoke import task |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
2 |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
3 JOB='reasoning' |
351
7716b1810d6c
reasoning & collector move into docker images
drewp@bigasterisk.com
parents:
diff
changeset
|
4 PORT=9071 |
7716b1810d6c
reasoning & collector move into docker images
drewp@bigasterisk.com
parents:
diff
changeset
|
5 |
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
6 TAG=f'bang6:5000/{JOB}_x86:latest' |
351
7716b1810d6c
reasoning & collector move into docker images
drewp@bigasterisk.com
parents:
diff
changeset
|
7 |
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
8 @task |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
9 def build_image(ctx): |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
10 ctx.run(f'docker build --network=host -t {TAG} .') |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
11 |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
12 @task(pre=[build_image]) |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
13 def push_image(ctx): |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
14 ctx.run(f'docker push {TAG}') |
351
7716b1810d6c
reasoning & collector move into docker images
drewp@bigasterisk.com
parents:
diff
changeset
|
15 |
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
16 @task |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
17 def shell(ctx): |
722
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
18 ctx.run(f'docker run --name {JOB}_shell --rm -it --cap-add SYS_PTRACE -v `pwd`:/mnt --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} /bin/bash', pty=True) |
351
7716b1810d6c
reasoning & collector move into docker images
drewp@bigasterisk.com
parents:
diff
changeset
|
19 |
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
20 @task(pre=[build_image]) |
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
21 def local_run(ctx): |
722
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
22 ctx.run(f'docker run --name {JOB}_local --rm -it ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
23 f'-p {PORT}:{PORT} ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
24 f'-v `pwd`:/mnt ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
25 f'-v `pwd`/index.html:/opt/index.html ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
26 f'--dns 10.2.0.1 --dns-search bigasterisk.com ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
27 f'--net=host ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
28 f'{TAG} ' |
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
29 f'python /mnt/{JOB}.py -iro', pty=True) |
463
1ceb26846eca
add separate :matchPredicate support. some build and log edits.
drewp@bigasterisk.com
parents:
392
diff
changeset
|
30 |
608 | 31 @task(pre=[build_image]) |
32 def local_run_mock(ctx): | |
722
a93fbf0d0daa
dep updates; graph url renames; and other build updates
drewp@bigasterisk.com
parents:
608
diff
changeset
|
33 ctx.run(f'docker run --name {JOB}_local_run_mock --rm -it -p {PORT}:{PORT} -v `pwd`:/mnt --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} python /mnt/{JOB}.py -iro --mockoutput', pty=True) |
608 | 34 |
604
c24f081195d3
update standardservice. add --dns to all docker runs
drewp@bigasterisk.com
parents:
571
diff
changeset
|
35 @task(pre=[push_image]) |
c24f081195d3
update standardservice. add --dns to all docker runs
drewp@bigasterisk.com
parents:
571
diff
changeset
|
36 def redeploy(ctx): |
571
53a2664f450a
build/import update for reasoning service
drewp@bigasterisk.com
parents:
463
diff
changeset
|
37 ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}') |