Overview
This instruction will inform about a couple of basic components and guide through the process of installing Traccar on a Synology NAS using Docker. It will focus on employing Sonology’s User Interface (UX) capabilities mainly.
When can you use this installation instruction?
Synology and Traccar use Ports to address services. Unfortunately, some of the ports overlap.
Before you carry on, make sure what port / protocol your tracker uses: https://www.traccar.org/devices/ and compare to the ports the services you installed in your Synology uses: https://kb.synology.com/en-us/DSM/tutorial/What_network_ports_are_used_by_Synology_services
Example 1: You own a TK104 tracker. That runs on port 5001. Port 5001 is used by Synology for certain secure services as DSM, File & Audio Station, so you can’t run Traccar on that port! You need to remap the Traccar ports – you can’t use this instruction for the simple installation. Instead use this one: https://motorradtouren.de/synology-docker-install-traccar-server-including-mariadb-and-phpmyadmin/
Example 2: You use an AVL-900 real time vehicle tracker. AVL-900 needs port 5005. Synology uses 5005 on case you run Webdav / Caldav. Now you need to decide.
* If you have Webdav/Caldav installed: You need to remap the Traccar ports – you can’t use this instruction for the simple installation. Instead use this one: https://motorradtouren.de/synology-docker-install-traccar-server-including-mariadb-and-phpmyadmin/
* You don’t have Webdav/Caldav installed: Carry on with this simple instrution!
Example 3: You want to use your mobile as a tracker. The mobile app uses the Osmand protocol on port 5055. Port 5055 is not in use by any Synology services: So it works – use this instrution and carry on!
You are here because you want to install Traccar on a Synology Plus Series and you are sure you will have no port overlaps between Traccar and Synology.
Your prerequisites
- A Synology NAS of the Plus Series, as those are enabled for virtualizing environments with their more powerful central processing units (CPUs). These are easily identified by the name DSxxxx+.
- Some understanding of DNS, Network, Ports and Proxies to make sense of and secure things.
- Understanding of IP handling and Port forwarding for your Router.
- Understanding of the Synology Disk Station (DS) and the Disk Station Manager (DSM) and an Administrator Account for the DSM.
- A registered Domain which forwards (e.g. via DynDNS) to your Router/Server (Synology DS) and/or a Subdomain with according CNAME entry.
What is Traccar?
With Traccar you can view your GPS tracking devices in real-time with no delay. There are various mapping options, including road maps and satellite imagery. The Server can handle a wide variety of sensors and additional information supplied by GPS units. Code and documentation can be found here: https://www.traccar.org/
More details here: https://www.traccar.org/products/
What is Docker?
Docker is a platform written in Go and takes advantage of several features of the Linux kernel to deliver its functionality.
Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host (Synology).
Docker uses a technology called namespaces to provide the isolated workspace (the container). These namespaces provide a layer of isolation. Each aspect of a container runs in a separate namespace and its access is limited to that namespace.
Note: Synology’s DSM is a heavily customized Linux. Even though DSM already employs for example components like ngnix and postgres, separate containers will use a part of the existing Linux base but not interfere with any of the Synology’s components of functionality.
Deploy Traccar
- Create the folder structure
- Pull image
- Create container
Create folder structure
In Synology folder /volume1/docker make your workspace for the container data and configuration files.
- /volume1/docker/traccar
- /volume1/docker/traccar/db
- /volume1/docker/traccar/traccar
- /volume1/docker/traccar/traccar/conf
- /volume1/docker/traccar/traccar/logs
Prepare Database
You must have installed on your Synology:
- MariaDB 10 (With DSM 7 this is the only option).
- phpMyadmin
Start phpMyadmin and add a new User and an empty database that traccar can use.
Create / edit configuration file
With traccar version >5, before you move on, read this post carefully:
https://www.traccar.org/forums/topic/web-gui-404-not-found-from-one-day-to-another/page/3/
What it basically says is, don’t link the „conf“ folder, but link traccar.xml only instead!
There are two configuration files. Upload them via Synology FileStation to
docker/traccar/traccar/conf
- default.xml : Use the file provided with the installer package from Traccar.org or download it from Github: https://github.com/traccar/traccar/blob/master/setup/default.xml. This file should not be edited by you unless you know what you do!
- traccar.xml : Here is my example, you need to edit it according to your needs!
Best is to start with this section, leave the rest for later tuning:
1 2 3 4 5 6 7 8 | <!-- Using a MYSQL Database on Host Synology --> <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry> <!-- Essential: If Network was host then one can attach Synology's --> <!-- MariaDB directly using Synology's IP along with MariaDB 10 Port 3307 --> <entry key='database.url'>jdbc:mysql://your_ip:3307/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry> <entry key='database.user'>traccar</entry> <entry key='database.password'>yourpassword</entry> |
Morde details: https://www.traccar.org/configuration-file/
Starting with DSM 7:
Things went easier now. You only have to Create a project in your container manager:
- Open Container Manager
- Click Project
- Select Create
- Give the project a name
- Selekt the path you have created before. For example: /docker/traccar
- Select create a docker compose
- Cut & paste the content provided in the next step into the fields.
Finally press „weiter“ and your container will be created.
The compose.yaml
copy the following code into the entry-field when creating the project:
1 2 3 4 5 6 7 8 9 10 | version: '3' services: traccar: container_name: traccar_latest image: traccar/traccar:alpine volumes: - /volume1/docker/traccar/traccar/conf/traccar.xml:/opt/traccar/conf/traccar.xml:rw - /volume1/docker/traccar/traccar/logs:/opt/traccar/logs:rw network_mode: 'host' restart: always |
Now you can move to Login
Manual way:
Pull Docker image
If you are familiar with how to pull an image, simply pull these and skip to create container.
- traccar/traccar:alpine
Using DSM
Create Container
Make sure you have created the folder as described. Same with the empty database!
Port Settings as well as Links and Environment leave untouched.
Click Apply and the container is built and should start. Details see in Docker’s Container section.
Login
As soon as the container is running, you can log in using your webbrowser: http://localhost:8082 where localhost is your Synology’s internal IP.
In my case: http://192.168.178.70:8082
Using a tracker
There is a variety of trackers that are supported by traccar https://www.traccar.org/devices/
I’m using an Inkutex TK5000 and the Traccar Client on my mobile.
See the port numbers per device / protocol.
Make sure the devices port don’t overlap to any of your Synology’s service ports!
Router & Reverse Proxy
- Router: Do port forwarding according to the tracker you will use. If you use the mobile app Traccar Client, then forward port 5055 TCP and UDP (always TCP and UDP).
- If you want to use the mobile app „Traccar Manager“ or you want to access your traccar server from abroad, you need to setup a Reverse proxy.
Go to Synology „Control Panel“ -> „Login Portal“ -> „Advanced“ -> „Reverse Proxy“
- Provide name
- Select https
- provide your Synology’s DynDns address or better an own for traccar
- select 433 for https
- Enable HSTS to route http to https
- traccar operates on http
- Synology’s local IP
- Traccars Webserver port 8082
Don’t forget to Reverse Proxy Websocket: