Traccar Server at App Engine Google Cloud

Everton15 days ago

Hello.

In resume, I running traccar-server at App Engine. My server working localy, but at App Engine dont work. Why? Help me, please.

Anton Tananaev15 days ago

What's the error? How are you running it on app engine?

Everton15 days ago

Whats Error:

  • I try to access with 'https://myproject.ue.r.appspot.com/'
  • after trying to hit api/server the browser tries to connect until it stops and shows 'Service Unavailable'.
  • in the Browser Console 'Failed to load resource: the server responded with a status of 503 ()'
  • error in GCP logs:
{
   "protoPayload": {
     "@type": "type.googleapis.com/google.appengine.logging.v1.RequestLog",
     "appId": "p~myproject",
     "versionId": "20240417t205113",
     "requestId": "6620798c00ff04fa12b1dfd09410001707e6c6f63616c697a656175746f0001323032343034313774323035313133000100",
     "ip": "191.53.211.192",
     "startTime": "2024-04-18T01:38:20.389801Z",
     "endTime": "2024-04-18T01:42:20.942344Z",
     "latency": "240.552543s",
     "megaCycles": "192156",
     "method": "GET",
     "resource": "/favicon.ico",
     "httpVersion": "HTTP/1.1",
     "status": 503,
     "responseSize": "79",
     "referrer": "https://myproject.ue.r.appspot.com/",
     "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
     "urlMapEntry": "auto",
     "host": "myproject.ue.r.appspot.com",
     "wasLoadingRequest": true,
     "instanceIndex": -1,
     "finished": true,
     "instanceId": "00a22404dcd56dfecad93197d6c0ab4dffbbb0ee711e226ddb1c7335846d1b15ff971c6afcd5f1b1fc2dffa9a95213f04656da05b3a196af452ff09366065a66",
     "line": [
       {
         "time": "2024-04-18T01:42:20.941791Z",
         "severity": "INFO",
         "logMessage": "This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application. "
       },
       {
         "time": "2024-04-18T01:42:20.941791Z",
         "severity": "ERROR",
         "logMessage": "The request failed because the instance failed the readiness check."
       }
     ],
     "appEngineRelease": "1.9.71",
     "traceId": "260b7a87be429372737f727f0e195f79",
     "first": true,
     "traceSampled": true,
     "spanId": "11355357997948507667"
   },
   "insertId": "66207a7c000e617fa6e6cf0c",
   "httpRequest": {
     "status": 503
   },
   "resource": {
     "type": "gae_app",
     "labels": {
       "version_id": "20240417t205113",
       "project_id": "myproject",
       "module_id": "default",
       "zone": "us-east1-2"
     }
   },
   "timestamp": "2024-04-18T01:38:20.389801Z",
   "severity": "ERROR",
   "labels": {
     "clone_id": "00a22404dcd56eeecad93197d6c0ab4dffbbb0ee711e226ddb1c7335846d1b15ff971c6afcd5f1b1fc2dffa9a95213f04656da05b3a196af452ff09366065a66"
   },
   "logName": "projects/myproject/logs/appengine.googleapis.com%2Frequest_log",
   "operation": {
     "id": "6620798c00ff04fa12b1dd09410001707e6c6f63616c697a656175746f0001323032343034313774323035313133000100",
     "producer": "appengine.googleapis.com/request_id",
     "first": true,
     "last": true
   },
   "trace": "projects/myproject/traces/260b7a87be429372737f727f0e195f79",
   "receiveTimestamp": "2024-04-18T01:42:20.944369785Z",
   "spanId": "11355357997948507667",
   "traceSampled": true
}

How running:

  • I change the .xml, putting my database data.
  • I don't configure anything else in App Engine.
  • in cloud-init.yaml I run it like this:
#cloud-config

write_files:
   - content: |
       <?xml version='1.0' encoding='UTF-8'?>
       <!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
       <properties>
         <entry key='config.default'>./conf/default.xml</entry>
         <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
         <entry key='database.url'>jdbc:mysql://myip-mysql:3306/dev?useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode= ''</entry>
         <entry key='database.user'>myuser</entry>
         <entry key='database.password'>mypass</entry>
         
       </properties>
     path: /conf/traccar.xml

runcmd:
   - java -jar target/tracker-server.jar conf/default.xml
  • I create an app.yaml in the root of the project like this:
runtime: java17

handlers:
- url: /.*
   script: auto

I saw this.

Anton Tananaev15 days ago

Can you please properly format your posts with markdown to make it readable. And you would also need to get proper command line output and logs. What you provided as GCP logs doesn't have any useful information at all.

Everton15 days ago

I don't get errors after running 'gcloud app logs tail -s default'
Just a warn:
2024-04-18 11:29:19 default[20240417t224026] 2024-04-18 11:29:19 WARN: Failed to find a usable hardware address from the network interfaces; using random bytes: 05:bc:fe:33:9e:82:2a:22

As I don't get an error, I believe it is an error in GCP. The complete log is what I posted previously, which was unconfigured because I didn't know how to configure it here on the forum.

Anton Tananaev15 days ago

It seems like they don't provide a network interface to listen on.

Anton Tananaev15 days ago

Actually wait. This message is irrelevant to the problem.

Everton14 days ago

In the App Engine logs I only see this as a possible error:

latency: "241.451740s"
line: [
0: {
logMessage: "This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application."
severity: "INFO"
time: "2024-04-19T10:39:54.376045Z"
}
1: {
logMessage: "The request failed because the instance failed the readiness check."
severity: "ERROR"
time: "2024-04-19T10:39:54.376045Z"
}]

The error 503.

I see that every time I tap it restarts the application. Locally runs without erros.
It doesn't seem to be an error in the application, but rather in GCP. I came to GCP because on VPS Dime I couldn't configure it to run with https

Anton Tananaev14 days ago

You can just use Cloudflare for HTTPS.