diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d6374f8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ + +group: edge +services: +- docker +language: bash +script: +# prepare qemu +- docker run --rm --privileged multiarch/qemu-user-static:register --reset +# build image +- docker build -t bgulla/apcupsd-influxdb . +- > + if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" + docker push bgulla/apcupsd-influxdb + fi diff --git a/Dockerfile b/Dockerfile index 58bfe22..a5a298d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM jfloff/alpine-python +FROM python:2.7.15-alpine3.7 +#FROM jfloff/alpine-python MAINTAINER Brandon -RUN apk add --no-cache apcupsd jq curl supervisor +RUN apk add --no-cache apcupsd jq curl supervisor busybox bash COPY ./conf/requirements.txt /requirements.txt COPY ./conf/apcupsd.conf / +COPY ./src/app.py / RUN pip install -r /requirements.txt COPY ./conf/supervisord.conf /supervisord.conf -COPY ./src/app.py / - CMD ["supervisord", "-n", "-c","/supervisord.conf"] diff --git a/README.md b/README.md index c9149be..32c2bf9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # apcupsd-influxdb-exporter + +[![Build Status](https://travis-ci.org/bgulla/apcupsd-influxdb-exporter.svg?branch=master)](https://travis-ci.org/bgulla/apcupsd-influxdb-exporter) + Build an x86_64 or ARM compatible Docker image that will output commonly used UPS device statistics to an influxdb database using an included version of the [APCUPSd](http://www.apcupsd.org/) tool. Dockerfiles included for both intel and ARM (RaspberryPi or comparable) chipsets. @@ -6,7 +9,7 @@ tool. Dockerfiles included for both intel and ARM (RaspberryPi or comparable) ch ## How to build Building the image is straight forward: * Git clone this repo -* `docker build -t apcupsd-influxdb-exporter -f Dockerfile.arm .` +* `docker build -t apcupsd-influxdb -f Dockerfile.arm .` ## Running ```bash @@ -17,7 +20,7 @@ docker run --rm -d --name="apcupsd" \ -e "INFLUXDB_DATABASE=ups" \ -e "INFLUXDB_PORT=8086" \ -e "INFLUXDB_HOST=10.0.1.11" \ - -t bgulla/apcupsd-influxdb-exporter + -t bgulla/apcupsd-influxdb ``` Note: if your UPS does not include the NOMPOWER metric, you will need to include the WATTS environment variable in order to compute the live-power consumption metric.