Local development environment for Traccar

dit ap5 years ago

Hi Traccar admins, thanks for working hard building this project!!

I've got couple of questions to you.
If I want to change something (Ex: data schema, codecs, or business process) then I need to run it on my local development.

So, how do you connect the GPS tracker to the local server when in development ?? Via local network??
And how do you test the many OBD devices?? Do you plug it in real cars?? Mocking it??

I really want to know, how traccar developers/maintainer, test their device and server logic when in development, especially if multiple developers works on it. Many Thanks!

Anton Tananaev5 years ago

There are scripts that can emulate devices, but most of the time we test using unit tests.

dit ap5 years ago

So for emulating devices. What are you using for emulating tcp connection.

Anton Tananaev5 years ago

Check scripts in the "tools" folder in the repo.

dit ap5 years ago

You're a big help, Thanks!!
Oh, and hey. If you dont mind.
https://github.com/dt-ap/traccar-react
I built a prototype for a modern traccar web. It's using some very opiniated library though.

Anton Tananaev5 years ago

Do you have a demo somewhere?

dit ap5 years ago

No. Its easy actually if you have a running server.

Just clone it. Install the depedencies via npm. Yarn does not work (do not know why).

Copy the .env file, then rename it to .env.local. Fill the url and ws url (ex: http://working.server.com:8082/).

For now, it's only able to login user and show tracked device position.

Karl.5 years ago

Hi dit,

I'm trying to get it setup but I'm having issues with CORS.

Do I have to make any changes to my tracking server?

Anton Tananaev5 years ago

If you want to add CORS headers, you need to add corresponding configuration parameters.

Karl.5 years ago

Thanks Anton I just had a quick search and found that config setting.

Is there any security implications of allowing this?

dit ap5 years ago

Hi karl.

There is an exploit (read it on the internet), if you allow CORS from all domain. But if you are only prototyping, you should not worry about that, for now.