Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

TeslaMate Super Thread

This site may earn commission on affiliate links.
The docker-compose setup is using traefik to terminate the SSL traffic, as well as serve the challenge file for letsencrypt so it's configured to use both 80/443.

What are you using nginx for? You should probably just add the reverse proxy setup to your nginx conf.

Sorry, I'm sure I have no idea what I am talking about. I believe nginx is part of the letsencrypt package installed through Unraid. I'm not really sure how else to interpret the remaining parts of your questions. Appreciate the help, but I'm still lost. I tried changing port 80:80 to like 82:80 and docker-compose runs the config and spins up the "proxy_1" container, but I still can't access port 4000 or 3000. I'm sure I'm just a blind monkey trying to jam a square block into a round hole.
 
Sorry, I'm sure I have no idea what I am talking about. I believe nginx is part of the letsencrypt package installed through Unraid. I'm not really sure how else to interpret the remaining parts of your questions. Appreciate the help, but I'm still lost. I tried changing port 80:80 to like 82:80 and docker-compose runs the config and spins up the "proxy_1" container, but I still can't access port 4000 or 3000. I'm sure I'm just a blind monkey trying to jam a square block into a round hole.
Okay, a bunch of things.

1) I have no idea any specifics on Unraid, so you're on your own for that.

2) Letsencrypt is just for securing the webserver(s). Is your unraid setup available from outside your home network? Is it working with a valid certificate?

3) The ports 4000 and 3000 are not exposed in the traefik compose file, because they don't need to be. You can add them by appending the ports config option (see the standard setup for the syntax and where to put them).

4) If you don't need TeslaMate outside your personal network, just use the simple setup and everything will work. If you do need it outside your network, you can just add a set of reverse proxy configuration(s) to your nginx configuration. I mostly use apache/httpd so I don't have examples but I'm sure you can find examples online, and maybe even mostly cut/paste the unraid setup.
 
  • Like
Reactions: j2los
Okay, a bunch of things.

1) I have no idea any specifics on Unraid, so you're on your own for that.

2) Letsencrypt is just for securing the webserver(s). Is your unraid setup available from outside your home network? Is it working with a valid certificate?

3) The ports 4000 and 3000 are not exposed in the traefik compose file, because they don't need to be. You can add them by appending the ports config option (see the standard setup for the syntax and where to put them).

4) If you don't need TeslaMate outside your personal network, just use the simple setup and everything will work. If you do need it outside your network, you can just add a set of reverse proxy configuration(s) to your nginx configuration. I mostly use apache/httpd so I don't have examples but I'm sure you can find examples online, and maybe even mostly cut/paste the unraid setup.

1-2) Yes. I have several services accessible behind letsencrypt proxy running perfectly. Unraid has a community hub for installation of these services in docker, however, so it is much easier as a turnkey configuration and then I just make the appropriate steps to make sure they are on my proxy network.

3) This makes sense. I spun up a ubuntu VM and did the "simple" config without traefik and i can access through ports 3000/4000 on the VM's local IP. This will be my fall back install to use internally-only if I can't get it accessible through my proxy. It sounds like you're saying when you do the proxy config, that port 80/443 will then do the forwarding to the container's port 4000/3000 and there is no explicit local network connection to those ports.

4) I would strongly like at least the grafana visualizations accessible from the web. That is the end goal at least. I think I can figure out the config file on the nginx side, because I've done that with a few of the other services, but what I don't know is the correct config on the docker-compose.yml side.

An example of a current service, heimdall's proxy config :

Code:
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name [subdomain_alias].*;
    include /config/nginx/ssl.conf;
    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_heimdall heimdall;
        proxy_pass https://$upstream_heimdall:443;
    }
}

For the record (and maybe this is my likely primary pain point), my letsencrypt container runs off port 1443 and 180 with my router forwarding 443/80 to those ports respectively. This is common advice on Unraid because apparently Unraid uses those 80/443 internally. Regardless, if I change the 'traefik' portion of the config to either 1443:443 / 180:80 or 443:443 / 80:80, it still spits out an 'address used' error and won't spin up the proxy. It leads me to believe it's attempting to run a completely different proxy container/network than letsencrypt, so that's where/how I'm stuck on "that side" of the config.
 
An example of a current service, heimdall's proxy config :

