- Project Description
- To Be Done
- Building Static Website
- Deployment of Azure Function
- Deployment of Website to Azure
- Building CI/CD Pipeline
- The Cloud Resume Challenge is a hands-on project designed to bridge the gap between cloud certification and a cloud job. It encompasses many of the skills that real cloud and DevOps engineers use daily. The challenge was designed by Forrest Brazeal. More information about the challenge can be found on the official website.
- Key objectives for the project:
- Write a static website in HTML and style it with CSS.
- Deploy the static website to Azure storage.
- Set up access to the website via the secure HTTPS protocol.
- Connect the website to a custom DNS domain name.
- Create a visitor counter for the website using JavaScript and Azure Functions in Python.
- Store visit counts in Azure CosmosDB.
- Use an API to establish communication between CosmosDB, Azure Functions, and the website.
- Create unit tests for Azure Functions in Python.
- Set up GitHub Actions for CI/CD deployment.
- Create a resume and host it in Azure’s General Purpose v2 storage.
- Create an Azure Key Vault and store all secrets securely.
- Incorporate Terraform to build resources in Azure.
- Create a project on GitHub.
- Clone the repository locally:
git clone git@github.com:carlpadilla/cloud-resume-azure.git
- Download website template to not start from complete scratch
- Use Visual Studio Code to edit your web page
- Once you made all the changes to the code and want to save your changes in GitHub
git add -A git commit -m "What changes did you make" git push
- Create JavaScript code for Counter every time page is loaded
Creation of Azure Function
- Azure Account needs to be created
- Build ComosDB database via Azure Portal
- Resource Group needs to be created first or as part of CosmosDB creation process
- Create container in Azure Cosmos
- On left board select > Data Explorer > New Database > In data section database will be created > click 3 dots > new container > partition key > Go to items in container > create new row
{ "id: "1", "count": 0 }
- On left board select > Data Explorer > New Database > In data section database will be created > click 3 dots > new container > partition key > Go to items in container > create new row
- Create Azure Function in Visual Studio Code
- Install Azure Functions extension
vscode:extension/ms-azuretools.vscode-azurefunctions
- Install Python extension
- Create local Azure Function project
- Install package inside your project directory for Azure-Cosmos (make sure to update requirements.txt as well before function deployment to Azure)
pip install azure-cosmos
- Create an HTTP trigger in your Azure Function as well as connection to CosmosDB to retrieve and update data inside container
- Install Azure Functions extension
- Publish Azure function to Azure
- Select the same resource group as for CosmosDB
- Create new Azure storage account (can be done when publishing Azure function as well)
- Edit Azure Function’s application settings with your secrets
- You can use Azure Key Vault to store them securely
- Get Function URL
- Add URL into your JavaScript code for counter
- Enable Cross-Origin Resource Sharing (CORS) for you function in Azure
- Install Azure static Web Apps extension for Visual Studio Code and create static web app
- Create Azure Content Delivery Network (CDN) profile and endpoint for your website
- Map your custom domain to CDN profile
- I’ve used NameCheap for my custom domain
- Enforce HTTPS traffic only
- Redirect HTTP traffic to HTTPS
- Get your website URL and edit CORS for allowed origins
- Create GitHub Actions workflows (Front End for static site deployment and Back End for unit testing)
- Generate deployment credentials and add your workflow for static site
- Write Python code to test Azure Functions
- Pytest can be used to run unit tests
- Set up a Python workflow that uses a publish profile