commit f1ab62323993772dc25e6194fc179857f126b71c Author: David Claeys Date: Fri Aug 9 14:47:56 2024 +0200 initialize repository diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..03f557e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:2.7 +MAINTAINER Eric Taieb Walch + +RUN mkdir /app && \ +cd /app && \ +git clone https://github.com/rshipp/python-nut2.git && \ +cd python-nut2 && \ +python setup.py install && \ +cd .. && \ +git clone https://github.com/rshipp/webNUT.git && cd webNUT && \ +pip install -e . + + + +COPY /docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh + +WORKDIR /app/webNUT + +ENTRYPOINT ["/docker-entrypoint.sh"] + +EXPOSE 6543 diff --git a/README.md b/README.md new file mode 100644 index 0000000..649f52b --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# docker-webNUT + + +webNUT (UPS network monitoring web ui) dockerized. + +More infos on webNUT: https://github.com/rshipp/webNUT + +Set the following environment variables: + +**UPS_HOST** with NUT server host IP *(default: 127.0.0.1)* + +**UPS_PORT** with NUT server port *(default: 3493)* + +**UPS_USER** with NUT server username *(default: monuser)* + +**UPS_PASSWORD** with NUT server password *(default: secret)* + + + + +Run with: + +> docker run -e UPS_HOST="10.11.12.13" -e UPS_PORT="3493" -e UPS_USER="monuser" -e UPS_PASSWORD="secret" -p 6543:6543 teknologist/webnut:latest + diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..57fb9da --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -xe + + +upshost="${UPS_HOST:-127.0.0.1}" +upsport="${UPS_PORT:-3493}" +upsuser="${UPS_USER:-monuser}" +upspassword="${UPS_PASSWORD:-secret}" + +echo "server = '$upshost'" > /app/webNUT/webnut/config.py +echo "port = '$upsport'" >> /app/webNUT/webnut/config.py +echo "username = '$upsuser'" >> /app/webNUT/webnut/config.py +echo "password = '$upspassword'" >> /app/webNUT/webnut/config.py + +cat /app/webNUT/webnut/config.py + +cd /app/webNUT && python setup.py install + +cd webnut +exec pserve ../production.ini