STEPHANIE WONG: Hi, I'm Stephanie
and today I'll show you how you can
run your functions in any language as serverless code
on Google Cloud.
No matter if you're a Ruby, .NET, Java, PHP, Python,
or Go developer, fear no more.
You can now seamlessly deploy your function to Cloud Run.
In the last year, the Serverless team
has been working to support developers,
no matter which language they use.
In fact, we have seven plug-and-play libraries that
allow you to run your code, in any language,
functions-as-a-service stat.
Last year, we launched Cloud Run, a fully managed serverless
compute platform based on Docker.
It automatically scales and load balances your stateless
containers while language client libraries automatically work.
You pay per request, so you can do what matters most--
build great applications.
We've now open-sourced a framework
that powers Google Cloud functions,
called the Functions Framework.
It's a set of open-source libraries
that minimizes the amount of boilerplate and configuration
needed from you to create a runable, stateless container.
In fact, this framework is a dependency
that's used in Cloud functions.
So you'll get the exact same core runtime
environment and behavior.
It handles-- setting up a web server,
adding routing to the server, and invoking
function code in response to an HTTP request or a CloudEvent.
What this means is you can simply
install the Functions Framework library
for the language of your choice and write a function.
You don't need to emulate your function when testing locally.
Let's dive into each language.
The Node Functions Framework uses Express.js under the hood,
adopts Node's event-based model that's asynchronous,
has non-blocking I/O, and supports
promises for handling requests, and is an excellent choice
for scaling apps both horizontally and vertically.
The Go Functions Framework uses the native HTTP Package
for handling requests and responses,
provides excellent cross-platform support
and static type-checking for your function.
And it's a great option for raw performance and computation.
The Java Functions Framework uses Java and Maven
for building and deploying functions from source.
It's not limited to Java, meaning
you can use different JVM languages, such as Kotlin,
Groovy, and Scala.
You can use a Maven plugin and run mvn function:run to run
locally and mvn function:deploy to deploy.
And it's supported by frameworks like Spring Cloud
Function and Micronaut.
For Python users, the Function Framework
uses Flask, a popular Python web framework, under the hood.
By default, it uses Gunicorn as an HTTP server,
but also provides a WSGI app so you
can use any HTTP server that supports WSGI.
And it's installable from PyPI with "pip
install functions-framework."
The Ruby Functions Framework uses a standard Ruby Rack
interface for HTTP requests and CloudEvents.
You can install your own bundle and access all the libraries
and capabilities of the Ruby ecosystem.
And it has built-in helpers for building test fixtures
and invoking functions in a test environment.
The .NET Functions Framework is built on ASP.NET Core
in an idiomatic way, incorporating familiar
dependency injection.
The templates are distributed as NuGet packages.
Just use dotnet new to get started.
And it includes a dedicated testing package
so you can write unit and integration tests easily.
The PHP Functions Framework is usable with PHP's built-in
server, supports symphony/http-foundation,
and will soon support PSR-7.
You can install your own packages
and access all the libraries and capabilities of the PHP
ecosystem.
Keep in mind, you are not limited to these languages.
Any language that can be run in a Docker container
can be deployed to Cloud Run.
Once you've built your application with the Functions
Framework, Cloud Run lets you get your code
into production in seconds.
Just run a gcloud command to deploy your stateless
container, and Cloud Run will do the rest.
Listen to requests and events, pass them to your code,
and scale them up and down to meet user demand.
With the Functions Framework, you
can run your applications as serverless code
in any language, port workloads across any serverless platform
with an open-source framework in Docker,
and spin up a local development server for quick testing.
Check out cloud.google.com/run to learn more.
[MUSIC PLAYING]