Home / Google Cloud / Run containerize app in Google App Engine

Run containerize app in Google App Engine

Last updated on May 11th, 2023

Estimated reading time: 4 minutes

In this tutorial you will learn to deploy and run containerize application in google app engine flexible environment.

Google App Engine

Google app engine lets app developers build scalable Web and Mobile backends in any programming language on a fully managed server less platform.

Supports

  • GO,Java,.NET Node JS, Python, and Ruby using pre-configured Runtime.
  • Use custom runtime(Containers) and write code in any language.
  • Easy connectivity with cloud services (Cloud SQL etc.)

No Usage Charges

Pay for use(Automatically scales depending on app traffic)

Features

  • Automatic load balancing and Auto scaling
  • Managed platform updates and application health monitoring
  • Application versioning
  • Traffic Splitting

Compute engine vs GAE

Compute EngineApp Engine
IAASPAAS
More Responsibility to choose hardware, memory and Image Lesser Responsibility, Developers focus only on code. Infrastructure managed by Google
Fine grain access controlsNo fine grain access
Compute Engine VS Google App Engine

App Engine Environments

Standard – Application runs in language specific runtime

  • Complete isolation from OS.DISK

V1:Java,Python,PHP,GO(Older versions)

Restricted network access for python and PHP runtime

V2:Java,Python,PHP,GO(newer versions)

Full network access and no restrictions.

Flexible: Run Application instances as Docker containers

  • Makes use of compute engine VM in
  • Supports any runtime with built-in support for Python,Java,Node.js,Go,Ruby,PHP,.NET

App Engine Scaling Instances

Automatic – Scale based on Instance load

  • Continuously running workloads

Auto Scale based on

  • CPU Utilization
  • Throughput utilization
  • Concurrent Users

Basic – Instances are created when requests are received

  • Instances are shut down to Zero When there is no traffic
  • Not supported by APP Engine flexible

Manual – configure the number of Instances

Adjust number of instances manually over a period of time.

Application Component Hierarchy

Google App Engine flow
Google App Engine Flow

Under each GCP Project there is only one App engine application. Application can have 1 or more services. Multiple version of the same service can run in parallel. For each version of the service there could be 1 or more instances running.

Deploy .NET 6 workloads to Google App Engine

Deploy .NET 6 workloads to GAE 

Google App engine supports .NET workloads using Flexible Environment. In this article we will first create custom image using Docker and push it to google container Registry.

If you are new to app containerization refer our article on Containerizeย a .NET 6 Application And Publish A Docker Container Image To google cloud registry – Full Stack Tutorials Hub

Configure app.yaml file for .NET Project. App.yaml file has the required configuration that would be used by cloud build to deploy work loads to GAE.

env: flex

Note: Google app engine API and App Engine Admin API must be enabled. App engine account must have read access to Google container Registry. Cloud accounts and access can be managed using IAM module.

Deploy Application image to GAE 

gcloud app deploy --image-url=gcr.io/buildcustomimage/custom-image:0.1

Navigate to the Google App engine, and you will see a new default service created,

Get Application URL 

gcloud app browse

Once Application deployment is complete in app engine dashboard we can see new service.

App Engine Service

Application is running as container in Google App Engine

Default service currently has 1 version running. Click on the service and it will navigate you to specific version of the service V1.V1 is configure to use 2 instances.

Version V1

Auto scaling, health monitoring can be configured using app.yaml file.

runtime: custom
api_version: '1.0'
env: flexible
threadsafe: true
automatic_scaling:
  cool_down_period: 120s
  min_num_instances: 2
  max_num_instances: 20
  cpu_utilization:
    target_utilization: 0.5
liveness_check:
  initial_delay_sec: '300'
  check_interval_sec: '30'
  timeout_sec: '4'
  failure_threshold: 4
  success_threshold: 2
readiness_check:
  check_interval_sec: '5'
  timeout_sec: '4'
  failure_threshold: 2
  success_threshold: 2
  app_start_timeout_sec: '300'
service_account: onyx-park-380809@appspot.gserviceaccount.com
Scroll to Top