Advanced install with Apache2, TLS, 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 an example docker-compose.yml which differs from the simple installation in the following aspects:
- Both publicly accessible services, TeslaMate and Grafana, sit behind a reverse proxy (Apache2) which terminates HTTPS traffic
- Ports 3000 (Grafana) and 4000 (TeslaMate) are only exposed locally
- The TeslaMate service is protected by HTTP Basic Authentication
- Custom configuration was moved into a separate
.envfile - Grafana is configured to require a login
Requirements#
- An already installed Apache2 with the following modules:
mod_proxymod_proxy_httpmod_proxy_wstunnelmod_rewritemod_ssl
- Two FQDN, for example
teslamate.example.comandgrafana.example.com - An existing SSL certificate including the two above in
/etc/letsencrypt/live/teslamate.<your domain>
Instructions#
Create the following files:
docker-compose.yml#
.env#
teslamate.conf#
This file contains the definition of the virtual hosts teslamate.example.com and grafana.example.com. It has to be enabled via a2ensite teslamate.
This assumes, that you have the SSL certificate files residing in /etc/letsencrypt/live/teslamate.example.com. If it is somewhere else, you need to adapt the file accordingly.
.htpasswd#
This file contains a user and password for accessing TeslaMate (Basic-auth), note 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:
Usage#
Start the stack with docker-compose up run in the same directory, where the docker-compose.yml resides.
- Open the web interface teslamate.example.com
- Sign in with your Tesla account
- The Grafana dashboards are available at grafana.example.com.