jasonacox / Powerwall-Dashboard

Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
MIT License
270 stars 57 forks source link

Update tesla-history with retry handling on errors #366

Closed mcbirse closed 9 months ago

mcbirse commented 9 months ago

Hi Jason,

This PR includes various updates for the Tesla-History script and Docker Compose environment. Currently for the Solar-Only Dashboard #183 but with plans to migrate into the main project all going well.

I have not committed my own changes or merged this PR as the new tesla-history script will need to be pushed to the Docker Hub account please when you can.

Updates and improvements to tesla-history script:

Docker Compose config changes:

@jasonacox - Please push the latest tesla-history script to Docker Hub by running upload.sh

Please note, I struck some issues while testing this in my dev environment.

First issue - my docker buildx environment no longer worked for some reason (something broken with latest buildx failing with cgroup errors).

I found a workaround which was to install a different buildx driver, as below:

# Install fixed buildx instance using rootless driver image
docker buildx create --name fixed_builder --driver-opt 'image=moby/buildkit:v0.12.1-rootless' --bootstrap --use

I'm not sure if you will need to do the same for your environment.

Second issue - note the "RUN" command in Dockerfile has been been updated.

The build was failing due a dependency requiring gcc to be built. I found a nice solution which was to install alpine linux's "build-base" package (includes gcc) before running "pip install", and then it deletes the package afterwards, which keeps the container size small. Works a charm.

Please note this PR is the first with some more to come. I am working on merging the entire solar-only offshoot into the main project.

I have some preliminary changes in the works, with a more modular approach to how we handle the required docker containers, which will be determined during the setup/install process based on the user choosing a configuration option (default or solar-only).

The containers which will be installed/run are then defined by using the profiles feature of Docker Compose. Testing so far looks promising, but this is still a work in progress at the moment.

hulkster commented 9 months ago

Thanks for all your work @mcbirse

I'm wondering if maybe worth adding a comment in compose.env.sample along the lines of: "Setting IP to 127.0.0.1 (or ::1 for IPV6) will prevent these services from being exposed outside of your local machine" This makes it a little more clear what you can use that for and why.

jasonacox commented 9 months ago

I'm wondering if maybe worth adding a comment in compose.env.sample along the lines of: "Setting IP to 127.0.0.1 (or ::1 for IPV6) will prevent these services from being exposed outside of your local machine" This makes it a little more clear what you can use that for and why.

Perhaps list an example? e.g.

# Use 127.0.0.1 (or ::1 for IPV6) to prevent services from being exposed outside of 
# your local machine - ex. INFLUXDB_PORTS="127.0.0.1:8086:8086"
mcbirse commented 9 months ago

I'm wondering if maybe worth adding a comment in compose.env.sample along the lines of: "Setting IP to 127.0.0.1 (or ::1 for IPV6) will prevent these services from being exposed outside of your local machine" This makes it a little more clear what you can use that for and why.

Perhaps list an example? e.g.

# Use 127.0.0.1 (or ::1 for IPV6) to prevent services from being exposed outside of 
# your local machine - ex. INFLUXDB_PORTS="127.0.0.1:8086:8086"

Great suggestion @hulkster and @jasonacox - I have updated the compose.env.sample file and added the example.

jasonacox commented 9 months ago

@mcbirse - Build and Push jasonacox/tesla-history to DockerHub

Version: 0.1.3

Thanks @mcbirse !

mcbirse commented 9 months ago

Thanks Jason!