Deploying a service to the flexible environment

Services built for the flexible environment are deployed in a similar manner as the standard environment, using the same gcloud app deploy command. Building on previous examples, a simple Node.js implementation of the colors service has been provided using a custom runtime. To deploy this service, go to chapter_04/example_04 in this book's source code and run:

gcloud app deploy app.yaml

You will notice that the deployment process for this service is much slower than in earlier examples. This is largely due to the fact that App Engine must build a new Docker image for the service and provision a Compute Engine VM, both of which take a non-trivial amount of time.

Keep this startup time in mind when considering the scaling potential of services running in the flexible environment. A slower startup time will directly affect how quickly these services are able to scale in response to sudden increases in traffic.

Once the service has been deployed, it can be managed through similar means as our examples using the standard environment. Services can be started and stopped on a per-version basis, and traffic can be split between services running in either environment. Building on our previous example on splitting network traffic, we can now split traffic to our colors service three ways between the Go version, the Java version, and the new Node.js version running in the flexible environment, illustrated as follows:

Splitting traffic between all three versions of the colors service