DevOps Assembly ( CI / CD / CM )
Mohamed Afrid
DevOps Engineer | 3x RedHat | 1x AWS | 3x Azure | CKA | CKS | Terraform Certified
CONTINUOUS INTEGRATION & DELIVERY WITH CONTINUOUS MONITORING
OBJECTIVE
? To achieve continuous integration & continuous delivery with continuous monitoring as well.
? When the code is pushed to the GitHub master ( production ) branch, the Jenkins will pull the code and build it as the package using the maven and deploy it to the ansible server and S3 bucket for version application version tracking.
? Then ansible will take care of all the webserver configuration, artifact delivery, Nagios client installation and Nagios host and service definition creation in the Nagios server
? This achieves the continuous integration & continuous delivery with continuous monitoring.
? This will be done in a single click.
TOOLS USED
- Maven: For creating Build from the code
- Git: For the version control system
- Jenkins: For creating CI / CD pipeline
- Ansible: For configuration management purpose
- Nagios: For monitoring purpose
- S3: For tracking the created artifacts from maven
- Slack: For notification purpose
- RDS: For the Database purpose
INTEGRATIONS AND PLUGINS USED
- Git is integrated using the webhook in the Jenkins
- Maven is used as the plugin in Jenkins.
- Artifacts are deployed to S3 via S3 publisher plugin in Jenkins
- Artifacts are deployed to the ansible via Publish over SSH plugin in Jenkins
- Ansible will deploy the configuration and artifacts via custom playbook
- Nagios is integrated with slack via Custom script.
- Nagios is also integrated with Database via NdoUtils daemon
GIT AND GITHUB
Git is the version control management system
? Git play the main role in tracking the modification made in the code level for creating the artifacts
? If anything goes wrong in the artifacts or the created customer impact, we can easily go back to the older version ( proper working version ) within a minute.
? Here whenever the code is pushed to the master branch, Jenkins will identify the action and trigger the maven to start the build using the code pushed in GitHub and deliver the artifacts in the Jenkins workspace
MAVEN
? It is the build tool
? All the required details we need to do with code will be mentioned in the POM.xml file and the code which have to be used will be uploaded to the GitHub.
? All the phases like Validate, compile, Test, Packaging, and Deploy will be taken care of by the maven itself automatically that’s the advantage of maven here.
? The Test used here is a Unit test using Junit plugin integrated into the maven
? Then the fully scoped artifact is delivered to the Ansible server by Jenkins ( either it may be Jar/war file ), but here it is .war file
JENKINS
? Jenkins is the crucial tool which is used for creating the CI / CD pipeline
? Whenever the code is pushed to the GitHub, Jenkins will consider that as event and trigger the maven to create the artifacts using maven and deploy it the ansible server after the build ( post-action ).
? It is the intermediate for everything which we did in the DevOps cycle.
? Every action is defined as the separate jobs that allow us to build only that specific job if needed.
? Using the Build pipeline, Build are organized and made in a more efficient way for troubleshooting the build failures and the pipeline overview.
? By using the groovy script we can make single job to act as the pipeline job and made it as an upstream or downstream job for any pipeline like in code-pipeline, data-pipeline etc. etc. by doing so we can differentiate every steps in the job
ANSIBLE
? Ansible is the configuration management tool
? Once the artifacts are delivered to the ansible server via Jenkins, Playbooks will be triggered
? Playbooks are nothing like the custom bash/python script but written in the YAML format.
? 3 Different playbooks are used here for 3 different purposes.
?Whenever the new server is introduced all will be taken care of by ansible itself, all we need to do is mention the hostname in the Ansible inventory. We can group the hostname according to what purpose that the host is going to be used for
PLAYBOOKS IN ANSIBLE
? For installing the required web server packages and their configuration according to the flavor of OS.
? For Installing the required NRPE agent and their configuration according to the flavor of OS.
? For creating the Host and service configuration in the Nagios server for continuous monitoring
NAGIOS: Monitoring tool
? It Is the agent-based monitoring tool ( NRPE: agent )
? It is used to monitor the hosts as well the services in the remote host, we can also monitor lot of metrics accordingly like end-points, databases, Message-queues, etc. etc.
? We can also send out the notification to the customer via notification module if the service hits the threshold ( Here I used slack for notification purpose ). We can also send out the email, creating the tickets using service-now, triggering some events, etc. etc.
? By using influx DB or Graphite we can get graphical trends of the alerts via Grafana.
RDS ( AWS )
? Amazon’s Relational database management system
? It is used with Nagios for tracking the history of alerts in the hosts/service
? By Using RDS we can have a Multi-AZ and Read-Replica.
? Multi-AZ is useful for disaster recovery, it will allow our database to be copied in three different AZ.
? Read Replica is useful for increasing the performance of Reads, We can also use elastic cache for improving read performance.
? All the patching and the database upgrades will be done by Amazon itself.
? Easy migration can be done from one flavor to another flavor.
? We can easily trigger an event if in case any action need to be taken once the entry is created in the database using the Lambda function in the AWS.
Production Officer - Detergents
4 年Great work
KYC Analyst | Client Due Diligence | AML & Compliance
4 年Gud wrk??
Offensive Security
4 年Good Job
Securing Cloud & Data | AI/ML/LLMs
4 年Great job, Is there any repo, to replicate this