Code:
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name [subdomain_alias].*;
    include /config/nginx/ssl.conf;
    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_heimdall heimdall;
        proxy_pass https://$upstream_heimdall:443;
    }
}

For the record (and maybe this is my likely primary pain point), my letsencrypt container runs off port 1443 and 180 with my router forwarding 443/80 to those ports respectively. This is common advice on Unraid because apparently Unraid uses those 80/443 internally. Regardless, if I change the 'traefik' portion of the config to either 1443:443 / 180:80 or 443:443 / 80:80, it still spits out an 'address used' error and won't spin up the proxy. It leads me to believe it's attempting to run a completely different proxy container/network than letsencrypt, so that's where/how I'm stuck on "that side" of the config.
Cool. You're much better at this than you let on earlier ;)

You can not change Traefik to use 80/443 or 1443/180 because they're all in use, by unraid and nginx respectively.

What you'll want to do is remove the traefik stuff completely. It's probably actually easier moving forward using the basic setup.

You'll want to add a second/third set of configurations to your nginx server conf, very similar to what you have already, but pointing to the DNS name/ports of the teslamate/grafana services. If I were more familiar with nginx I would try to help, the basic Teslamate App and grafana should be easy, the websocket portion might require a bit of extra work.

The server_name directive is key here, these will be set to the FQDN of your desired teslamate/grafana web endpoints. This will let the nginx server serve the appropriate certificates based on SNI (server name indication).

See
NGINX Reverse Proxy Setup Guide | SSLTrust
and
Using NGINX as a WebSocket Proxy
For inspiration
 
Last edited:
  • Like
Reactions: j2los
I have Teslamate running inside a docker container on Ubuntu 18.04 Server. Here's how I got it working:

1) Install docker from the official Docker repository:
How to Install Docker On Ubuntu 18.04 {2020 Tutorial}

2) install docker-compose:
Install Docker Compose

3) Create a docker compose YML file that's specific to TeslaMate. It's not strictly necessary to do this but I run other software on my Linux server aside from Teslamate in their own docker containers. This way I can use docker-compose to start and update different groups of software independently from each other.

Create this file in your home directory:

~/teslamate-compose.yml

Put this in teslamate-compose.yml:



4) Download the latest images:
% docker-compose -f teslamate-compose.yml pull

5) Start the containers:
% docker-compose -f teslamate-compose.yml -p teslamate up -d

Let it run for a minute or two, then try loading it in a web browser:
http://<IP_address_of_your_server>:4000

Whenever a new version of Teslamate is released, you can update and restart the images by running steps 4) and 5) again, then clean up/delete the old container images:

% docker image prune
Cool. You're much better at this than you let on earlier ;)

You can not change Traefik to use 80/443 or 1443/180 because they're all in use, by unraid and nginx respectively.

What you'll want to do is remove the traefik stuff completely. It's probably actually easier moving forward using the basic setup.

You'll want to add a second/third set of configurations to your nginx server conf, very similar to what you have already, but pointing to the DNS name/ports of the teslamate/grafana services. If I were more familiar with nginx I would try to help, the basic Teslamate App and grafana should be easy, the websocket portion might require a bit of extra work.

The server_name directive is key here, these will be set to the FQDN of your desired teslamate/grafana web endpoints. This will let the nginx server serve the appropriate certificates based on SNI (server name indication).

See
NGINX Reverse Proxy Setup Guide | SSLTrust
and
Using NGINX as a WebSocket Proxy
For inspiration

Thanks! This is a great help. I'll read up on how to do this. Now that I know why 3000/4000 weren't accessible with that config, I think I can work backwards from that.
 
In addition, I'm not seeing energy used for any specific trip. Am I missing something?

Screen Shot 2020-04-02 at 7.31.49 PM.png


Screen Shot 2020-04-02 at 7.41.12 PM.png
 
Last edited:
This - My car is online most of the day at the moment per Teslamate - just not sure if that's "normal" behavior.

Right. Hard to say what’s normal. My car has now been uninterrupted asleep since 7:30pm last night Pacific Time. So that’s good. But I’ve noticed historically it would wake up and stay awake/online for 2 hours or so, which seems bizarre to me.
 
Right. Hard to say what’s normal. My car has now been uninterrupted asleep since 7:30pm last night Pacific Time. So that’s good. But I’ve noticed historically it would wake up and stay awake/online for 2 hours or so, which seems bizarre to me.
Right, that happens to me too. Uninterrupted sleep for about 2 days then 2-3 hours of awake time.

