Technology weblog

IT-Essence
Monday Apr 30, 2018

Deploying a COTS Application in the AWS cloud with Continous Delivery, IaC, Packer, GitLab, Ansible and Terraform

In this post we discuss how to deploy a COTS application in the Amazon cloud using a continuous delivery pipeline in GitLab, using Packer and Ansible to create an AMI (abstract machine image) and Terraform to lay out the infrastructure to which the application will be deployed.

CD Pipeline
The stages that constitute a typical COTS pipeline (Amazon Cloud)

Assuming you have put the required COTS binary/binaries and required dependencies (if necessary) into the a binary repository such as Artifactory or Nexus, the following stages can be distinguished when delivering a COTS application in the AWS cloud (each step corresponds to a phase in the picture above):

  1. Preparational activities that are needed for a proper functioning of the CD pipeline. You may want to set up certain things, such as e.g. an S3 state bucket to persist the Terraform state, configure your GitLab runner, perform static code analysis, etc.

  2. Create an AWS abstract machine image (AMI) using Packer, preferrably using the Ansible provisioner (but tools such as Puppet or Chef also do the job).

    Typical things you would want to configure on the AMI are:

    • Installation of the COTS artifact from Artifactory and its required dependencies
    • Configuration of software that makes your log files available in CloudWatch
    • Installation and configuration of a reverse proxy (if needed by the application)

  3. Set up the infrastructure on your DT environment/account using e.g. Terraform and deploy your AMI to that very infrastructure. It is advised to have at least one smoke test being triggered after each deployment to verify the deployment went according to expectations.

  4. Propagate your AMI from your DT environment/account to your AP environment/account.

    According to the 4 practices of continuous delivery, you should build once, deploy many. That means that the AMI that has been built in the DT environment/account has to be propagated to the AP environment. Technically this is quite an intricate procedure, but luckily a propagate script is available, see the FAQ.

  5. Set up the infrastructure on your AP environment/account using e.g. Terraform and deploy your AMI on that very infrastructure to represent the ACC instance. It is advised to have at least one smoke test being triggered to verify the deployment went according to expectations.

  6. Set up the infrastructure on your AP environment/account using e.g. Terraform and deploy your AMI on that very infrastructure to represent the PRD instance. It is advised to have at least one smoke test being triggered to verify the deployment went according to expectations.

  7. Some applications may require further (manual) configuration/set up using the GUI.

Note that the above stages correspond exactly to the stages in the .gitlab-ci.yml file when working with GitLab.

Comments:

Post a Comment:
Comments are closed for this entry.

Hire us
Archives
Tags
Links
Stats
Referrers