This project are created in order to show main devops position skills: pipelines, iac, scripting and cloud.
- 📝 Table of Contents
- 🧐 Requirements
- ⛏️ Solution
- ⛓️ Dependencies / Limitations
- 🚀 Future Scope
- 🏁 How to use
- 🎉 Deliverables
The main objective of this project is achive the below requirements:
- As a DevOps engineer, I want to have a CI/CD pipeline for my application
The pipeline must build and test the application code base.
The pipeline must build and push a Docker container ready to use.
The pipeline must deploy the application across different environments on the target
infrastructure.
- Bonus point: Separate the backend and the frontend in different pipelines and containers.
- As a DevOps engineer, I want to have a pipeline to deploy the required infrastructure for my application
The infrastructure must be created on the cloud, for the purpose of the assignment any
public cloud can be used.
The deployment pipeline must use infrastructure as code (Cloud Formation, Cloud
Deployment Manager, Azure Resource Manager or Terraform).
The delivered infrastructure must be monitored and audited.
The delivered infrastructure must allow multiple personal accounts.
For the purpose of the assignment, you will define the cloud architecture that you see fit, document it and explain the resources created and choices made.
- Bonus point: The delivered infrastructure must be able to scale automatically.
- Bonus point: Modify the application to make use of real database running on the cloud, instead of the in-memory database.TIP: We'd highly appreciate if you provide cleanup/destroy functionality as part of the pipeline
The technologies and tools selecteds to achieve the requeriment are:
- Cloud Provider: Azure
- CI/CD tool: Git Hub Action
- Container Registry: Azure container Registry
- Container : Azure WebApp for containers
- Monitoring Tool: Azure App Insight
- Infrastructure as code : Azure ARM templates
The application has been deployed in Azure, the pipeline process is explaining below:
-
First create the resource group whom will store the resources deployed
-
After that create a service principal a give the permission only over the resource group created
-
Deploy the resources with the arm template
- Azure container Registry
- Azure WebApp for containers
- Azure Service plan
- Azure App Insight
-
Build a docker image and upload to Azure container registry
-
Deploy the container image to the webapp
-
Test access to the web application deployed with a python script and chrome driver (Selenium)
This version v1 have a below limitations:
- Static Application's Name beetween different environments
- Start the deployment infrastructure require execute command in azure CLI
- The unit-test enviroment is setted just in a Linux environment
- ⛏️ It's necessary cleanup the insfrastructure before deploy in different environment (Azure Subscription)
Next version must have:
- Autoscaling the web app
- Use SQL Azure Database
- Separate the backend and the frontend in different pipelines and containers
These instructions will get you a copy of the project up and running on your own environment for development and testing purposes.
- On GitHub, navigate to the alefred/orange-challenge repository.
- In the top-right corner of the page, click Fork.
- Connect to az cli with:
az login --use-device-code
- Execute next command in your az cli in order to copy the output:
az provider register --namespace 'Microsoft.Web'
az provider register --namespace 'Microsoft.ContainerRegistry'
az provider register --namespace 'Microsoft.insights'
$appSpName="frenchOrange-spApp"
$rgName="frenchOrange_rg"
$subscriptionId = az account show --query id --output tsv
az group create --resource-group $rgName --location "East US 2"
az ad sp create-for-rbac --name $appSpName --role contributor --scopes "/subscriptions/$subscriptionId/resourceGroups/$rgName" --sdk-auth
- The output could be similar to:
{
"clientId": "-------------------------e8",
"clientSecret": "Y93m-------------------------W",
"subscriptionId": "f3c-------------------------8",
"tenantId": "0c6-------------------------",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
- Copy the output and paste as a new secret "AZURE_CREDENTIALS" in github repo forked as the image show:
-
On GitHub, navigate to the orange-challenge own repository.
-
Go to Actions Tab and enable Actions "I understand my workflows, go ahead and enable them"
-
Push any change to the main branch
-
Return to Actions Tab
-
Browse the app: frenchOrange.azurewebsites.net
n-1. Execute the next list of commands in Azure Cli
$appSpName="frenchOrange-spApp"
$rgName="frenchOrange_rg"
$subscriptionId = az account show --query id --output tsv
az group delete --resource-group $rgName --yes
az ad sp delete --id (az ad sp list --display-name $appSpName --query "[].appId" --output tsv)
-
Source code of the pipeline(s) and the IaC source code of the solution implemented:
- Pipeline(s) code: .github\workflow\cicd-orange.yml
- Iac code: arm-template\iac-orange.json
-
Instructions on how to fork, configure and deploy the solution on our own cloud environment
-
High-level documentation explaining the overall architecture of the solution implemented.
n. Url app after deploy: frenchOrange.azurewebsites.net