mqtt-logger: Initial commit

Signed-off-by: tkl <tkl@e320>
This commit is contained in:
tkl 2018-07-20 14:53:22 +02:00
commit 54ed6c010f
3 changed files with 47 additions and 0 deletions

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM debian:latest
RUN apt-get update && apt-get install -y python python-pip mosquitto git
# Install paho-mqtt
RUN yes | pip install paho-mqtt
# Install paho-mqtt wrapper
RUN git clone https://git.blackfinn.de/python/mqtt.git && \
cd mqtt && \
./setup.py install && \
cd .. && \
rm -rf mqtt
# Install mqtt-logger
RUN git clone https://git.blackfinn.de/python/mqtt_logger.git
COPY run.sh /bin/
ENTRYPOINT ["/bin/run.sh"]

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# mqtt-logger
## Run
```sh
docker run -d -p 1883:1883 -p 8883:8883 -v /srv/mqtt_logger/mqtt:/var/log/mqtt --name mqtt-logger --restart always mqtt-logger
```

17
run.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
/etc/init.d/mosquitto start
sleep 1
python /mqtt_logger/mqtt_logger/__init__.py
# if argument(s) given - execute argument(s) in container. Otherwise loop.
if [ "$#" -gt 0 ]; then
exec $@
else
while :;
do
sleep 1
done
fi