Mercurial > code > home > repos > homeauto
diff service/mqtt_graph_bridge/tasks.py @ 581:30022797642e
mqtt_graph_bridge to new build rules and to py3
Ignore-this: 1a064e89a2016ed583c1d4c9bbfd6f7c
author | drewp@bigasterisk.com |
---|---|
date | Thu, 09 May 2019 22:31:04 -0700 |
parents | service/mqtt_graph_bridge/makefile@7051b8b4766a |
children | b87b6e9cedb2 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_graph_bridge/tasks.py Thu May 09 22:31:04 2019 -0700 @@ -0,0 +1,50 @@ +from invoke import task + +JOB = 'mqtt_graph_bridge' +PORT = 10008 +TAG = f'bang6:5000/{JOB}_x86:latest' + +@task +def build_image(ctx): + ctx.run(f'docker build --network=host -t {TAG} .') + +@task(pre=[build_image]) +def push_image(ctx): + ctx.run(f'docker push {TAG}') + +@task(pre=[build_image]) +def shell(ctx): + ctx.run(f'docker run --name={JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host {TAG} /bin/bash', pty=True) + +@task(pre=[build_image]) +def local_run(ctx): + ctx.run(f'docker run --name={JOB}_local --rm -it --net=host {TAG} python3 mqtt_graph_bridge.py -v', pty=True) + +@task(pre=[push_image]) +def redeploy(ctx): + ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}') + +@task +def program_board_over_usb(ctx): + tag = 'esphome/esphome' + ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml run", pty=True) +# config_skylight.yaml run --no-logs + +@task +def monitor_usb(ctx): + tag = 'esphome/esphome' + ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml logs", pty=True) + +@task +def tail_mqtt(ctx): + ctx.run(f'mosquitto_sub -h bang -p 10010 -d -v -t \#') + + + + + + + + + +