DevOps Engineer Home Challenge for @Versatile
DevOps Engineer Home Challenge for @Versatile As part of this Home assignment, I was required to create a web-app that returns Hello, , deploy it automatically, test and create useful CI flow.
important notes:
- Engineers cannot deploy to same enviorment
This was done by using GIT to manage my Terraform code. It allows me to track changes to your code and manage conflicts one build at a time. - Links can be seen throughout the Jenkins jobs run
2.1 deployed web app
2.2 docker image - Emails on failed test
Versatile web app CICD flow involves the following stages:
Deploy
In this stage, we deploy an EC2 instance to aws, using terraform aws moduleverify
In this stage, we verify that the EC2 instance was created succesfullyInstall
In this stage, we install our web application on top of the EC2 using ansible whcih runs docker-compose to initiate a docker container that holds our web appTest
In this stage, we test the functionality of the web-app
such as:
4.1 Health Checks 4.2 Health Checks 4.3 Health ChecksRelease
In this stage, we release the image as artifact to dockerhub.
This image containes the latest of our codeDestroy
On development branches only (pipelines that came from any other branch butmain) the pipeline will kill the EC2 machine that was created after 10 minuets
as for production, the
To deploy development enviornemt:
- Login to jenkins in http://13.38.117.100:8080/job/versatile-app-build-test-deploy/
- Go to versatile-app-build-test-deploy job
- Press on your development branch
- Build with Parameters
- set Region and 'build'
Deployment to production will happen only after a succesful merge to main branch
pre-requisites:
docker | docker-compose | python | virtualenv | pip | git
git clone clone https://github.com/KobeVK/Versatile
cd Versatile && docker-compose up
- health check
The product is the web-app containerized and pushed to docker hub.
auto versioned by the Jenkins job number
https://hub.docker.com/r/sapkobisap/versatile
- Enable more parameters in Gitlab to support wider range of deployemt possibilites (not just free-tier EC2's)
- Fix folder structure to better visibility (ansible files, TF files, Docker files)
- add proxy such as NginX
- Infrastructure tests (Load on server, high traffic, etc...)
- add Python unit tests, (maybe mock's with pupeteer...)
