The article provides some background to the example project hello-world-rs-gae. The project demonstrates how to deploy a simple "Hello World!" server on Google App Engine served by a static Rust binary.


Nowadays there is no longer need to supervise servers for providing a performant web application. Since containerization, Docker, Kubernetes and the like have become mainstream, more and more cloud providers offer managed solutions for hosting any type of container. Examples include AWS Elastic Beanstalk, nanobox.io and Digital Ocean's new managed Kubernetes service.

Another service I came across recently is Google App Engine. At first glance it seemed to target specific languages only, such as JavaScript, Python, Ruby, Go, etc. but, in fact, it supports any language you can think of -- as long as you can provide your application in a Docker container that serves a so-called "custom runtime".

So I thought this would be a great opportunity to run an actix server in a Rust runtime. It turned out not to be too simple because compiling a server based on actix takes some time. Regularly, compiling a simple hello world project in the Google Cloud ran into a timeout and the deployment of the application failed. This was when I got the idea to compile the project somewhere else (locally) and reduce the actual deployment in the cloud to a lightweight Docker container. In the container, the compiled binary serves as entry point for the application.

For the deployment to the cloud being fast and using the least resources possible, I decided to use rust-musl-builder and host the resulting binary in a scratch container. While I was quite skeptic about this idea in the first place, I turned out to work. And it is pretty useful because it offers a very simple way of hosting an automatically scaling REST endpoint that is light on resources.