24

How can I deploy multiple applications from same or different language/runtime originating from a single project in google cloud app engine?

7
  • So what's the question? Commented Sep 4, 2017 at 13:49
  • sorry for the misleading language. Just edited. Commented Sep 4, 2017 at 13:52
  • Also check if that wouldn't be in violation of section 3.3 (d) of the Terms of Service: cloud.google.com/terms Commented Sep 4, 2017 at 13:53
  • Think not, because I dont intend "to simulate or act as a single Application, Account, or Project (respectively) or otherwise access the Services in a manner intended to avoid incurring Fees;". I would still want to deploy it as two different apps, with different versions accessible with different URLs. Secondly, google cloud does provide the facility to deploy multiple services on a project: cloud.google.com/appengine/docs/standard/python/… Commented Sep 4, 2017 at 14:09
  • OK. But you need to give a lot more details. Do you want multiple services? Multiple apps? What's your app doing? What are the difficulties? Otherwise the answer is simple (and likely useless): Yes - you just re-write/adjust your app code as needed :) But note that depending on your app specifics it might not be possible or it might require a lot of work. For example sharing the datastore across multiple apps require extra work, task enqueueing across apps is impossible. Commented Sep 4, 2017 at 14:19

2 Answers 2

37

Deploying Multiple Services to Google Cloud App engine.

Create the following files in the app root directory

Create app.yaml file with content:

runtime: nodejs14
service: default

Create myserviceone.yaml file with content:

runtime: nodejs14
service: myserviceone

Create myservicetwo.yaml file with content:

runtime: nodejs14
service: myservicetwo

Deploy using command

gcloud app deploy --project your_project_id app.yaml myserviceone.yaml myservicetwo.yaml

This will deploy the default service as well as my service one and my service two. Check out your cloud console.

You can access them using:

https://myserviceone-dot-yourProjectID.appspot.com/ or http://myserviceone.yourProjectID.appspot.com/

https://myservicetwo-dot-yourProjectID.appspot.com/ or http://myservicetwo.yourProjectID.appspot.com/

Sign up to request clarification or add additional context in comments.

2 Comments

Any specific reason why google doesn't allow to specify multiple services (comma seperated or other seperator) in same app.yaml file to deploy code to multiple services?
what about composer.json and vendor? Should there be a single vendor repo common to all services, located at the top level?
25

Today, App Engine has a one-to-one correspondence with a Google Cloud Console project. You cannot deploy multiple "apps" in the same project. However, you might still be able to do what you want depending on your application(s).

App Engine has the concept of "services," which are independent aspects of your application. Your App Engine app can have many services and each service can have its own language/runtime and even be on different App Engine environments.

You could have say a Python service on App Engine standard environment that is used to serve your simple Flask site, could have service that serves an API written in Java 8 on the Standard Environment, and could have yet another service in say Node.js running in the App Engine flexible environment.

Your "default" service is defined in your app.yaml file. Your other services can be defined in different folders and can have either an app.yaml with their service definitions or you could name them something else like backend.yaml. See this simple Python project for the layout of the configuration files.

For more conceptual information about services on App Engine, see Microservices Architecture on Google App Engine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.