annotate service/piNode/tasks.py @ 627:c3f0a98fa65d

lib upgrades; fix a static http server path Ignore-this: f48022f37590e8bdb16957c49168d31b
author drewp@bigasterisk.com
date Thu, 08 Aug 2019 16:54:46 -0700
parents 98384c3ccd33
children accbbd521ecd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
1 from invoke import task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
2
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
3 JOB = 'piNode'
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
4 PORT = 9059
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
5 TAG = f'bang6:5000/{JOB.lower()}_pi:latest'
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
6 ANSIBLE_TAG = 'raspi_io_node'
365
cb3738b1a15a pi_base moves to base image project
drewp@bigasterisk.com
parents: 347
diff changeset
7
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
8 @task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
9 def build_image(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
10 ctx.run(f'docker build --network=host -t {TAG} .')
338
f64e20d3407e RgbPixelsAnimation and docker build updates
drewp@bigasterisk.com
parents:
diff changeset
11
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
12 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
13 def push_image(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
14 ctx.run(f'docker push {TAG}')
338
f64e20d3407e RgbPixelsAnimation and docker build updates
drewp@bigasterisk.com
parents:
diff changeset
15
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
16 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
17 def shell(ctx):
627
c3f0a98fa65d lib upgrades; fix a static http server path
drewp@bigasterisk.com
parents: 552
diff changeset
18 ctx.run(f'docker run --name={JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host --uts=host --cap-add SYS_RAWIO --device /dev/mem --privileged {TAG} /bin/bash', pty=True)
347
97f5cbcac00b pi read config over etcd
drewp@bigasterisk.com
parents: 338
diff changeset
19
97f5cbcac00b pi read config over etcd
drewp@bigasterisk.com
parents: 338
diff changeset
20
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
21 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
22 def local_run(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
23 ctx.run(f'docker run --name={JOB}_local --rm -it {TAG} python ./piNode.py -v', pty=True)
466
1122016d16eb stats handler, events output fix, build updaets
drewp@bigasterisk.com
parents: 365
diff changeset
24
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
25 @task(pre=[push_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
26 def redeploy(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
27 ctx.run(f'sudo /my/proj/ansible/playbook -l pi -t {ANSIBLE_TAG}')
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
28
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
29 @task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
30 def push_config(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
31 ctx.run(f'docker run --rm --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py pi/')