Browse Source

init

tags/v1.0.0
Robin Thoni 10 months ago
commit
68cd7f6667
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E
5 changed files with 96 additions and 0 deletions
  1. 7
    0
      .env
  2. 2
    0
      .gitignore
  3. 64
    0
      docker-compose.yml
  4. 15
    0
      traccar/Dockerfile
  5. 8
    0
      traccar/bin/entrypoint.sh

+ 7
- 0
.env View File

@@ -0,0 +1,7 @@
1
+POSTGRES_HOST=postgres.main.internal.docker
2
+POSTGRES_USER=traccar
3
+POSTGRES_PASSWORD=pg_password
4
+POSTGRES_DB=traccar
5
+
6
+ALL_TZ=Europe/Paris
7
+ALL_RESTART_POLICY=no

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+*.swp
2
+/data

+ 64
- 0
docker-compose.yml View File

@@ -0,0 +1,64 @@
1
+version: '2'
2
+
3
+services:
4
+    postgres:
5
+        image: postgres:13-alpine
6
+        restart: ${ALL_RESTART_POLICY}
7
+        networks:
8
+            main.internal.docker:
9
+                aliases:
10
+                    - postgres.main.internal.docker
11
+        volumes:
12
+            - ./data/postgres/data:/var/lib/postgresql/data
13
+        environment:
14
+            TZ: ${ALL_TZ}
15
+            POSTGRES_USER: ${POSTGRES_USER}
16
+            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
17
+            POSTGRES_DB: ${POSTGRES_DB}
18
+        ports:
19
+            - "127.0.0.1:34080:5432"
20
+
21
+    postgres-backup:
22
+        image: prodrigestivill/postgres-backup-local:13-alpine
23
+        restart: ${ALL_RESTART_POLICY}
24
+        networks:
25
+            main.internal.docker:
26
+                aliases:
27
+                    - postgres-backup.main.internal.docker
28
+        volumes:
29
+            - ./data/postgres-backup/data:/backups
30
+        environment:
31
+            TZ: ${ALL_TZ}
32
+            POSTGRES_USER: ${POSTGRES_USER}
33
+            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
34
+            POSTGRES_DB: ${POSTGRES_DB}
35
+            POSTGRES_HOST: ${POSTGRES_HOST}
36
+            SCHEDULE: 0 17 2 * * * # every day at 02:17:00 AM
37
+            BACKUP_KEEP_DAYS: 7
38
+            BACKUP_KEEP_WEEKS: 4
39
+            BACKUP_KEEP_MONTHS: 12
40
+
41
+    traccar:
42
+        build:
43
+            context: ./traccar
44
+        # image: traccar/traccar:5.6-debian
45
+        restart: ${ALL_RESTART_POLICY}
46
+        networks:
47
+            main.internal.docker:
48
+                aliases:
49
+                    - zabbix.main.internal.docker
50
+        ports:
51
+            - "0.0.0.0:35300:8082"
52
+            - "0.0.0.0:5170:5170/udp"
53
+        volumes:
54
+            - ./data/traccar/logs:/opt/traccar/logs
55
+            - ./data/traccar/traccar.xml:/opt/traccar/traccar-default.xml:ro
56
+        environment:
57
+            TZ: ${ALL_TZ}
58
+            DB_SERVER_HOST: ${POSTGRES_HOST}
59
+            POSTGRES_USER: ${POSTGRES_USER}
60
+            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
61
+            POSTGRES_DB: ${POSTGRES_DB}
62
+
63
+networks:
64
+    main.internal.docker:

+ 15
- 0
traccar/Dockerfile View File

@@ -0,0 +1,15 @@
1
+FROM traccar/traccar:5.6-debian
2
+
3
+RUN set -x \
4
+    && apt-get update \
5
+    && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -yq \
6
+        gettext \
7
+    && apt-get clean \
8
+    && rm -rf /var/lib/apt/lists/* \
9
+    ;
10
+
11
+COPY ./bin/entrypoint.sh /usr/local/bin/entrypoint.sh
12
+
13
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
14
+
15
+CMD ["-jar", "tracker-server.jar", "traccar.xml"]

+ 8
- 0
traccar/bin/entrypoint.sh View File

@@ -0,0 +1,8 @@
1
+#! /usr/bin/env bash
2
+
3
+set -x
4
+set -e
5
+
6
+envsubst < /opt/traccar/traccar-default.xml > /opt/traccar/traccar.xml
7
+
8
+exec java -Xms1g -Xmx1g -Djava.net.preferIPv4Stack=true "${@}"

Loading…
Cancel
Save