Coder Social home page Coder Social logo

Comments (3)

ippocratis avatar ippocratis commented on July 2, 2024 3

ok
there where mixed issues
i managed to make postgres to work
i head to docker inspect network net (net was my network name)
and grab the subnet and gateway

"Config": [
                {
                    "Subnet": "192.168.96.0/20",
                    "Gateway": "192.168.96.1"
                }

i ued the subnet on the

ipam:
      config:
        - subnet:192.168.96.0/20 

in the docker-compose

and the gateway in the database url in the traccar.xml jdbc:postgresql://192.168.96.1:5432/db

beyond that i had to use the official traccar debian arm64 image for my raspberrypi 400 so i can have the traccar web interface
Digest:sha256:f09791c90dbfe9ea5adeb5c5c1f657cfdb1eccaf56bda2194f2a84abfb4b6412

i tried the images from dockerhub before and they threw errors
unfortunately i dont remember which ones
maybe 5x
so i ended up using the dockerfile from this guy and it worked with the embeded db
#61 (comment)
but when using this dockerfile with postgres i couldnt get the traccar UI on port 8082 instead i was getting the database dir

and last i would like to suggest to provide an "official" docker-compose for completely dockerised spinups

i'll leave "mine" here for reference

version: "3"
services:
  traccar:
    image: traccar/traccar:debian
    hostname: my.dyn-dns.domain.com
    container_name: traccar
    restart: unless-stopped
    environment:
      POSTGRES_USER: user
      POSTGRES_DB: db

    depends_on:
      - traccar-db
    volumes:
      - /run/media/ippo/TOSHIBA/traccar/logs:/opt/traccar/logs:rw
      - /run/media/ippo/TOSHIBA/traccar/conf/traccar.xml:/opt/traccar>
      - /run/media/ippo/TOSHIBA/traccar/data:/opt/traccar/web:rw
    ports:
      - "82:8082"
      - "5055:5055/tcp"
    networks:
      - net


  traccar-db:
    container_name: traccar-db
    image: postgres:13
    restart: unless-stopped
    ports:
      - 5432:5432
    volumes:
      - /run/media/ippo/TOSHIBA/traccar/db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: imus
    networks:
     - net
  
networks:
  net:
    driver: bridge
    enable_ipv6: false
    ipam:
      config:
        - subnet: 192.168.96.0/20

thanks and keep up

from traccar-docker.

ippocratis avatar ippocratis commented on July 2, 2024

I'll re open this as it looks like traccar doesnot want to use postgres

So I managed to start the 2 images without errors and thought all was OK

But when I docker exec -it traccar-db bash I see that there are no tables created

And when I docker exec -it traccar ls /opt/traccar/data I see the database.mv.db database.trace.db the h2 creates

So traccar still uses h2

The mounted data volume does not contain any db files though and it makes.no diference if I mount traccar/data volume or not

Also I read similar issues

traccar/traccar#480

that contain "fixes" like decompile>edit>recompile. Jar files

Creating tables scripts

etc

The traccar documentation for psql
https://www.traccar.org/postgresql/
All it States is reaplace [DATABASE], [USER], [PASSWORD] in the configuration xml

from traccar-docker.

ippocratis avatar ippocratis commented on July 2, 2024

Ok
I think I finaly made mysql to work
I had to create the db and user manualy after all
I thought docker-compose would do that for me
Anyway....

docker exec -it traccar-db mysql -u root -p

CREATE DATABASE IF NOT EXISTS traccar-db

utf8mb4

grant all privileges on `traccar-db`.* TO `user'@'%` identified by `pass`

flush privileges

\q

Traccar is up and running and /opt/traccar/data is empty so I guess it uses the mariadb

from traccar-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.