At first I was concerned, but after having the car sit for weeks following this cycle, I noticed the 'vampire drain' is more or less consistent with what I saw prior to having any kind of data logging service.
 
Right, that happens to me too. Uninterrupted sleep for about 2 days then 2-3 hours of awake time.

At first I was concerned, but after having the car sit for weeks following this cycle, I noticed the 'vampire drain' is more or less consistent with what I saw prior to having any kind of data logging service.

Yeah who knows? Car still asleep now. I don’t need to be going anywhere so I’ll be curious how long it stays asleep, in my garage, connected to my HPWC, no Sentry, on WiFi. Currently at just over 17 hours uninterrupted sleep. I’m guessing it will eventually wake up when a charge is needed.
 
Trying to set this up today on a Pi 4 but having installed Docker successfully I'm getting the following error when trying to run the simple install YAML:

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./teslamate-compose.yml", line 5, column 42

Using the exact script as on the teslamate setup guide. Any ideas?
 
Got there in the end. I'd like to think I'm fairly techy - I know my way around HTML5, CSS, PHP and jQuery but formatting YAML... what the hell! No idea why the Teslamate guide doesn't just format the compose file where it's copy and pasteable; the indents and bullets just don't copy across.

The below should be if anyone has similar issues:

Code:
version: '3'
services:
    teslamate:
        image: teslamate/teslamate:latest
        restart: always
        environment:
            - DATABASE_USER=teslamate
            - DATABASE_PASS=secret
            - DATABASE_NAME=teslamate
            - DATABASE_HOST=database
            - MQTT_HOST=mosquitto
        ports:
            - 4000:4000
        volumes:
            - ./import:/opt/app/import
        cap_drop:
            - all
    database:
        image: postgres:12
        restart: always
        environment:
            - POSTGRES_USER=teslamate
            - POSTGRES_PASSWORD=secret
            - POSTGRES_DB=teslamate
        volumes:
            - teslamate-db:/var/lib/postgresql/data
    grafana:
        image: teslamate/grafana:latest
        restart: always
        environment:
            - DATABASE_USER=teslamate
            - DATABASE_PASS=secret
            - DATABASE_NAME=teslamate
            - DATABASE_HOST=database
        ports:
            - 3000:3000
        volumes:
            - teslamate-grafana-data:/var/lib/grafana
    mosquitto:
        image: eclipse-mosquitto:1.6
        restart: always
        ports:
            - 1883:1883
        volumes:
            - mosquitto-conf:/mosquitto/config
            - mosquitto-data:/mosquitto/data
volumes:
    teslamate-db:
    teslamate-grafana-data:
    mosquitto-conf:
    mosquitto-data:
 
Last edited:
Got there in the end. I'd like to think I'm fairly techy - I know my way around HTML5, CSS, PHP and jQuery but formatting YAML... what the hell! No idea why the Teslamate guide doesn't just format the compose file where it's copy and pasteable; the indents and bullets just don't copy across.
When I set it up, I just did a copy and paste from Docker install | TeslaMate for the docker-compose.yml file and didn't change a thing. Once I created that file in its own subdirectory, it was as simple as:

Code:
> docker-compose pull

> docker-compose up -d

Easiest not to change the name of the YAML file so you don't have to specify it. By default, docker-compose will look for docker-compose.yml
 
When I set it up, I just did a copy and paste from Docker install | TeslaMate for the docker-compose.yml file and didn't change a thing. Once I created that file in its own subdirectory, it was as simple as:

Code:
> docker-compose pull

> docker-compose up -d

Easiest not to change the name of the YAML file so you don't have to specify it. By default, docker-compose will look for docker-compose.yml

Guh, I was following <no title> which is the second Google result for Teslamate! At least I know how to correctly format a YAML file now, which was part of the reason for getting a Pi...
 
Been a while since I've seen activity in this thread...

Just had a potential issue pop up. With the latest software update from Tesla (2020.32.3) I disabled "auto walk away lock at home". I then noticed my car would didn't go to sleep and it burned off lots of juice parked in the garage. I just noticed there's an option in Teslamate that, when checked, requires the vehicle to be locked to go to sleep. It looks like the two were at odds... Curious to know if others run into this.