AWS Open Source Blog
Pipelines For Container Applications Made Easy with mu
Amazon Elastic Container Service (ECS) is a great way to deploy containerized microservices. mu is an open source tool from Stelligent that makes it easier for developers to get started with microservices on ECS, by simplifying the declaration and administration of the AWS resources required for the ECS cluster, using a CLI. In addition, it creates a deployment pipeline using AWS CodeBuild and AWS CodePipeline. In this guest post, Casey Lee of Stelligent explains how you can easily create such a pipeline using mu.
Amazon Elastic Container Service makes it possible to run container workloads at scale. Additionally, developers can leverage services such as AWS CodeBuild and AWS CodePipeline for orchestrating the build and deployment of their container applications. All the building blocks are available to create continuous delivery pipelines that quickly and consistently deliver value to users. However, there is a significant learning curve for developers to efficiently and effectively configure all these different AWS services to work together.
In this post, we’ll be looking at mu, an open source tool that simplifies the declaration and administration of the AWS resources necessary to create continuous delivery pipelines for container workloads. It codifies best practices as opinionated default configuration, making it possible to set up a robust pipeline for your application in a matter of minutes. Let’s jump right in and see it in action.
mu manages three primary components:
- Environments – an environment includes the network (VPC) and cluster of hosts (ECS container instances) necessary to run containers. The environments include the ability to automatically scale out or scale in based on resource requirements across all the microservices that are deployed to it. Many environments can exist (e.g. development, staging, production).
- Services – a container application that will be deployed to a given environment (or environments) as a set of containers.
- Pipeline – a continuous delivery pipeline that will manage the building, testing, and deploying of a service in the various environments.
See mu in Action
For the purposes of demonstration, we will be using a simple NGINX application. The source for the application is available at https://github.com/cplee/hello-nginx and consists of the following Dockerfile:
FROM nginx:stable-alpine COPY health /usr/share/nginx/html/health
The mu.yml file contains a minimal configuration necessary to create:
### # Define 2 environments ### environments: - name: acceptance - name: production ### # Configure the service with a route for paths /* # from the ALB to port 80 in the container ### service: port: 80 pathPatterns: - /*
Installation consists of simply downloading the compiled mu binary and adding it to your path:
curl -s https://getmu.io/install.sh | sh
The pipeline is created by running the following command. It will prompt you for a GitHub personal access token that CodePipeline requires to configure the commit hook.
mu pipeline up
Once the pipeline has been created, you can monitor the pipeline progress with mu:
You can also monitor the CloudWatch logs output from the CodeBuild project via mu:
The CloudWatch logs for the ECS service can be viewed via mu to monitor the application:
Details about the ECS cluster are viewable via mu. Additionally, you can determine the URL of the ELB to then test the application:
Why Open Source?
At Stelligent, we help our customers build continuous delivery pipelines on AWS. One of our core values is sharing. We want to be open with our customers and give them access to the tools we use on our engagements with them. By open sourcing mu, we are able to empower our customers to have a sense of ownership of the tool we are using in their accounts.
Another goal with creating and open sourcing mu was to share our learnings and opinions with the community on how best to implement these pipelines. Our hope is for the community to use the tool and evolve it based on their use cases and to provide feedback on even better ways to approach the problems we are trying to solve.
One last point about the open nature of mu: a guiding principle in the development of mu was to provide a lightweight means to configure AWS resources. The effect is that mu creates resources in AWS and then gets out of the way. You can keep using it after the pipeline is created, or abandon it and use traditional AWS tools (console or cli). The diagram below demonstrates how mu works by reading in a mu.yml and generating opinionated CloudFormation templates that are run in the AWS account:
Contribute to mu!
If you have an interest in continuous delivery pipelines for container workloads, we need your help! Here’s how:
- Try it out – Visit the quickstart on the mu wiki to download and install the tool. You can also follow a brief tutorial to create your first service.
- Share your feedback – Ask questions and let us know what you think by chatting with us on in our Gitter room. Also, don’t hesitate to create a new issue with any feature requests.
- Submit a pull request – Pull requests always welcome! Visit the contributing guide for more details.
Casey Lee is the Chief Architect at Stelligent – a Premier Consulting Partner with the DevOps Competency that has been implementing Continuous Delivery solutions on AWS since 2009. He is an AWS Certified DevOps Engineer – Professional and Solution Architect – Professional. He has spent the past 20 years architecting, implementing, and supporting software systems for organizations ranging from startups to Fortune 500 enterprises.
The content and opinions in this post are those of the third-party author and AWS is not responsible for the content or accuracy of this post.