Testing and Deploying your Application

Running locally

You run your application locally with the native development tools that you usually use.

For example, npm start.

Deploying your application

Deploy your app to App Engine using the gcloud app deploy command. This command automatically builds a container image by using the Container Builder service and then deploys that image to the App Engine flexible environment. The container will include any local modifications that you've made to the runtime image.

Deploying a service

You deploy your app to App Engine by deploying versions of your app's services and each of their configuration files.

To deploy a version of your app's service, run the following command from the directory where the app.yaml file of your service is located:

gcloud app deploy

Specifying no files with the command deploys only the app.yaml file of a given service. By default, the command automatically generates a unique ID for the version that you deploy, deploys your version to the Cloud Platform project which was used to initialize the gcloud tool, and also routes all traffic to that version.

You can change the default behavior of the command by targeting specific files or including additional command parameters:

  • To deploy the other configuration files of your service, you must target and deploy each file separately. Examples:

    gcloud app deploy cron.yaml
    gcloud app deploy dispatch.yaml
    gcloud app deploy index.yaml
  • To specify a custom version ID, include the --version flag.

  • To deploy your app without automatically routing all traffic to that version, include the --no-promote flag.

  • To deploy your app to a specific Cloud Platform project, include the --project flag.


gcloud app deploy --project [YOUR_PROJECT_ID] --version [YOUR_VERSION_ID] --no-promote

For more information about this command, see the gcloud app deploy reference.

Tip: You can set defaults for the gcloud tool and also create and manage SDK configurations.

Deploying multiple services

You use the same deployment commands for deploying or updating the multiple services that make up your application.

To deploy multiple services, you must separately deploy each service's app.yaml. Examples:

gcloud app deploy app.yaml
gcloud app deploy service2/app.yaml
gcloud app deploy app.yaml service2/app.yaml

Requirements for deploying multiple services

  • You must initially deploy a version of your app to the default service before you can create and deploy subsequent services.

  • The ID of each of your services must be specified in their corresponding app.yaml configuration files. To specify the service ID, you include the service: [YOUR_SERVICE_ID] element definition in each configuration file. By default, excluding this element definition from your configuration file deploys the version to the default service.

Manually building a container for deployment

To build your container images outside of Google Cloud Platform, you must first upload your images to a container image repository before you can deploy your images to App Engine with the gcloud app deploy command.

For example, if you build your container images locally with Docker, you can push those images to Google Container Registry and then specify the URL of your image in the --image-url flag of the command:

gcloud app deploy --image-url gcr.io/[MY_PROJECT_ID]/[MY_CONTAINER_IMAGE]

Docker base images for Node.js

If you'd like to build a Node.js custom runtime application from scratch, you can use this base image in a Dockerfile:

Runtime Docker command
Node.js FROM gcr.io/google-appengine/nodejs

Viewing your application

After you deploy your app to App Engine, you can run the following command to launch your browser and view the app at http://[YOUR_PROJECT_ID].appspot.com:

gcloud app browse

Send feedback about...

App Engine flexible environment for Node.js docs