-
Notifications
You must be signed in to change notification settings - Fork 147
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
Docker-compose support #101
Comments
Depends on your needs.
|
Many thanks for sharing the Docker compose, I’m still learning Docker would you be able to explain a few things.
|
@sincze thanks for the compose file To make your answer a bit more complete I'll add what I had to do beyond using your compose.
under "Name": "Iot",we need "Subnet": "10.0.1.0/29" and under "Iot", subnet goes to config: and IPv4Address goes to jdbc:mysql:// 10.0.1.2:3306/traccar-db in /opt/traccar/conf/traccar.xml:ro (.traccar/conf/traccar.xmll in the example) open a root mysql shell
type your root password Hit enter
hit enter
hit enter
hit enter
hit enter \q hit enter
|
No problem. Great you liked it. That is why I share to help others! I think the DB was created automatically, but it was some time ago. Can do a check if you want on a spare docker machine. |
Yeah I actually thought that docker-compose should create user and database (My issue is here #103 (comment)) So its likely that I miss estimated things |
Hi @ippocratis By any chance, is there an updated compose file you could post? Also, as I want to have this instance on the same network as my primary LAN, do I just change the ip4 subnet to my ip, e.g. 192.168.1.1/29 ? |
docker network ls
under "Name": "traccar_trc",we need "Subnet": "192.168.112.0/20" and under "traccar-db", subnet goes to config: and IPv4Address goes to in /opt/traccar/conf/traccar.xml:ro So you will actually use the docker internal bridge ip's not the host My docker-compose is no diferent than what @sincze provided I just used the debian arm64 image instead of Ubuntu Used the android ports as I only use the android client in traccar hostname I used my ddns domain name which I use to access traccar from outside my lan Added command: --default-authentication-plugin=mysql_native_password as I want yo add user/db and added MYSQL_DATABASE=, MYSQL_USER= , MYSQL_PASSWORD= all to traccar-db environment together with MYSQL_ROOT_PASSWORD= All with trial and error |
The compose.yml for reference
|
And also not directly related but it was the main reason I wanted to move from embedded h2 db to an external To backup traccar with a date timestamp in the SQL file in order to have db "snapshots"
And restore
|
volumes: Dont think you need these with your current mounting options. And I think the code shows an additonal '-' to much :) |
@sincze |
Also tried the official mariadb image but had innodb general errors |
Hi guys, version: "3"
services:
traccar-db:
image: yobasystems/alpine-mariadb
container_name: traccar-db
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=XXXXX
- MYSQL_DATABASE=YYYYYY
- MYSQL_USER=XXXXX
- MYSQL_PASSWORD=XXXXX
networks:
gps:
ipv4_address: 192.168.55.9
traccar:
image: traccar/traccar:latest
container_name: traccar
depends_on:
- traccar-db
restart: always
configs:
- source: traccar_xml
target: /opt/traccar/conf/traccar.xml
volumes:
- type: bind
source: ./traccar/logs
target: /opt/traccar/logs
ports:
- "8090:8082"
environment:
- MYSQL_DATABASE=YYYYYY
- MYSQL_USER=XXXXX
- MYSQL_PASSWORD=XXXXX
networks:
gps:
ipv4_address: 192.168.55.10
networks:
gps:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.55.0/24
gateway: 192.168.55.1
configs:
traccar_xml:
file: traccar.xml and the config file <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://192.168.55.9:3306/YYYYYY?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=true&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key='database.user'>XXXXX</entry>
<entry key='database.password'>XXXXX</entry> |
I'm trying to implement the same idea but with them segregated from my Synology NAS using macvlans although I'm running into errors with the traccar container saying they cant reach the data base. Any ideas as to what could be wrong here? logs look like they cycle '[Guice/ErrorInCustomProvider]: HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up.' and end with 'Caused by: java.net.ConnectException: Connection refused (Connection refused)'
traccar xml file:
|
Here is docker compose I'm using for my traccar instance. Works rock solid using PostgreSQL. docker-compose.yml
.env file
traccar.xml
|
This is great - @mrskizzex could you share your sanitized Traefik Middleware file too? I think thats the part im getting stuck on. Thanks |
Well sure but it's really up to you how to set up traefik. I followed this tutorial how to set it up https://www.youtube.com/watch?v=n1vOfdz5Nm8 |
Hi,
It is possible to provide an official docker-compose file to run this docker?
Regards
The text was updated successfully, but these errors were encountered: