Deploy locally on windows

chandra4 years ago

Hello again, glad to say that I already successfully setup the traccar on my VPS. But now I need to modify the login page on the web interface. So I tried to setup the project on my Windows 10 localhost. Here are what I did :

  1. Following the instruction here : https://www.traccar.org/build/ I clone the repo to my windows PC.
git clone --recursive https://github.com/traccar/traccar.git
  1. After the project cloned to my pc, I tried to do npm install on traccar-web folder. Here is the result :

https://imgur.com/85BWD6h

  1. Following the instruction here https://www.traccar.org/build-in-intellij-idea/ , here is my Run configuration :

https://imgur.com/HoMI6nJ

  1. And then run the configuration :
1:52:30 PM: Executing :Main.main()...

> Task :extractIncludeProto
> Task :extractProto
> Task :generateProto

> Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :processResources
> Task :classes

> Task :Main.main()
2021-12-11 13:53:20  INFO: HikariPool-1 - Starting...
2021-12-11 13:53:21  INFO: HikariPool-1 - Added connection conn0: url=jdbc:h2:./target/database user=SA
2021-12-11 13:53:21  INFO: HikariPool-1 - Start completed.
2021-12-11 13:53:21  INFO: Set default schema name to PUBLIC
...
2021-12-11 13:53:38  INFO: Starting server...
2021-12-11 13:53:38  WARN: Port 5040 is disabled due to conflict
2021-12-11 13:53:38  INFO: jetty-10.0.6; built: 2021-06-29T15:28:56.259Z; git: 37e7731b4b142a882d73974ff3bec78d621bd674; jvm 15.0.5+3-MTS
2021-12-11 13:53:39  INFO: Started o.t.w.@6c0b51da{/,null,AVAILABLE}
2021-12-11 13:53:39  INFO: Session workerName=node0
2021-12-11 13:53:40  WARN: JAXBContext implementation could not be found. WADL feature is disabled.
2021-12-11 13:53:40  INFO: Started o.e.j.s.ServletContextHandler@2f038d3c{/,null,AVAILABLE}
2021-12-11 13:53:40  INFO: Started ServerConnector@51a6cc2a{HTTP/1.1, (http/1.1)}{0.0.0.0:8082}
2021-12-11 13:53:40  INFO: Started Server@2f9a10df{STARTING}[10.0.6,sto=0] @21849ms

5 . Finally i tried to access the web interface from browser

https://imgur.com/rsp6hH4

What did I miss? Please assist me, thanks in advance for the great project!

Anton Tananaev4 years ago

You need to install dependencies:

https://www.traccar.org/build-extjs/

chandra4 years ago

Thanks for the fast reply, I guess I have to do this :

sudo add-apt-repository ppa:openjdk-r/ppa
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt update
sudo apt install -y git openjdk-11-jdk unzip nodejs

but I don't khow how to do that on windows. But I already have git, openjdk, and nodejs on my windows..

chandra4 years ago

but for the npm install, I get this.

npm install

Anton Tananaev4 years ago

You need bash to run it.

chandra4 years ago

Thanks! after installing bash following this tutorial https://itsfoss.com/install-bash-on-windows/ , now I can access traccer on my local windows.

Have a good day!

chandra4 years ago

Sorry, one more thing. I am able to access the web interface at localhost:8082.

Now I am trying to access the modern interface. I change the web.path config from ./traccar-web/web to ./traccar-web/modern

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./setup/default.xml</entry>

    <entry key='web.path'>./traccar-web/modern</entry>
    <entry key='web.debug'>true</entry>
    <entry key='web.console'>true</entry>

    <entry key='logger.console'>true</entry>

    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:./target/database</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'></entry>

    <entry key='atrack.custom'>true</entry>
    <entry key='intellitrac.port'>6037</entry>

</properties>

here is what I get now..

403

What am I missing?

Anton Tananaev4 years ago

Have you compiled it?

chandra4 years ago

in modern folder here what I did :

$ npm run build
.....
.....
.....

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  serve -s build

Find out more about deployment here:

  bit.ly/CRA-deploy

It is still 403 forbidden..

chandra4 years ago

and I also did this.

$ serve -s build

Serving!                                         │
   │                                                    │
   │   - Local:            http://localhost:3000        │
   │   - On Your Network:  http://192.168.100.84:3000   │
   │                                                    │
   │   Copied local address to clipboard!

it only shows blank page when I access localhost:3000, with this error on browser console

logger.mjs:44 workbox Precaching is responding to: /static/css/main.19c2b201.chunk.css
logger.mjs:44 workbox Precaching is responding to: /static/css/2.e7e1d566.chunk.css
logger.mjs:44 workbox Precaching is responding to: /static/js/2.25d7e9e1.chunk.js
logger.mjs:44 workbox Precaching is responding to: /static/js/main.d64584f3.chunk.js
serviceWorker.js:44 This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA
VM71:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

7Fetch finished loading: GET "<URL>".

at http://localhost:8082 it is still forbidden

Praveenkumara year ago

Hello Anton Tananaev!
we have struggle this process Kindly share reference video for local deployment

Anton Tananaeva year ago

Are you happy to sponsor the work of preparing the video?

Praveenkumara year ago

what kind of sponsors are need for preparing the video?

Anton Tananaeva year ago

If you're interested in sponsoring the work, send us an email.

Praveenkumara year ago

we are interest