Skip to content

codebypatrickleung/azure-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Playground

This repository serves as my own sandbox for exploring and testing Azure services. It is intended for experimenting with new features, learning about Azure, and building applications that leverage Azure resources.

Infrastructure

All the Azure infrastructure is provisioned using Terraform, so that I can easily tear down the infrastructure when I'm done testing. The Terraform code in this repository provisions the following Azure services:

  • Azure OpenAI Services
  • Azure Kubernetes Service (AKS)
  • Azure Container Registry (ACR)

I used Azure Verified Modules to take out all the heavy lifting, so my terraform code is minimal. I am using the following modules:

I am using the Dev/Test Standard for AKS pattern module to deploy the AKS cluster with a Dev/Test Standard SKU, which is a cost-effective option for development and testing purposes. There is also a Production Standard for AKS pattern module available, but I am not using it to reduce costs and complexity. The production one takes care of things like private networking, private endpoints, DNS and more, which are not needed for my testing purposes.

The Dev/Test Standard for AKS pattern module also provisions an Azure Container Registry (ACR) to store the container images used by the AKS cluster. If you want to learn more about the modules I used, refer to the Azure Verified Modules documentation.

Application

The framework I have selected here is Vue.js for the frontend and Python FastAPI for the backend. This combination provides a good balance of modularity and simplicity.

The LLM model utilizes the model router (introduced May 2025), enabling the app to route requests to different models based on the request type. This seems interesting as we might be able to combine different models for different tasks.

CI / CD

Due to emphermal nature of the infrastructure, I have not set up a CI/CD pipeline for this repository. The infrastructure is provisioned and destroyed as needed, so there is no need for a CI/CD pipeline to manage the deployment of the application. I am deploying the application manually using a script. The script is written for MacOS, but it can be easily adapted for other operating systems. The script is located in the script directory and is named deploy.sh. The script builds the Docker image for the application for both AMD and ARM architectures, pushes it to the Azure Container Registry (ACR), and deploys it to the Azure Kubernetes Service (AKS) cluster.

You can run the scripts by executing the following commands in your terminal:

cd script
./deploy.sh --all

or if you just want run specific parts of the script, you can use the following commands:

cd script
./deploy.sh --run <section>   Run only the specified section: prereq, config, build, deploy, run

Security

This repository is intended for testing and learning purposes, and it does not implement all the security measures that you would typically use in a production application. A couple of security measures are implemented in this repository to ensure that the Azure resources are secure and that sensitive information is not exposed:

  • Ephemeral environment for testing purposes, meaning that the infrastructure is provisioned and destroyed as needed, reducing the risk of leaving resources running unnecessarily.
  • Using Entra ID for authentication and authorization, which provides a secure way to manage access to Azure resources.
  • Using managed identities for Azure resources to avoid hardcoding credentials.

Getting Started

  1. Clone the repository.

  2. Deploy the infrastructure using Terraform:

    cd infrastructure
    terraform init
    terraform apply -auto-approve
    
  3. Deploy the application:

    Note that the application deployment script is written for MacOS. If you are using a different operating system, you may need to adjust the script accordingly.

    cd ..
    ./script/deploy.sh --all

    The script will authenticate with Azure, build the Docker image for the application, push it to the Azure Container Registry (ACR), add permissions for the AKS cluster to access OpenAI, and deploy the application to the AKS cluster. It will also create a Kubernetes service of type LoadBalancer to expose the application to the internet.

  4. Access the application:

    Open your web browser and navigate to the URL of the AKS cluster. The external IP address of the AKS service is shown in the output of the deployment script. You can also find the URL in the Azure portal under the AKS service. The port is set to 5001 by default, so the URL will look like http://<external-ip>:5001. Have fun exploring the application!

Cleanup

To tear down the infrastructure and remove all resources created by Terraform, run the following command in the infrastructure directory:

terraform destroy -auto-approve

License

This repository is licensed under the MIT License. See the LICENSE file for more details.

About

A playground for Azure services - Azure OpenAI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published