GitLab CI/CD - Azure VM Scale Sets
Case Objective: GitLab Continuous Integration (CI) and Azure Virtual Machine Scale Sets (VMSS) to create an automation pipeline that creates, deploys, scales out and scales in an application and its infrastructure.
GitLab is a web-based tool that provides a Git-repository manager, wiki, issue-tracking and continuous integration and deployment (CI/CD) pipeline.
I will be using GitLab to store source code and orchestrate the deployment of an application to an autoscaled virtual machine environment in Microsoft Azure.
VM Scale Sets (VMSS): Virtual machine scale sets allow the creation and maintenance of a group of load-balanced virtual machines. These virtual machines can be scaled-up or scaled-down automatically in response to either demand or a schedule as defined by the user.
GitLab - A complete DevOps platform
GitLab is a single application for the entire software development lifecycle. From project planning and source code management to CI/CD, monitoring, and security.
Deploy a self-managed instance of GitLab.
Launch GitLab and Create your first project.
You can do it from the command line:
git push --set-upstream email@example.com:sandeepseeram/$(git rev-parse --show-toplevel | xargs basename).git $(git rev-parse --abbrev-ref HEAD)
Upload your source code: I will be using HashiCorp Packer JSON file for the Image, Ansible for OS Orchestration and Terraform to build the required infrastructure in Azure.
We need to update all the variables required in the Settings – CI/CD – Variables
Stages: Image (packer_build), Init, Plan, Apply and Destroy.
What’s happening in the background while pipeline is running is GitLab is invoking HashiCorp Packer and Red Hat Ansible to create a custom image, customize it and deploy our application on the image
GitLab taking the image file and uploading it to Microsoft Azure and creating the VM Scale set and associated resources.
Once terraform apply is completed, login to the azure portal to verify the deployment.
In Summary, From project planning and source code management, to CI/CD and monitoring, GitLab is a complete DevOps platform, delivered as a single application.