comparison service/rdf_to_mqtt/tasks.py @ 739:03bad43bbcb3

more renaming, build updates Ignore-this: 94a0df55a1d8a74d90ec84bb7351d3ef
author drewp@bigasterisk.com
date Mon, 10 Feb 2020 23:56:42 -0800
parents fdddbdaf07b5
children
comparison
equal deleted inserted replaced
738:4167101b816f 739:03bad43bbcb3
1 from invoke import task 1 from invoke import Collection, task
2 import sys
3 sys.path.append('/my/proj/release')
4 from serv_tasks import serv_tasks
2 5
3 JOB = 'rdf_to_mqtt' 6 ns = Collection()
4 PORT = 10008 7 serv_tasks(ns, 'serv.n3', 'rdf_to_mqtt')
5 TAG = f'bang6:5000/{JOB}_x86:latest'
6 8
7 @task 9 # leftover frontdoor setup I think
8 def build_image(ctx): 10 @ns.add_task
9 ctx.run(f'docker build --network=host -t {TAG} .')
10
11 @task(pre=[build_image])
12 def push_image(ctx):
13 ctx.run(f'docker push {TAG}')
14
15 @task(pre=[build_image])
16 def shell(ctx):
17 ctx.run(f'docker run --name={JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host {TAG} /bin/bash', pty=True)
18
19 @task(pre=[build_image])
20 def local_run(ctx):
21 ctx.run(f'docker run --name={JOB}_local --rm -it --net=host -v /my/proj/homeauto/lib:/lib_src {TAG} python3 rdf_to_mqtt.py -v', pty=True)
22
23 @task(pre=[push_image])
24 def redeploy(ctx):
25 ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')
26
27 @task 11 @task
28 def program_board_over_usb(ctx): 12 def program_board_over_usb(ctx):
29 tag = 'esphome/esphome' 13 tag = 'esphome/esphome'
30 ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml run", pty=True) 14 ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml run", pty=True)
31 # config_skylight.yaml run --no-logs 15 # config_skylight.yaml run --no-logs
32 16
17 @ns.add_task
33 @task 18 @task
34 def monitor_usb(ctx): 19 def monitor_usb(ctx):
35 tag = 'esphome/esphome' 20 tag = 'esphome/esphome'
36 ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml logs", pty=True) 21 ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml logs", pty=True)
37 22
23 @ns.add_task
38 @task 24 @task
39 def tail_mqtt(ctx): 25 def tail_mqtt(ctx):
40 ctx.run(f'mosquitto_sub -h bang -p 10010 -d -v -t \#') 26 ctx.run(f'mosquitto_sub -h bang -p 10010 -d -v -t \#')