Mercurial > code > home > repos > homeauto
comparison service/mqtt_graph_bridge/tasks.py @ 1384:a29a55f3429c
mqtt_graph_bridge to new build rules and to py3
Ignore-this: 1a064e89a2016ed583c1d4c9bbfd6f7c
darcs-hash:b40c5fcff313002f6468e7a94a2059f1dd5dd97c
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 09 May 2019 22:31:04 -0700 |
parents | |
children | 13b7e4de3824 |
comparison
equal
deleted
inserted
replaced
1383:d66790a031ea | 1384:a29a55f3429c |
---|---|
1 from invoke import task | |
2 | |
3 JOB = 'mqtt_graph_bridge' | |
4 PORT = 10008 | |
5 TAG = f'bang6:5000/{JOB}_x86:latest' | |
6 | |
7 @task | |
8 def build_image(ctx): | |
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 {TAG} python3 mqtt_graph_bridge.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 | |
28 def program_board_over_usb(ctx): | |
29 tag = 'esphome/esphome' | |
30 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 | |
32 | |
33 @task | |
34 def monitor_usb(ctx): | |
35 tag = 'esphome/esphome' | |
36 ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml logs", pty=True) | |
37 | |
38 @task | |
39 def tail_mqtt(ctx): | |
40 ctx.run(f'mosquitto_sub -h bang -p 10010 -d -v -t \#') | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 |