sunpower-pvs-exporter
sunpower-pvs-exporter copied to clipboard
Docker support
Anyone been able to get this working with Docker? I made a simple Dockerfile with python:3 as a base image and the pip installing this package, seems to run fine and I can see the metrics streaming from the PVS in the logs, but when I curl http://localhost:9110/ I just get a message A server error occurred. Please contact the administrator.
I tried setting --log-level to DEBUG but I'm not seeing any useful error messages there.
I haven't tried docker yet, but it should be doable. There're 2 options I can think of:1
- Either use port mapping: such as
docker run -p 9110:9110 ..., or - Use host-mode networking (not recommended)
docker --net host
I'll give it a try tomorrow.
Oh yeah I've gotten past that part and gotten all the networking working as expected, but importantly I wasn't able to curl the metrics even from inside the container itself (localhost).
Interestingly I just tried with python2.7 instead and now I'm getting intermittent success when curling from inside the pvs-exporter container. There's a loooong delay (at least 10-20 seconds) And sometimes I get the metrics back while other times I get the above error message. I wonder if I'm hitting some kind of timeout in the wsgi stack somewhere.
Just tried it now:
FROM python:3.8.10-slim-buster
RUN pip install sunpower_pvs_exporter
EXPOSE 9110
ENTRYPOINT sunpower-pvs-exporter
$ docker build -t sunpower_pvs_exporter:1.0 -f Dockerfile .
$ docker run -it sunpower_pvs_exporter:1.0
$ curl -v http://localhost:9110/
I have a 15-panel system, and it takes roughly ~9 seconds to poll. I've heard others with larger panel count take much longer.
I am using curl from within the host instead of inside the container, though.
Nice you're quick-- yeah I was able to get it working right before you posted this by adjusting a few different timeouts (Prometheus scrape timeout, PVS polling timeout). Everything is working now! I've got a 27-panel array it definitely takes the better part of 10-20 seconds to get data.
Feel free to keep this ticket open if you want to add first-class Docker support to the repo. Might even be cool to get a docker-compose.yaml file with a prometheus container too.
Good suggestion — I'm trying to make this as one-click install as possible a la pihole.
You mean like this:
version: "3"
services:
prometheus:
image: bitnami/prometheus:2
ports:
- "9090:9090"
volumes:
- ./prometheus/conf/prometheus.yml:/opt/bitnami/prometheus/conf/prometheus.yml
- ./prometheus/data:/opt/bitnami/prometheus/data
grafana:
image: grafana/grafana
ports:
- "3000:3000"
volumes:
- ./grafana:/var/lib/grafana