Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idiot's guide to getting this working on a Synology NAS #113

Closed
drklain opened this issue Aug 24, 2019 · 9 comments
Closed

Idiot's guide to getting this working on a Synology NAS #113

drklain opened this issue Aug 24, 2019 · 9 comments

Comments

@drklain
Copy link

drklain commented Aug 24, 2019

I finally got it working after digging through various sections of the github and doing some research on various commands and the synology (it's been a few years since I did any heavy linux programming, so some of the issues were me tracking down commands). Below are my "idiot proof" instructions for how to get this running on a home LAN with a synology and a Windows10 PC.

  1. Login to your Synology, go to the package center and install Docker

  2. Open your windows notepad and create your docker-compose.yml file. It should look like:

    REMOVED (find latest version here: https://docs.teslamate.org/docs/installation/docker)

  3. Now edit the file as follows:

    a. change localhost in the VIRTUAL_HOST line to whatever the local LAN IP address is for your synology (hopefully you have set your router to make that a static IP address). Should be something like 192.168.1.XXX
    b. change the TZ to equal the timezone where your synology resides. A list of the time zone codes that work can be found at List of tz database time zones - Wikipedia.

  4. Now save the file to your computer. It may be that Windows saves it as docker-compose.yml.txt. I had to go in and manually rename it, deleting the .txt part. It asked me if I wanted to change the file type and I said yes. No impact on it after that and I could still open it up with notepad.

  5. Now you need to transfer the file to Synology. If you can FTP to your synology, it's easy. If not, do the following:

    a. Open "File Station" in the Synology desktop.
    b. Navigate to a folder that is easy to get to (say a top level folder like "files"
    c Right click your mouse, select upload to and upload your file from your windows pc. It should now be sitting in your "files" directory (or wherever you put it).

  6. Next you need to set up your synology so you can SSH to it. If you have already done this, skip this step. Otherwise, go to Control Panel->Terminal & SNMP and in the Terminal tap, check the box to enable SSH Service, leave the default port of 22 selected.

  7. Now go back to your Windows box and open up an SSH terminal. In my box I did it by clicking the Windows and the X keys and then selecting Windows Powershell

  8. In the command prompt, I typed ssh admin@synologylocal address (I used ssh admin@servername.local but you should also be able to type ssh admin@192.168.1.XXX (whatever your synology ip address is)).

  9. You will then get a prompt to enter the admin password. Type in the admin password for your synology and hit enter.
    10.You should get a display showing something like "admin@servername:/$" -- this is the synology SSH prompt.

  10. Typesudo -i(this changes you to root access to the synology box)

  11. You will get a password prompt...type in your admin password again

  12. You will now get a prompt that looks like root@servername:

  13. Now change directories to your docker directory. Type cd /volume1/@docker (note the @ before docker)

  14. Your prompt will now show root@servername:/volume1/@docker#

  15. Now it gets fun....you need to move your docker-compose.yml file to the @docker directory (which you can't access or see from the File Station synology app), so you need to move it via linux commands. The command to type is mv /volume1/files/docker-compose.yml /volume1/@docker/docker-compose.yml Note there is a space between mv and the first file location and between that location and the destination file location. In linux, everything is case-sensitive, so if your files directory is named "Files" then you need to write it that way.

  16. Type dir and, if you are successful, you will see docker-compose.yml in the current (@docker) directory.

  17. You've now done the hard stuff. Next you type the command to download and install the packages. The command is docker-compose up -d (note the space after compose and up and the space between up and -d. You DO NOT type .yml after docker-compose. If you did everything right, things will run and scroll for several minutes as it downloads multiple packages and installs them. At the very end you will get some "dones" and be back to your root@servername: prompt.

  18. Go back to your synology web interface and open the Docker app. In the overview tab you should see 4 containers running: docker_db_1, docker_grafana_1, docker_mosquito_1, and docker_teslamate_1.

  19. Now in your PC web browser, you want to type: synologyIP address:4000 (should be something like 192.168.0.123:4000). The TeslaMate interface will open. Type in your TESLA email address and password (just like when you login to the car app). It will open up a page which shows you the current status of your car. Note it defaults to kilometers and degrees C but you can change that on the settings page.

  20. Now in your PC web browser, type in synologyIP address:3000 (should be something like 192.168.0.123:3000. This will open up Grafana which is where you can see all the charts. Various charts are on the left. Most are blank until you do something with your car/time goes by, but it will start populating. If you click on the "position" chart, it should open a map with a red dot where your car currently is. If you can see that, it is getting data from the car!

Realize this is a long post but figured these instructions would be helpful to those with a Synology who have never done this kind of thing before. @adriankumpf - This is really a great piece of work. If desired, you can post these instructions somewhere on your github page as well (I didn't want to assume anything and post them there).

@adriankumpf
Copy link
Collaborator

Awesome. Thanks for the detailed instructions! I'll pin this issue so others can find it easily.

@adriankumpf adriankumpf pinned this issue Aug 25, 2019
@drklain
Copy link
Author

drklain commented Aug 25, 2019 via email

@adriankumpf
Copy link
Collaborator

Does your car have the MCU1 which has the "old" energy management system? If so make sure to disable "Always connected" in the energy saving settings. Additionally this article could be helpful to identify the problem.

@drklain
Copy link
Author

drklain commented Aug 25, 2019 via email

@scottismyname
Copy link

Just a small suggestion. A large portion of this guide seems to be creating the docker compose file and getting it on your synology. Instead of creating it windows, transferring it to your NAS and then moving it to the appropriate directory, either just create it on your synology via the command line. It is quite simple.

  1. Copy and paste contents of your desired yaml file to your clipboard.
  2. In the correct directory, vi docker-compose.yml
  3. Go into insert mode by pressing i
  4. Paste the contents (usually via right click)
  5. Save and quit vi (press esc, then : and type wg)

@adriankumpf adriankumpf unpinned this issue Sep 2, 2019
@adriankumpf adriankumpf pinned this issue Sep 12, 2019
@adriankumpf adriankumpf unpinned this issue Oct 21, 2019
@baylanger
Copy link
Contributor

This isn't working for me. I create the docker file and when the Teslamate instance comes up, it complains saying the Postgres role "teslamate" doesn't exist.

Is teslamate instance supposed to do that for us? The instance keeps restarting, by the time I open a console.. the instance dies and I can't even try to create the db myself.

@slynetG
Copy link

slynetG commented Jan 22, 2020

Thanks all for those detailled instructions !

Is it safe to change ownership on the @docker folder ?

As you instructed to install using root, my admin account has no access, so no way to run a backup or a snapshot..

@aleckloss
Copy link

aleckloss commented Apr 1, 2020

I'm having issues after a few failed installs. Now I'm getting everything to work, but the existing database fell out of sync. I'm getting a password failed error in the teslamate docker container.

What's odd is that I attempt to delete the teslamate_db volume, but i'm still getting errors after a new compose. I've tried to locate the DB on my NAS and can't find it to delete the old DB or password config file, or anything. Can I get some assistance?

15:13:58.024 [error] Postgrex.Protocol (#PID<0.231.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "teslamate"

@jasongold
Copy link

jasongold commented Apr 10, 2020

I struggled with these for a while and found out the configuration above is a bit off...

Here is what I used that worked for me.

version: '3'
services:
teslamate:
image: teslamate/teslamate:latest
restart: unless-stopped
environment:
- DATABASE_USER=teslamate
- DATABASE_PASS=secret
- DATABASE_NAME=teslamate
- DATABASE_HOST=db
- MQTT_HOST=mosquitto
- VIRTUAL_HOST=192.168.xxxxx.xxxxxx
# if you're going to access the UI from another machine replace
# "localhost" with the hostname / IP address of the docker host.
- TZ=US # (optional) replace to use local time in debug logs. See "Configuration".
ports:
- 4000:4000
cap_drop:
- all

db:
image: postgres:11
environment:
- POSTGRES_USER=teslamate
- POSTGRES_PASSWORD=secret
volumes:
- teslamate-db:/var/lib/postgresql/data

grafana:
image: teslamate/grafana:latest
environment:
- DATABASE_USER=teslamate
- DATABASE_PASS=secret
- DATABASE_NAME=teslamate
- DATABASE_HOST=db
ports:
- 3000:3000
volumes:
- teslamate-grafana-data:/var/lib/grafana

mosquitto:
image: eclipse-mosquitto:1.6
ports:
- 1883:1883
- 9001:9001
volumes:
- mosquitto-conf:/mosquitto/config
- mosquitto-data:/mosquitto/data

volumes:
teslamate-db:
teslamate-grafana-data:
mosquitto-conf:
mosquitto-data:

@teslamate-org teslamate-org locked as resolved and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants