Tertiush / ParadoxIP150v2

Python-based IP150 'middle-ware' that uses the IP module's software port for monitoring and control of the alarm via an MQTT Broker.
Eclipse Public License 1.0
73 stars 35 forks source link

Anybody got this working in Docker? #33

Open IoTPlay opened 6 years ago

IoTPlay commented 6 years ago

Anybody got this up and running in Docker? I still get this error:

logging to file /var/log/paradoxip.log
ERROR:root:******************* Error reading config.ini file (will use defaults): No section: 'Application'
reading  config
Traceback (most recent call last):
  File "/usr/src/app/ParadoxIP150v2/IP150-MQTTv2.py", line 955, in <module>
    logging.error( "MQTT connection error (" + str(attempts) + ": " + e.strerror)
AttributeError: 'exceptions.AttributeError' object has no attribute 'strerror'
psyciknz commented 6 years ago

I have my version running in docker, but I think I replaced the logger commands.

I’d post mine but I think it’s too specific for sp7000 series panels now.

On Sat, 6 Oct 2018 at 13:25, Jéan Roux notifications@github.com wrote:

Anybody got this up and running in Docker? I still get this error:

logging to file /var/log/paradoxip.log ERROR:root:*** Error reading config.ini file (will use defaults): No section: 'Application' Traceback (most recent call last): File "/usr/src/iotp/ParadoxIP150v2/IP150-MQTTv2.py", line 955, in reading config logging.error( "MQTT connection error (" + str(attempts) + ": " + e.strerror) AttributeError: 'exceptions.AttributeError' object has no attribute 'strerror'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Tertiush/ParadoxIP150v2/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/AFGkc8tLIRFPwPKMRuHgUi4RsMWHtVpuks5uh_iIgaJpZM4XLF3g .

IoTPlay commented 6 years ago

Here is my Dockerfile:

FROM python:2-alpine

RUN apk update              && \
    apk add --no-cache         \
    git

WORKDIR /usr/src/app
RUN git clone https://github.com/Tertiush/ParadoxIP150v2.git
RUN chmod +x /usr/src/app/ParadoxIP150v2/IP150-MQTTv2.py
# I run the command in a folder where the config.ini is - that has all my settings
COPY config.ini /usr/src/app/ParadoxIP150v2
CMD ["python","/usr/src/app/ParadoxIP150v2/IP150-MQTTv2.py"]
psyciknz commented 6 years ago

Here is my docker file, the FROM __BASEIMAGE_ARCH__/python:2.7.15-jessie

__CROSS_COPY qemu/qemu-__QEMU_ARCH__-static /usr/bin/

# based on https://github.com/pfichtner/docker-mqttwarn

# install python libraries (TODO: any others?)
RUN pip install paho-mqtt requests

# build /opt/mqttwarn
RUN mkdir -p /opt/paradox
WORKDIR /opt/paradox

# add user paradox to image
RUN groupadd -r paradox && useradd -r -g paradox paradox
RUN chown -R paradox /opt/paradox

# process run as paradox user
USER paradox

# conf file from host
VOLUME ["/opt/paradox/conf"]

# set conf path
ENV PARADOXINI="/opt/paradox/conf/config.ini"

# finally, copy the current code (ideally we'd copy only what we need, but it
#  is not clear what that is, yet)
COPY . /opt/paradox

# run process
CMD python IP150-MQTTv2.py

I'll confirm if I made any changes to the code to support the config file like this, but I believe I did make alterations to the logging so it uses syslog.

psyciknz commented 6 years ago

If you want (or tertuish does as well) you can look at my fork...and if it's still good for everyone (as it not just SP panels as I added a log of status reporting from those for battery voltage etc). Then I can PR it back to the main fork. But this includes my docker file....it's called a cross, and I have a build script for building arm64v8, arm32v6 and amd64. I'll need to add more files into the fork to explain this. Here's the link: https://github.com/psyciknz/ParadoxIP150v2 It was forked a while ago, so I'm not sure the state compared to the original.

IoTPlay commented 6 years ago

👍