One of my favourite features of Uber has always been "Share My ETA", a way to simply send a link to someone allowing them to see your estimated arrival time and track your ride. As I'm already running TeslaLogger, I thought I'd build a tool that would allow me to share my ETA based on my Tesla's location.
This is where TeslaETA comes in.
So how do you get it up and running alongside TeslaLogger?
TeslaETA behind Traefik
We'll assume you have a running Traefik and TeslaLogger instance, if not, you can use the following guide to get that set up.
We'll run TeslaETA as a Docker contianer, for which we'll need to configure 2 things, our
docker-compose.yml and the
We'll need to create a folder to store the SQLite DB in:
mkdir -p ~/docker/teslaeta/data/
Next, we'll move into the folder
In that folder, let's create the following
version: '3' services: teslaeta: container_name: teslaeta image: ghcr.io/flosoft/teslaeta:latest volumes: - ./data/:/data/ env_file: - .env networks: - traefik_default labels: - "traefik.enable=true" - "traefik.http.routers.teslaeta.rule=Host(`tesla.foo.bar`) && PathPrefix(`/map`)" - "traefik.http.routers.teslaeta.entrypoints=websecure" - "traefik.http.routers.teslaeta.tls=true" - "traefik.http.routers.teslaeta.tls.certresolver=leresolver" - "traefik.http.services.teslaeta.loadbalancer.server.port=5051" - "traefik.docker.network=traefik_default" networks: traefik_default: external: true
We'll mount the
data folder that we created as a volume, so that we can keep our SQLite database safe and connect it to the
Next, we'll configure the
labels. The configuration above will have it run on
tesla.foo.bar/map, and leverages
leresolver to generate certificates.
It's also expecting our TeslaETA service to run on
Now that we have the docker-compose file ready, let's configure the
We'll use the
.env_sample file as a starting off point: https://github.com/flosoft/TeslaETA/blob/master/.env_sample
PORT=5051 DATA_DIR=/data/ SECRET_KEY=SOME_SECRET_KEY_HERE ADMIN_PASSWORD=HTPASSWD_FOR_ADMIN_PASSWORD BASE_URL=/map MAPBOX_TOKEN=YOUR_MAPBOX_PUBLIC_KEY TESLALOGGER_BASEURL=http://teslalogger:5000/ TESLALOGGER_CARID=1 TZ=Europe/Berlin
We'll configure the following variables:
PORTwill need to match your docker-compose configuration, so we'll set it to
DATA_DIRwill need to match the volume mount, so we'll use
SECRET_KEYis a random key that's used to encrypt the user password. Just use a randomly generated password here.
ADMIN_PASSWORDis a htpasswd. You can use a command such as
htpasswd -n userto generate a password. Just copy the password hash, not the username.
BASE_URLwe'll set to
/mapto match the Traefik rule.
MAPBOX_TOKENyou can get by creating a free account on Mapbox, and generating a token.
TESLALOGGER_BASEURLwe'll set to
http://teslalogger:5000/as that's the internal service name on the
traefik_defaultnetwork and the 5000 port is the internal port used by TeslaLogger. If you're running TeslaLogger separately, simply point it to your TeslaLogger instance, i.e.
TESLALOGGER_CARIDis the ID of your car in TelsaLogger - the default being
TZis the environment variable you can use to set your local timezone for the expiry time of the links.
Running it all
Now that you've configured everything, simply use
docker-compse up -d to get it up and running.
That's it - you should now be able to access TeslaETA via
https://tesla.foo.bar/map/admin and create links.