Mercurial > code > home > repos > homeauto
view service/mqtt_graph_bridge/tasks.py @ 1419:24e29a15617c
partial style redo. standardize ns setup
Ignore-this: 4b8bb9ecc023b9e42f301241fe1819cc
darcs-hash:10803752665928343398b6845fdcfd3e3b33fb97
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 04 Aug 2019 12:57:03 -0700 |
parents | a29a55f3429c |
children | 13b7e4de3824 |
line wrap: on
line source
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 \#')