Mercurial > code > home > repos > homeauto
view service/piNode/tasks.py @ 1361:e121dc5c09df
mqtt lib wants to encode topic names
Ignore-this: 2b72670ac614943e7188419e1aba93b
darcs-hash:59524f522f3e7922db38552ea95978df7254cbb6
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 01 May 2019 00:06:50 -0700 |
parents | f2159312b0e7 |
children | 445e24e8c8bb |
line wrap: on
line source
from invoke import task JOB = 'piNode' PORT = 9059 TAG = f'bang6:5000/{JOB.lower()}_pi:latest' ANSIBLE_TAG = 'raspi_io_node' @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}') # (cd /my/proj/homeauto/service/arduinoNode; tar czf /my/site/projects/rdfdb/more2.tgz static) @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 {TAG} python ./piNode.py -v', pty=True) @task(pre=[push_image]) def redeploy(ctx): ctx.run(f'sudo /my/proj/ansible/playbook -l pi -t {ANSIBLE_TAG}') @task def push_config(ctx): ctx.run(f'docker run --rm --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py pi/')