Technical Articles
F5 SMEs share good practice.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mikhail_Fedoro1
Legacy Employee
Legacy Employee

Proper application deployment assumes that all stages are automated to eliminate human factor and make all operations as quick and smooth as possible. NGINX Controller is an application. Mission critical application which requires 100% automation. It should start from the very bottom at controller image creation and cover all other NGINX Controller operations.


This article presents a small aspect of NGINX Controller automation process - automated creation of NGINX Controller image to use in public cloud.


Production application deployment assumes that administrator always know what exactly code is currently running. In case of commercial software it is often impossible to take specific code version directly from a repo and deploy it on a server because software usually distributed as a package. However a package may become this immutable asset to build image on top.


The concept behind this project is to take NGINX Controller package and use CICD pipeline to describe automation steps as a code. Such approach allows to statically define all procedures and parameters for NGINX Controller installation and image. Diagram below explains what are the building workflow components and how do they interact with each other.

0151T000003pjW4QAI.png

As you can see everything starts from CICD platform which stores image automation pipeline code. When pipeline gets triggered with code commit it uses Hashicorp Packer tool to create temporary AWS EC2 instance and installs NGINX Controller software there then convert it to an AMI image.


Writing a pipeline is always challenging. However there is a gitlab project which already has the pipeline defined (link). In case you need to build your own image just clone template, set variables and let the pipeline to do the rest. Example below gives step be step instructions.


Step 1. Import the template repo to a brand new Gitlab project

0151T000003pjNbQAI.png

Step 2. Set variables. Secrets go as CICD environment variables

0151T000003pjNcQAI.png

All other go to ".env". Directly to the code

0151T000003pjNgQAI.png

Step 3. Once changes submitted the pipeline starts and builds an image using Hashicorp Packer tool.

0151T000003pjNvQAI.png


0151T000003pjNqQAI.png


In case pipeline succeeds you can find NGINX Controller image in the list of AWS AMIs.

0151T000003pjNrQAI.png


Such approach allows to formalize NGINX Controller image creation to make it immutable piece of infrastructure to eliminate any inconsistencies. Each build gets tagged with commit hash so you know exactly how controller installation is setup.


This project doesn't stop on AWS implementation. Other public clouds are in roadmap. If you are interested in expanding project to other clouds please contact me (m.fedorov@f5.com) and join development.


Good luck!

Version history
Last update:
‎17-Sep-2020 17:22
Updated by:
Contributors