Mercurial > code > home > repos > homeauto
changeset 564:d0830394bf7b
update build on service/wifi
Ignore-this: 4d68aad5f218c2ec114155290c4a4bf8
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 May 2019 18:54:05 -0700 |
parents | 7f57d171d6d3 |
children | cbb4b3ccdb53 |
files | service/wifi/Dockerfile service/wifi/makefile service/wifi/requirements.txt service/wifi/tasks.py service/wifi/wifi.py |
diffstat | 5 files changed, 34 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/service/wifi/Dockerfile Wed May 01 00:30:54 2019 -0700 +++ b/service/wifi/Dockerfile Fri May 03 18:54:05 2019 -0700 @@ -5,9 +5,9 @@ RUN apt-get install -y libxml2-dev libxslt1-dev COPY requirements.txt ./ -RUN pip3 install -r requirements.txt +RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -r requirements.txt # not sure why this doesn't work from inside requirements.txt -RUN pip3 install -U 'https://github.com/drewp/cyclone/archive/python3.zip?v2' +RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -U 'https://github.com/drewp/cyclone/archive/python3.zip?v2' COPY *.py *.n3 *.html ./
--- a/service/wifi/makefile Wed May 01 00:30:54 2019 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -JOB=wifi -PORT=9070 - -TAG=bang6:5000/${JOB}_x86:latest - -build_image: - rm -rf tmp_ctx - mkdir -p tmp_ctx - cp -a Dockerfile ../../lib/*.py *.py *.n3 *.html req* tmp_ctx - docker build --network=host -t ${TAG} tmp_ctx - docker push ${TAG} - rm -r tmp_ctx - -shell: build_image - docker run --rm -it --cap-add SYS_PTRACE --net=host ${TAG} /bin/bash - -local_run: build_image - docker run --rm -it -p ${PORT}:${PORT} --net=host ${TAG} python3 wifi.py -v - -local_run_strace: build_image - docker run --rm -it -p ${PORT}:${PORT} --cap-add=SYS_PTRACE --net=host ${TAG} strace -f -s 200 python3 wifi.py -v - -redeploy: build_image - supervisorctl restart $(JOB)_$(PORT)
--- a/service/wifi/requirements.txt Wed May 01 00:30:54 2019 -0700 +++ b/service/wifi/requirements.txt Fri May 03 18:54:05 2019 -0700 @@ -3,9 +3,14 @@ git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales https://github.com/drewp/cyclone/archive/python3.zip -https://projects.bigasterisk.com/rdfdb/rdfdb-0.8.0.tar.gz influxdb==3.0.0 lxml==4.3.3 pystache==0.5.2 rdflib==4.2.2 ago==0.0.93 + +cycloneerr +patchablegraph==0.5.0 +rdfdb==0.8.0 +standardservice==0.4.0 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/wifi/tasks.py Fri May 03 18:54:05 2019 -0700 @@ -0,0 +1,25 @@ +from invoke import task + +JOB = 'wifi' +PORT = 9070 +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 wifi.py -v', pty=True) + +@task(pre=[push_image]) +def redeploy(ctx): + ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')
--- a/service/wifi/wifi.py Wed May 01 00:30:54 2019 -0700 +++ b/service/wifi/wifi.py Fri May 03 18:54:05 2019 -0700 @@ -26,7 +26,7 @@ import pystache from cycloneerr import PrettyErrorHandler -from logsetup import log +from standardservice.logsetup import log from patchablegraph import PatchableGraph, CycloneGraphEventsHandler, CycloneGraphHandler from scrape import Wifi, SeenNode