Creating an Application using the Template
So when you use the Template by providing the configuration details, a new Application and several configuration objects are is created. Additionally, some of the Tasks are also executed to build and launch the Docker Container(s) in the Dev Stage of the Pipeline.
How to create an Application
First step in building/deploying a Docker based application using ECS is to create an Application in CloudMunch. Creating an application is as simple as following the steps in the Add Application wizard and filling in the appropriate configuration details. Check out how a DevOps Template is used to create an Application. Additionally, please review the requirements and assumptions for using this Template.
Creating the Application involves the following configuration steps
- Amazon ECS Template selection
- Application naming
- Source Repository
- Docker Compose file and ECS Task definition file paths
- AWS Elastic Container Registry details
- AWS Docker Host, ECS Cluster and ELB details
- Additional Application level Insights Sources configuration
- Sit back and relax!
Let's review each of these steps in details
Select the right DevOps Template
First step in adding an Application is selecting the Template to apply. You can review all the Templates that are available out-of-the-box.
You can see the details of each template along with a simple diagram explaining the Delivery Pipeline and what is included. Selecting a template shows the additional steps involved in customizing and configuring the application.
Scroll down and select the Multiple Containers on Amazon ECS Template.
Name the application
Next, let's set a name for the Application. You will be warned if there is already an application with the same name
Configure the Application Source Repository
All Templates require configuring the Code repository. Currently, only GitHub is supported. The next step includes selecting and configuring GitHub. We use OAuth as the authentication mechanism.
After you are successfully signed in to your account, you will be shown a list of repositories that you have access to and you will select the repository which has the requisite files to use ECS.
The selections you made in the two prior steps enabled adding an Integration for GitHub and updating the Tasks that use the source repository with the right Integration and repository configuration.
Configure Docker Compose and ECS Task definition file paths
The next step is to configure the location of the Docker Compose file (compose.yml) and ECS Task definition file (json file). This Template uses Compose to deploy the Application in Dev Stage and ECS for Test and Release. In this step, you provide the full path of the file starting with the repository name.
For example, if you repository name is wordpress and your Compose file is in the root, the Compose file location will be wordpress/docker-compose.yml. In general, any file path in the repository is a fully qualified name including the repository name.
Application centricity is at the core of CloudMunch. Regardless of whether you are building a Container based or VM based Application, it is critical to model your Application properly in CloudMunch. Based on the mapping that you provide, Roles are created in the Application in CloudMunch. That is the reason why you configure the mapping of roles in the Compose file to the corresponding roles in the ECS Task definition.
The Role information is carried forward into the Environments that are launched and all the Assets that are created are associated with the appropriate Roles. This enables creating Tasks that are applicable to a specific Role and executing those Tasks on an Environment. For example, you can create a Task to Scale Up/Down just the Web Role. So the Container role mapping field is expecting you to configure that mapping with the name of Container in the ECS Task definition to the corresponding one in the Compose file.
For example, if you containerDefinition in the ECS Task definition has a role as "name":"web-svr" and the compose.yml has the same role defined as "web", the mapping will be web-svr=web.
The selection in this step updates the Tasks that create the Environments in Dev, Test and Release Stages to use the appropriate files.
AWS Elastic Container Registry details
Next step is to configure the Registry to host your Docker Images. This Template uses AWS Elastic Container Registry (ECR) as the repository for the images created in this Application.
Please provide the repository URL for your registry. You can find the list of ECR repositories on the ECR console in AWS and select the repository you want to configure. In the repository details page, expand the "Build, tag, and push Docker image" section. In step 5 of the section, copy everything after "docker push" till the ":" and paste that in the Repository field.
This information will be used in the Build Tasks that create, tag and push the Docker Images to the Registry.
AWS Docker Host, ECS Cluster and ELB details
The last step is configuring Host and Cluster details. First, we will configure your AWS credentials. This adds/configures an Integration of type Amazon in the Application.
Since this Template uses Compose to create all the Containers on a single Host in the Dev Pipeline Stage, we will now configure that Docker Host. This Host is added as an Asset of type Server in CloudMunch. A Server Asset has the attributes of name, end-point URL, ssh user name and protocol to access any Containers launched on it. You will also upload the ssh key file Note: Ensure that ssh configuration of user, port and key are setup properly before getting to this step, because when you select Next, we will try to connect to the Server using the ssh credentials and verify the configuration.
Now that the Host for Dev stage is configured, we will configure the Cluster details for the Test and Release stages.
The next step will use this Integration to query ECS to list Clusters by the selected Region. You will be performing the Cluster configuration step once per stage, since it is good practice to have different Clusters for your Test and Release environments.
By selecting the AWS Integration and Region, the available ECS Clusters are listed and you can select the right one for the stage. The last step in this configuration process is to configure the ELB for your Application.
The Main Task that launches the Dev Environment, LaunchTestEnvironment and LaunchReleaseEnvironment Tasks are updated to use the appropriate configuration details.
Additional Application level Insights Sources configuration
Another key tenet in CloudMunch is end-to-end Application Insights. This means connecting all the tools that you use in your Application lifecycle to get feedback on your process and progress. You an select the tools from the provided list and configure the credentials for each of them.
Each tool is added as an Integration in the Application and the Tasks that pull data from these tools are updated to use the Integration.
Sit back and relax!
Now that you have provided all the required configurations, sit back and let CloudMunch take care of creating the Application, configuring the different Integrations and Tasks, and triggering the Main Task, the Task that builds and launches the Application Containers in the Dev stage of the Pipeline.
This process might take a while depending on the number and actions performed in the Containers launched. During this time you can leave the browser window open and let CloudMunch finish up the setup. You will also get updates on the private Slack channel that was created for you on the progress.
Once the process is complete, you will be automatically redirected to the overview page of the created Application.