liveaverage / docker-powerwall-dashboard

Grafana dashboard showing trend & historical data polled from Tesla Powerwall 2 API served up in an easy to use docker image
GNU General Public License v3.0
29 stars 9 forks source link

Testing with Docker on Windows #8

Closed natrlhy closed 3 years ago

natrlhy commented 3 years ago

Hi,

Thanks for this pull request! I wanted to go for the containerized approach. I am doing intial setup and testing with Docker for Windows. I create a directory called PowerDash and did the docker pull command from it. I do see in Docker for Windows now has an image for the pull request but I'm not seeing how to modify the needed configs to get it up and running locally.

natrlhy commented 3 years ago

I've got a working docker-compose.yml file. Only issue is, the extra_hosts isn't populating so I have to get into the container, create the /etc/hosts entry and start the project up again.

version: '3'
services:
  powerwall-dashboard:
    image: liveaverage/powerwall-dashboard
    environment:
      - POWERWALL_PASS=mypwd
      - GRAFANA_DASHBOARD_URL=https://raw.githubusercontent.com/liveaverage/docker-powerwall-dashboard/master/graf_dash.json
      - POWERWALL_LOCATION=lat=20.713501&lon=-80.866821
    extra_hosts:
      - "teslapw:10.10.10.10"
    ports:
      - 3000:3000
    volumes:
      - /tmp/influxdata:/var/lib/influxdb:z
      - /tmp/grafana:/var/lib/grafana:z

Is there a way to import historical data that the Tesla app has?

Thanks for this port in containers!

natrlhy commented 3 years ago

I rebooted my PC and the project started back up, but the previous data was not there. How can it be configured to retain data if the containers are brought down and back up?

I'm using this docker-compose.yml file and it seems to retain the data if I shutdown my PC, etc. Not sure why the above one wouldn't...


version: '3.3'
services:
    powerwall-dashboard:
        container_name: powerdash
        extra_hosts:
            - 'teslapw:10.10.10.x'
        ports:
            - '3001:3000'
        environment:
            - POWERWALL_PASS=mypass
        volumes:
            - '/tmp/influxdata:/var/lib/influxdb:z'
            - '/tmp/grafana:/var/lib/grafana:z'
        image: liveaverage/powerwall-dashboard
natrlhy commented 3 years ago

I don't get it. I can reboot my PC, and no data is saved. Not sure what gives, even with a docker run command...

liveaverage commented 3 years ago

It appears you're mapping the docker volume to a temporary directory. Have you tried mapping to persistent path on your Windows machine? I'll try to test later, but my daily driver is Fedora.

On Tue, Mar 16, 2021, 17:27 natrlhy @.***> wrote:

I don't get it. I can reboot my PC, and no data is saved. Not sure what gives, even with a docker run command...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/liveaverage/docker-powerwall-dashboard/issues/8#issuecomment-800617429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHTLG3ZKBF3KOTKUOVTH3TD7EK3ANCNFSM4ZAUWH3Q .

natrlhy commented 3 years ago

I think I just figured it out. Docker Desktop for windows is using (Windows Subsystem for Linux 2) WSL2. In your docks I was using the /tmp directory in my docker-compose.yml file as well. I normally don't do all this from Windows either so my lack of understanding the methods docker is leveraging WSL2 was way lacking :)

This is working and I can see the volumes in my local path:

version: '3.3'
services:
    powerwall-dashboard:
        restart: always
        container_name: powerdash
        extra_hosts:
            - 'teslapw:10.10.10.x'
        ports:
            - '3001:3000'
        environment:
            - POWERWALL_PASS=mypass
            - POWERWALL_LOCATION=lat=20.713501&lon=-80.866821
        volumes:
            - './influx-data:/var/lib/influxdb'
            - './grafana-data:/var/lib/grafana'
        image: liveaverage/powerwall-dashboard

Local Dir: C:\Users\myusername\Documents\PowerDash

The docker-compose.yml file is also located here. Just running a docker-compose up -d from the same directory fires it up. I rebooted and the data remains intact.

I think before when I shut down the system, since I was using a temp location, it's flushing it as it normally would on a linux OS.

Now on to how to back this influxdb and grafana data up ;)

natrlhy commented 3 years ago

Just don't put your docker volumes in temp locations. Works well!