0

I currently have an application running on Google App Engine Standard, nodejs10, let's call this App1. This app currently uses a CloudSQL database. I want to start adding other services that use the same data store and CloudSQL instance, because all of the apps are working with the same data.

App1 is currently live and working correctly. Obviously this has its own app.yaml that looks like this, it's the default service:

env: standard

resources:  
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

handlers:

  - url: /case/upsertCase
    static_dir: public
    secure: always

env_variables:

App2 has its own .yaml file called app2.yaml and it looks like this, this service is called app2:

service: app2
runtime: nodejs10
env: standard

resources:  
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

handlers:

  - url: /register/call
    static_dir: public
    secure: always

I deploy App1 with: gcloud deploy app I deploy App2 with: gclour deploy app app2.yaml

For some reason, when I try and hit app2-dot-app1.appspot.com/register/call I get a 500. When I try and hit https://app2.app1.appspot.com/register/call I get a 'Your connection is not private' error message.

Is it possible to run two services in the same app like this? I've set them to use the same port, is that correct?

I've been fiddling around with it and Googling\trawling SO, but I can't find an answer anywhere.

Jim Jimson
  • 2,368
  • 3
  • 17
  • 40

2 Answers2

1

Issues like the one stated in your situation occur once in a while. If you run into this issue again you may look into the following points below:

The reason you were hitting 500 error is due to the fact that something has gone wrong on the web site’s server, but the server cannot be more specific on what the exact problem is.

Some resolutions for this problem would include refreshing your webpage or simply coming back at a later time to access it again. Also, make sure that you have properly installed or updated the SSL certificate on your webpage. The link below provides more detail on such verifications: https://cloud.google.com/appengine/docs/standard/nodejs/securing-custom-domains-with-ssl You may want to look into your Stackdriver to have a better idea as to why this error is occurring in the first place: https://cloud.google.com/error-reporting/docs/viewing-errors

'Your connection is not private' error message appears because Google does not issue SSL certificates for double-wildcard domains hosted at appspot.com. This link provides a more thorough explanation on how to manage wildcard-mapping: https://cloud.google.com/appengine/docs/standard/nodejs/securing-custom-domains-with-ssl#upgrading_to_managed_ssl_certificates

Another thing to point out, if you have code in the applications top/root directory, above the services directory - the code within that directory may not be accessible to the services. The app2.yaml file in particular might be the actual cause of your problems. It might have interpreted as the .yaml file of the single service app. Check out the link provided for more details on this issue: Multiple Services in Google App Engine Python 3.7

In answering your question. According to the application hierarchy, you are in fact allowed to run multiple services on a single application (up to 5 services per application for free). You may want to take a look at the App Engine Overview for more information: https://cloud.google.com/appengine/docs/standard/nodejs/an-overview-of-app-engine

It is in fact possible to run the same port number on two different services on the same application.Since you are running different services in app engine, you are already running virtual machine instances within these services that contain different IP addresses. So long as the IP addresses are different you may use an identical port number for the two services. https://serverfault.com/questions/288850/running-two-services-on-port-80

Jan L
  • 261
  • 1
  • 5
0

So I came to the office this morning and saw an error:

Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x

Which wasn't occuring yesterday. So I made some changes to my .yaml file, which I'd already made yesterday as well to swap between node versions, from 10 to 12, and the page started working.

At the same time I did an upgrade of npm and node on my development machine, but didn't change any of the code in my app, apart from the change to the .yaml file.

So, I have no idea why it started working this morning, but it did.

Jim Jimson
  • 2,368
  • 3
  • 17
  • 40