├── conf
├── mysql.sql
└── traccar.xml
├── docker-compose.yml
├── Dockerfile
├── README.md
└── LICENSE
/conf/mysql.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS traccar;
2 | GRANT ALL PRIVILEGES ON traccar.* To 'traccar'@'%' IDENTIFIED BY 'traccar';
3 |
--------------------------------------------------------------------------------
/conf/traccar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ./conf/default.xml
6 | com.mysql.jdbc.Driver
7 | jdbc:mysql://mysql:3306/traccar?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''
8 | traccar
9 | traccar
10 |
11 |
12 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 |
4 | mysql:
5 | image: mysql
6 | restart: always
7 | hostname: mysql
8 | environment:
9 | - MYSQL_ROOT_PASSWORD=my-secret-pw
10 | volumes:
11 | - mysql:/var/lib/mysql/
12 | - ./conf/mysql.sql:/docker-entrypoint-initdb.d/mysql.sql
13 |
14 | traccar:
15 | image: marcelmaatkamp/traccar-server
16 | hostname: traccar
17 | restart: always
18 | ports:
19 | - "5000-5150:5000-5150"
20 | - "8082:8082"
21 | volumes:
22 | - traccar-db:/opt/traccar/data/database
23 | - ./conf/traccar.xml:/opt/traccar/conf/traccar.xml
24 |
25 | volumes:
26 | traccar-db:
27 | mysql:
28 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM java:8-jre-alpine
2 |
3 | MAINTAINER Maxim Zalysin
4 |
5 | ENV TRACCAR_VERSION 4.8
6 |
7 | WORKDIR /opt/traccar
8 |
9 | RUN set -ex && \
10 | apk add --no-cache --virtual install-dependencies wget && \
11 | \
12 | wget -qO /tmp/traccar.zip https://github.com/tananaev/traccar/releases/download/v$TRACCAR_VERSION/traccar-other-$TRACCAR_VERSION.zip && \
13 | unzip -qo /tmp/traccar.zip -d /opt/traccar && \
14 | rm /tmp/traccar.zip && \
15 | \
16 | apk del install-dependencies
17 |
18 | EXPOSE 8082
19 |
20 | ENTRYPOINT ["java"]
21 |
22 | CMD ["-Djava.net.preferIPv4Stack=true", "-Xms512m", "-jar", "tracker-server.jar", "conf/traccar.xml"]
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # traccar server
2 |
3 | Start https://www.traccar.org server with a MySQL backend.
4 |
5 | New tracker GPS devices can connect on port 5000-5150 and see https://www.traccar.org/devices which port the device should use and see https://www.traccar.org/protocols for the supported protocols traccar supports.
6 |
7 | ## Start MySQL
8 |
9 | Start MySQL which will automatically create a database named 'traccar' with user 'traccar' and password 'traccar' (see https://raw.githubusercontent.com/marcelmaatkamp/docker-traccar/master/conf/mysql.sql)
10 |
11 | ```
12 | docker-compose up -d mysql
13 | docker-compose logs -f mysql
14 | ```
15 |
16 | And watch the logs and wait for this line, this tells us that the database is up and running:
17 |
18 | ```
19 | mysql_1 | Version: '5.7.17' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)`
20 | ```
21 |
22 | ## Start traccar
23 |
24 | ```
25 | docker-compose up [-d] traccar
26 | ```
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Marcel Maatkamp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------