πŸ“£ Limited offer: subscribe to cloudonaut plus, get a t-shirt for free

πŸ“£ Limited offer: free cloudonaut t-shirt

Checklist: Is your application ready for a container cluster?

Andreas Wittig – 28 Nov 2019

Is your application ready to run on a container cluster? Use this checklist to find out whether you are good to deploy your application on Amazon Elastic Container Service (ECS) and AWS Fargate or any other container cluster solution.

Checklist

Does your application fulfill the following five requirements?

βœ… Stateless: avoid persisting data

Your application (call it a microservice if you want to) is stateless. Answering a request or processing a job does not rely on reading data stored by previous requests or jobs. This applies to data from memory as well as a local disk.

Instead of that, your application stores data in a SQL/NoSQL database (e.g., RDS or DynamoDB), an in-memory database (Elasticache), or any other fully-managed storage service (e.g., S3).

βœ… Logging: write to stdout and stderr

Your application writes log messages to standard output (stdout) and standard error (stderr). Do not write log messages to files. (see Stateless). Docker has built-in support to ship log messages from stdout and stderr to various centralized logging solutions (e.g., CloudWatch Logs). Check out A simple way to manage log messages from containers: CloudWatch Logs to learn more.

βœ… Configuration: use environment variables

Your application reads configuration parameters from environment variables (e.g., the database endpoint or any other service endpoint). Do not use files to store the configuration for your application.

Special offer: cloudonaut t-shirt

Do you love our blog posts and podcast episodes? Unlock our weekly videos and online events by subscribing to cloudonaut plus.

Special offer: Join cloudonaut plus before November 30th, and we will send you a cloudonaut t-shirt for free.

Subscribe now!

Use a templating engine for configuration files if you are containerizing a legacy application. I prefer envsubst to do so. Alternatively, you could have a look at Dockerizing legacy applications with confd.

βœ… Process: restrict to one process

Your container starts exactly one main process. If your application consists of more than one process, split them up into multiple containers. For example, if you run NGINX and PHP-FPM, create two containers.

βœ… Remote access: disable SSH

Your container does not start an SSH daemon. Do not install or enable SSH within a container (see Processs). Use docker attach to log into a container if needed for debugging. On top of that, optimize your logging.

βœ… Shutdown: avoid canceling requests and jobs

Your application receives KILL signals and shuts down gracefully. Test whether the KILL signal triggered by docker kill leads to your application stopping to answer new requests or start new jobs and terminate after the last request or job has been completed.

  • Does your Dockerfile contain ENTRYPOINT or CMD in shell form? Your main process will not receive any KILL signals.
  • Are you starting your main process from a shell script? Make sure you are using exec to do so.

When using Fargate it is necessary, that your application is able to shutdown gracefully within 2 minutes.

πŸŽ‰ Summary

Checked all five requirements from the checklist? Happy you! Your application is ready for ECS and Fargate or any other container cluster solution.

πŸ“š eBook and Online Seminar

Do you want to learn more about how to ship your application with Docker? Our ebook and online seminar Rapid Docker on AWS teaches you how to dockerize PHP, Ruby on Rails, Python Django, Java Spring Boot, and Node.js Express applications.

Andreas Wittig

Andreas Wittig

I’m an independent consultant, technical writer, and programming founder. All these activities have to do with AWS. I’m writing this blog and all other projects together with my brother Michael.

In 2009, we joined the same company as software developers. Three years later, we were looking for a way to deploy our softwareβ€”an online banking platformβ€”in an agile way. We got excited about the possibilities in the cloud and the DevOps movement. It’s no wonder we ended up migrating the whole infrastructure of Tullius Walden Bank to AWS. This was a first in the finance industry, at least in Germany! Since 2015, we have accelerated the cloud journeys of startups, mid-sized companies, and enterprises. We have penned books like Amazon Web Services in Action and Rapid Docker on AWS, we regularly update our blog, and we are contributing to the Open Source community. Besides running a 2-headed consultancy, we are entrepreneurs building Software-as-a-Service products.

We are available for projects.

You can contact me via Email, Twitter, and LinkedIn.

Briefcase icon
Hire me