Modern UI and backend connection

marcm4 years ago

Hello, I have been trying the modern interface with a traccar backend and it works all fine with using development mode;
npm start
and having the localhost:8082 in the .env.local file.

It is working well and I really like the new simple interface and wanted to try it using webserver.

When I build and deploy to webserver on the same machine I cannot login. Is there something I need to change before doing the build and deploy to get the login and data exhange to work properly just like in development ?

Thanks
Marc

Anton Tananaev4 years ago

You should probably provide details on how exactly you build and deploy it. Especially not sure what you mean by deployment on a webserver. It is intended to be deployed on Traccar, not a traditional generic web server.

marcm4 years ago

I built by using;
npm run build

Configured nginx to host website in /var/www/html folder.
rsynced the contents of the build folder to /var/www/html folder and I get the modern login page as expected.
My traccar instance is running as a service and is installed to /opt/traccar/

I would like to have both traccar UI on port 8082 and modern on port 80 available because not all options are working in the modern interface.

Thanks
Marc

Anton Tananaev4 years ago

I'm kind of confused because Traccar already has both interfaces. You don't need to build anything to make it available. That's one.

Also, you haven't mentioned how you make API available for the new web interface. Do you have proxy configured? That's the kind of details I asked for.

marcm4 years ago

I have an old install of traccar installed using the zip file
traccar-linux-64-4.6

It has been running reliably for 2 years and I thought I could use the modern web interface to work with it.

Currently traccar is accessed using the server ip with port 8082 and when I tried the modern interface by cloning the git repository, installing nodejs and running the debug server with npm start I could access the modern interface using port 3000.

There is a proxy (nginx) set up to allow me to serve the traccar modern from its html folder if it is possible to serve it and connect to the traccar instance that is already installed and running on the machine.

I should be able to take the git repository for the web interface and deploy to traccar server.

Just looking to some guidance if this can be done or do I have to install a newer version of traccar release ?

Anton Tananaev4 years ago

The easiest option is to just put modern stuff under modern subfolder in Traccar web app and it should work. If you want to do something more advanced, I would recommend reading about Create React App.