Advanced installation with Traefik, Let's Encrypt & HTTP Basic Auth
In case you wish to make TeslaMate publicly available on the Internet, it is strongly recommended to secure the web interface and allow access to Grafana only with a password. This guide provides a docker-compose.yml which differs from the basic installation in the following aspects:
- Both publicly accessible services, TeslaMate and Grafana, sit behind a reverse proxy (Traefik) which terminates HTTPS traffic
- The TeslaMate service is protected by HTTP Basic Authentication
- Custom configuration is held in a separate
.env
file - A Let's Encrypt certificate is automatically acquired by Traefik
- Grafana is configured to require a login
Please note that this is only an example of how TeslaMate can be used in a more advanced scenario. Depending on your use case, you may need to make some adjustments, primarily to the traefik configuration. For more information, see the traefik docs.
#
Requirements- One public FQDN, for example
teslamate.example.com
(substitute your domainname throughout the examples below)
#
InstructionsCreate the following three files:
#
docker-compose.ymlIf you are upgrading from the simple Docker setup make sure that you are using the same Postgres version as before. To upgrade to a new version see Upgrading PostgreSQL.
#
.envIf you are upgrading from the simple Docker setup make sure to use the same database and Grafana credentials as before.
#
.htpasswdThis file contains a user and password for accessing TeslaMate (Basic-auth); note that this is not your tesla.com password. You can generate it on the web if you don't have the Apache tools installed (e.g. http://www.htaccesstools.com/htpasswd-generator/). Use BCrypt encryption mode.
Example:
#
UsageStart the stack with docker-compose up -d
.
- Open the web interface https://teslamate.example.com
- Sign in with your Tesla account
- In the Settings page, update the URLs fields. Set Web App to https://teslamate.example.com and Dashboards to https://teslamate.example.com/grafana
If you have difficulty logging into your Grafana, e.g. you cannot login with the credentials from either the simple setup or the values stored in the .env file, reset the admin password with the following command: