eschava / psmqtt

Utility reporting system health and status via MQTT
MIT License
159 stars 35 forks source link

Dockerfile not working #39

Closed f18m closed 6 months ago

f18m commented 6 months ago

hi @eschava , I tried to build a docker image but the resulting image does not run properly:

fmontorsi@newpcstudio-linux:~/Documents/psmqtt$ docker run -ti psmqtt
Traceback (most recent call last):
  File "/opt/psmqtt/psmqtt.py", line 22, in <module>
    from src.config import load_config
ModuleNotFoundError: No module named 'src'

Since I would like to employ this utility and I have quite a bit of experience with Python, docker and MQTT, would you welcome some PRs to fix a few issues? For example:

Let me know: if you welcome contributions I will start opening PRs :)

thanks!!!

f18m commented 6 months ago

hi @eschava , I successfully managed to use psmqtt on my arm64 NAS device. In my fork https://github.com/f18m/psmqtt/ I published a package https://github.com/f18m/psmqtt/pkgs/container/psmqtt that contains the docker image (with arm64 architecture), in case somebody else finds it useful.

If you are interested in integrating a working dockerfile and perhaps publish an "official" psmqtt docker image, let me know, and I can help you to setup your project if needed...

eschava commented 6 months ago

Hi! Thank you for your contribution! Unfortunately, I'm not a big expert in Docker but the pull request looks neat and I don't mind applying it. Will this be enough to publish the docker image or not?

And a question from me: afaik, Docker runs applications in some kind of container. Does the application have access to the system CPU, memory utilization, etc., when running in such kind of container?

f18m commented 6 months ago

Hi! Thank you for your contribution! you're welcome, thanks for creating psmqtt!

Unfortunately, I'm not a big expert in Docker but the pull request looks neat and I don't mind applying it. Will this be enough to publish the docker image or not?

Unfortunately no. We will need to setup: a) a github pipeline (I can submit this in the same PR or a different PR) b) setup tokens and permissions to use Github container registry, basically following the steps documented at https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry

And a question from me: afaik, Docker runs applications in some kind of container.

yes, correct

Does the application have access to the system CPU, memory utilization, etc., when running in such kind of container? Yes, it all depends on the permissions provided to the container when starting it. In docker it's a matter of using the right 'docker run' parameters. In this PR you can see that in the README I added a note (that actually was meant to document to myself my fork of your project) with the commands to build the docker image (they should go in the github pipeline) plus the command to start the docker container.

Perhaps I can cleanup the README and move these instructions in a "Use as Docker" section, ok?

eschava commented 6 months ago

Merged, what will be the next steps?

f18m commented 6 months ago

Merged, what will be the next steps?

thanks ! The changes in the README are probably not OK for the project (I added a section 'About this fork' which makes sense in my fork but not in this 'upstream' project). Anyway I can change that in the next PR. The next step would be the creation of the github pipeline... let me propose you something in the upcoming PR