Thursday, April 20, 2023

Blast from the past: Procfile for Python cloud apps

One of my first cloud apps

Recently, I tried out a feature of IBM Cloud Code Engine: Deploying my app directly from source code. It was a simple app, but it failed. I was stunned and investigated the problem. To my surprise, I could have known it because it was something from the past: A Procfile was needed.

Deploy from source with buildpacks

The above screenshot is taken from a blog post I wrote nine (9!) years ago: Some fun with Bluemix, Cloud Foundry, Python, JSON and the Weather. In the article, I describe what is needed to get my app ready for running in the cloud. Some scripting needs to prepare the runtime environment and that magic is called buildpack. That link leads to the description of buildpacks in the Cloud Foundry documentation. Today, I would link to buildpacks.io:

Cloud Native Buildpacks transform your application source code into images that can run on any cloud.

Buildpacks are available for many programming languages. And you can even develop (and bring) your own buildpacks. Buildpacks turn app code into executable container images. As a starter, follow An App's Journey from Source to Image. There is a registry to search for available buildpacks. IBM Cloud Code Engine is using paketo.io buildpacks.

Procfile with start command

Typically, there is not much needed to build an image from your source code and to be able to run the image. For some programming languages, start commands are specified in some standard module definitions. For my Python project, I needed to add a Procfile. It is the same as it was required nine years ago...

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik), Mastodon (@data_henrik@mastodon.social), or LinkedIn.