Git Product home page Git Product logo

Comments (6)

drewpost avatar drewpost commented on June 19, 2024 1

OK - I added it to the docker-compose file for Teslamate and that did the trick! Thanks. I'll document this and submit a pull request to help others out. Quick one - does this work historically or is it only point in time forward?

from teslamateagile.

MattJeanes avatar MattJeanes commented on June 19, 2024

Hi Drew, I've just responded to your posts on the TMC forum but I'll summarize it here for others who may run into this issue.

The connection string contains Server, Database, User Id and Password, these correspond to the DATABASE_HOST, DATABASE_NAME DATABASE_USER and DATABASE_PASS env variables respectively set in TeslaMate / Grafana and must match in order for this to work.

Using the default TeslaMate docker setup from their documentation your connection string would be:
ConnectionStrings__TeslaMate=Server=database;Port=5432;Database=teslamate;User Id=teslamate;Password=secret;

Would it be useful to support the same env variables as TeslaMate / Grafana as an alternate configuration? I think perhaps that would make it clearer for people to know what to put in them

from teslamateagile.

drewpost avatar drewpost commented on June 19, 2024

Thanks for the quick reply. I've updated it to:

ConnectionStrings__TeslaMate=Server=database;Port=5432;Database=teslamate;User Id=teslamate;Password=secret;
TeslaMate__UpdateIntervalSeconds=300
TeslaMate__GeofenceId=1 
TeslaMate__Phases=1
Octopus__RegionCode=J

But it's still giving the same error. I checked the Docker compose file and the connection string values match those used by TeslaMate itself so I know they are correct as that's still working.

fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
      An error occurred using the connection to database 'teslamate' on server 'tcp://database:5432'.
fail: Microsoft.EntityFrameworkCore.Query[10100]
      An exception occurred while iterating over the results of a query for context type 'TeslaMateAgile.Data.TeslaMate.TeslaMateDbContext'.
      System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
         at System.Net.Dns.InternalGetHostByName(String hostName)
         at System.Net.Dns.ResolveCallback(Object context)
      --- End of stack trace from previous location where exception was thrown ---

from teslamateagile.

MattJeanes avatar MattJeanes commented on June 19, 2024

Ah just done some reading on the docker default network mode and looks like hostname lookup only works if you put teslamate inside the docker-compose.yml with the other services. You could try that, or you can lookup the ip address using sudo docker ps to find the container name of the database then sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name_here and then put that in there.

Let me know how it goes! I'm currently running TeslaMateAgile myself on top of Kubernetes so the networking abstraction is a little different to the normal Docker one that I imagine most TeslaMate users are doing and I would like to improve the documentation for this

from teslamateagile.

MattJeanes avatar MattJeanes commented on June 19, 2024

Perfect, yes if you could document about adding it to the TeslaMate docker-compose in particular that would be very useful to others I think, and yes it does work historically too, it calculates the cost for any charges within your geofence with no cost set (null value). Might also be worth documenting that too as I've had a few questions of that nature 🤣

from teslamateagile.

MattJeanes avatar MattJeanes commented on June 19, 2024

I went ahead and updated the app to support the same env variables as TeslaMate itself and added instructions on how to add it to docker-compose so don't worry about that documentation

from teslamateagile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.