traccar.xml

Eric 3 days ago

Hi,
Maybe some stupid questions but I can't find a solution:
I run traccar with docker compose: https://github.com/traccar/traccar/blob/master/docker/compose/traccar-timescaledb.yaml
It's all working fine. But how can I change the configuration file (I guess traccar.xml). Configure it in the compose file so it's outside the docker?? And how?? And do you have an example? This one: https://github.com/traccar/traccar/blob/master/setup/traccar.xml ???
And how can I enter the Traccar Geocoder settings if I run that docker too?
I don't have enough example config file.
Thanks.

Anton Tananaev 3 days ago

You can map external config file like this:

volumes:
  - /opt/traccar/conf/traccar.xml:/opt/traccar/conf/traccar.xml:ro

For geocoding settings see this:
https://www.traccar.org/reverse-geocoding/

Eric 3 days ago

Is https://github.com/traccar/traccar/blob/master/setup/traccar.xml a valid working example, the default which is in the docker???? I can copy that file to my local /opt/traccar/conf/ folder??

Anton Tananaev 3 days ago

You can copy that. But also for Docker Compose it's better to use environment variable instead of changing config via XML.

Eric 3 days ago

Easier sad than done! How do I do that if I am going to run the Traccar Geocoder docker too? I can't find examples for both docker compose files that combine those.

Anton Tananaev 3 days ago

Have you checked the documentation here?

https://www.traccar.org/configuration-file/

Eric 3 days ago

I noticed that too. I'm going to try it. I will keep the config file traccar.xml inside the docker. I understand that is the best. Pure working with environment variables.
Thanks.

Eric 2 days ago

It's up and running now but I have problems with automatically displaying the address.

My compose file:

environment:
  CONFIG_USE_ENVIRONMENT_VARIABLES: "true"
  GEOCODER_ENABLE: TRUE
  GEOCODER_TYPE: nominatim
  GEOCODER_URL: http://192.168.1.200:3000/reverse
  GEOCODER_KEY: 3bd9b5d95df656244ecfa06698b1f5ac
  GEOCODER_ONREQUEST: "false"
  GEOCODER_IGNOREPOSITIONS: "false"

And still the "Positions" report doesn't display the address but the coordinates, also for newly reported positions.
In my case it doesn't matter what the last two environment variables are. The "Positions" report is always showing coordinates. If I press on the coordinates it's displaying the address. The "Trips" report is always displaying the address. So is Traccar even using the two environment variables???

I am for sure my traccar geocoder works because when I change the IP address it doesn't work anymore.

Eric 2 days ago

It's working:

Environment variables are not the same as the XML syntax!!!

  GEOCODER_ON_REQUEST: TRUE
  GEOCODER_IGNORE_POSITIONS: FALSE

Missing dots in documentation :-( :-(
So I was also missing the underscore too.

Please check documentation!

Anton Tananaev 2 days ago

Missing dots in documentation :-( :-(

There are no missing dots. And you need to check documentation more carefully.

To convert config key to an environment variable key replace dots with underscore and convert the rest to screaming snake case. For example, mail.smtp.fromName will be MAIL_SMTP_FROM_NAME.

You have to convert camel-case to snake case. See the example.

Eric 2 days ago

Okay, my English is not the best but this is not understandable for a Dutch guy. Sorry. Try to translate it with Google Translate. LOL.
I thought the example was wrong. It's all not very clear. Sorry.

Anton Tananaev 2 days ago

Why did you think the example was wrong when you confirmed that it was working exactly as documented? And you still posted a comment even after that.

Eric 2 days ago

You don't understand me. I thought the mail.smtp.fromName -> MAIL_SMTP_FROM_NAME was wrong. I thought it was missing a dot or had an underscore to much. I searched the internet for examples for GEOCODER_ON_REQUEST and GEOCODER_IGNORE_POSITIONS because traccar didn't response to changes. I never confirmed it was working exactly as documented. I am an ICT guy and do a lot with dockers but camel-case and snake case is new for me. I searched for it now. If you read this for the first time and try to translate is you will never find out what it is and what you mean. Maybe include some extra info about it .
Thanks.

Anton Tananaev 2 days ago

I understand that you originally thought it was wrong. But then didn't you find out that it works exactly like in the documentation? Exactly like in the example provided?

Eric 2 days ago

Not if you never heard about camel case and snake case! In that situation it's almost impossible to understand it.