Mercurial > code > home > repos > homeauto
view service/frontDoorLock/tasks.py @ 1416:201090b9c725
just reindent, i think
Ignore-this: 519383817f24612419191d79e14bfb5c
darcs-hash:9573fbb16b44da29f3d4f3b1c429595a13e51532
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 03 Aug 2019 17:02:16 -0700 |
parents | fecbac537f63 |
children | a81def58ecfb |
line wrap: on
line source
from invoke import task JOB = 'front_door_lock' PORT = 10011 TAG = f'bang6:5000/{JOB}_x86:latest' ANSIBLE_TAG = 'door' @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 -v `pwd`/index.html:/opt/index.html {TAG} python3 ./front_door_lock.py -v', pty=True) @task(pre=[push_image]) def redeploy(ctx): ctx.run(f'sudo /my/proj/ansible/playbook -l bang -t {ANSIBLE_TAG}') 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 pull {tag}") ctx.run(f"docker run --rm -v `pwd`:/config --device=/dev/ttyUSB0 -it {tag} door.yaml run", pty=True) @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 \#') @task def mqtt_force_open(ctx): ctx.run(f'mosquitto_pub -h bang -p 10010 -t frontdoorlock/switch/strike/command -m ON') @task def mqtt_force_lock(ctx): ctx.run(f'mosquitto_pub -h bang -p 10010 -t frontdoorlock/switch/strike/command -m OFF')