Angular on Azure App Service & Spring Boot Microservices on AKS with CI/CD, Helm, Azure DevOps, Prometheus, Grafana & Log Analytics: End-to-End Deployment
This diagram represents the end-to-end deployment workflow of an Angular frontend and Spring Boot microservices on Azure using Azure DevOps, Kubernetes, Helm, Prometheus, and Grafana.
Key Flow:
- Code Development & Push: Developer writes Angular & Spring Boot code and pushes it to GitHub.
- CI/CD with Azure DevOps: GitHub triggers a CI/CD pipeline in Azure DevOps, which builds the project and pushes the Docker image to Azure Container Registry (ACR).
- Deployment:
- Spring Boot microservices are deployed on Azure Kubernetes Service (AKS) using Helm.
- The Angular frontend is deployed on Azure App Service.
- Monitoring & Logging:
- Prometheus collects metrics from AKS and sends them to Grafana for visualization.
- Azure Monitor & Log Analytics track logs and alerts.
This ensures automated deployments, monitoring, and logging for a production-ready cloud environment.
End-to-End Deployment Guide
Overview
This guide covers the complete deployment of:
- Angular on Azure App Service
- Spring Boot Microservices on Azure Kubernetes Service (AKS)
- CI/CD using Azure DevOps
- Integration with Helm, Azure Monitor, Log Analytics, Prometheus, and Grafana
1️⃣ Create Spring Boot "Hello World" Microservice
Step 1: Initialize Spring Boot
Generate a project using Spring Initializr or run:
curl https://start.spring.io/starter.zip -d dependencies=web -d language=java -o backend.zip
unzip backend.zip -d spring-boot-backend
cd spring-boot-backend
Step 2: Create a REST Controller
Edit src/main/java/com/example/demo/HelloController.java
:
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class HelloController {
@GetMapping("/hello")
public String sayHello() {
return "Hello, World from Spring Boot!";
}
}
Step 3: Add Prometheus Metrics
Add Micrometer Prometheus dependency in pom.xml
:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
Expose metrics in application.properties
:
management.endpoints.web.exposure.include=metrics,prometheus
Step 4: Run Locally
mvn spring-boot:run
Check API: http://localhost:8080/api/hello
Check Metrics: http://localhost:8080/actuator/prometheus
2️⃣ Create Angular "Hello World" Frontend
Step 1: Create Angular Project
ng new hello-world-angular
cd hello-world-angular
ng add @angular/material
Step 2: Create API Service
Edit src/app/api.service.ts
:
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class ApiService {
private apiUrl = 'http://<AKS-IP-Address>/api/hello';
constructor(private http: HttpClient) {}
getHelloMessage(): Observable<string> {
return this.http.get(this.apiUrl, { responseType: 'text' });
}
}
3️⃣ Push Code to GitHub
git init
git remote add origin https://github.com/yourusername/your-repo.git
git add .
git commit -m "Initial commit"
git push -u origin main
4️⃣ Deploy Angular on Azure App Service
Step 1: Build & Deploy
ng build --configuration=production
az webapp create --resource-group <resource-group> --plan <app-service-plan> --name <angular-app-name> --runtime "NODE|18-lts"
az webapp deployment source config-zip --resource-group <resource-group> --name <angular-app-name> --src <path-to-zip-file>
5️⃣ Deploy Spring Boot Microservices on AKS using Helm
Step 1: Create AKS Cluster
az aks create --resource-group <resource-group> --name <aks-cluster> --node-count 2 --enable-addons monitoring --generate-ssh-keys
Step 2: Deploy with Helm
Create Helm Chart
helm create hello-world-chart
cd hello-world-chart
Edit values.yaml
:
replicaCount: 2
image:
repository: myacr.azurecr.io/hello-world
tag: v1
pullPolicy: Always
service:
type: LoadBalancer
port: 80
targetPort: 8080
Deploy Helm Chart
helm install hello-world-release ./hello-world-chart
6️⃣ Enable Azure Monitor & Log Analytics
Step 1: Enable Log Analytics for AKS
az monitor log-analytics workspace create --resource-group <resource-group> --workspace-name <workspace-name>
az aks enable-addons --resource-group <resource-group> --name <aks-cluster> --addons monitoring --workspace-resource-id <workspace-id>
Step 2: View Logs
az monitor log-analytics query --workspace <workspace-id> --analytics-query "ContainerLog | take 10"
7️⃣ Install Prometheus & Grafana for Monitoring
Step 1: Add Helm Repo
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Step 2: Install Prometheus
helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace
Step 3: Install Grafana
helm install grafana prometheus-community/grafana --namespace monitoring
Step 4: Get Grafana Admin Password
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode
Step 5: Access Grafana Dashboard
kubectl port-forward --namespace monitoring service/grafana 3000:80
Visit: http://localhost:3000
Login with admin and the retrieved password.
8️⃣ Azure DevOps CI/CD for Spring Boot
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
goals: 'package'
- task: Docker@2
inputs:
containerRegistry: 'myacr'
repository: 'hello-world'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
- task: HelmDeploy@0
inputs:
connectionType: 'Azure Resource Manager'
azureSubscription: '<azure-subscription-name>'
azureResourceGroup: '<resource-group-name>'
kubernetesCluster: '<aks-cluster-name>'
command: 'upgrade'
chartType: 'FilePath'
chartPath: 'hello-world-chart'
releaseName: 'hello-world-release'
🎯 Final Setup
✅ Angular App Running on Azure App Service
✅ Spring Boot Microservices Running on AKS with Helm
✅ CI/CD Automated with Azure DevOps
✅ Azure Monitor & Log Analytics Integrated
✅ Prometheus & Grafana Installed for Monitoring