Skip to content

Commit 14be362

Browse files
committed
Fixed Azure API version
1 parent ba73358 commit 14be362

File tree

2 files changed

+233
-2
lines changed

2 files changed

+233
-2
lines changed

Cloud README.md

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
<a name="readme-top"></a>
2+
3+
<div align="center">
4+
<img src="azure_logo.png" alt="Azure Cloud Logo" width="120" />
5+
<h3><b>Cloud Web App Deployment on Azure</b></h3>
6+
</div>
7+
8+
# 📗 Table of Contents
9+
10+
- [📖 About the Project](#about-project)
11+
- [🛠 Built With](#built-with)
12+
- [Tech Stack](#tech-stack)
13+
- [Key Features](#key-features)
14+
- [🚀 Live Demo](#live-demo)
15+
- [💻 Getting Started](#getting-started)
16+
- [Prerequisites](#prerequisites)
17+
- [Setup](#setup)
18+
- [Provision Infrastructure (Terraform)](#terraform)
19+
- [Configure Services (Ansible)](#ansible)
20+
- [Deployment](#deployment)
21+
- [👥 Authors](#authors)
22+
- [🔭 Future Features](#future-features)
23+
- [🤝 Contributing](#contributing)
24+
- [⭐️ Show your support](#support)
25+
- [🙏 Acknowledgements](#acknowledgements)
26+
- [❓ FAQ](#faq)
27+
- [📝 License](#license)
28+
29+
---
30+
31+
# 📖 Azure Cloud Web App Deployment <a name="about-project"></a>
32+
33+
This project automates the provisioning and deployment of a scalable cloud application on Microsoft Azure. It uses **Terraform** to create infrastructure, and **Ansible** to configure services like a backend API running on 2 VMs behind a Load Balancer, connected to an **Azure MySQL** database, along with a frontend deployed on **Azure Web App**.
34+
35+
## 🛠 Built With <a name="built-with"></a>
36+
37+
### Tech Stack <a name="tech-stack"></a>
38+
39+
<details>
40+
<summary>Infrastructure as Code</summary>
41+
<ul>
42+
<li><a href="https://www.terraform.io/">Terraform</a></li>
43+
</ul>
44+
</details>
45+
46+
<details>
47+
<summary>Configuration Management</summary>
48+
<ul>
49+
<li><a href="https://www.ansible.com/">Ansible</a></li>
50+
<li><a href="https://github.com/ansible-collections/azure">azure.azcollection</a></li>
51+
</ul>
52+
</details>
53+
54+
<details>
55+
<summary>Cloud Platform</summary>
56+
<ul>
57+
<li><a href="https://azure.microsoft.com/">Microsoft Azure</a></li>
58+
</ul>
59+
</details>
60+
61+
<details>
62+
<summary>Database</summary>
63+
<ul>
64+
<li><a href="https://learn.microsoft.com/en-us/azure/mysql/">Azure Database for MySQL</a></li>
65+
</ul>
66+
</details>
67+
68+
<details>
69+
<summary>Deployment Targets</summary>
70+
<ul>
71+
<li>Azure Virtual Machines</li>
72+
<li>Azure Load Balancer</li>
73+
<li>Azure App Service (Web App)</li>
74+
</ul>
75+
</details>
76+
77+
### Key Features <a name="key-features"></a>
78+
79+
- 🔧 Automated infrastructure provisioning with Terraform
80+
- 📦 Service configuration and app deployment using Ansible
81+
- 🌐 Scalable API on 2 Azure VMs behind a Load Balancer
82+
- 💾 Managed Azure MySQL integration
83+
- 🚀 Web frontend deployed using Azure Web App
84+
85+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
86+
87+
---
88+
89+
## 🚀 Live Demo <a name="live-demo"></a>
90+
91+
- [Frontend Web App](https://your-frontend-url.azurewebsites.net)
92+
- [API Endpoint (behind Load Balancer)](http://your-lb-ip-or-dns)
93+
94+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
95+
96+
---
97+
98+
## 💻 Getting Started <a name="getting-started"></a>
99+
100+
To get a local copy up and running, follow these instructions.
101+
102+
### Prerequisites
103+
104+
- Azure CLI (`az`)
105+
- Terraform ≥ 1.5
106+
- Ansible ≥ 2.15
107+
- Python 3 with `msrestazure`, `azure-cli-core`, `requests`
108+
- SSH key pair
109+
110+
### Setup
111+
112+
```bash
113+
git clone https://github.com/your-username/azure-cloud-webapp-deploy.git
114+
cd azure-cloud-webapp-deploy
115+
```
116+
117+
## 📦 Provision Infrastructure (Terraform) <a name="terraform"></a>
118+
119+
1. Initialize Terraform:
120+
121+
```bash
122+
cd terraform/
123+
terraform init
124+
```
125+
126+
2. Set your variables in `terraform.tfvars` or export them:
127+
128+
```bash
129+
terraform plan -out plan.tfout
130+
terraform apply "plan.tfout"
131+
```
132+
133+
## ⚙️ Configure Services (Ansible) <a name="ansible"></a>
134+
135+
1. Install Azure collection:
136+
137+
```bash
138+
ansible-galaxy collection install azure.azcollection
139+
```
140+
141+
2. Run Ansible Playbooks:
142+
143+
```bash
144+
cd ansible/
145+
ansible-playbook -i inventory.ini site.yml
146+
```
147+
148+
## 🚢 Deployment <a name="deployment"></a>
149+
150+
- API is reachable via Load Balancer Public IP.
151+
- Web frontend is served via Azure Web App.
152+
- All backend components connect to Azure MySQL securely.
153+
154+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
155+
156+
---
157+
158+
## 👥 Authors <a name="authors"></a>
159+
160+
👤 **Your Name**
161+
162+
- GitHub: [@yourhandle](https://github.com/yourhandle)
163+
- LinkedIn: [Your Profile](https://linkedin.com/in/yourhandle)
164+
165+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
166+
167+
---
168+
169+
## 🔭 Future Features <a name="future-features"></a>
170+
171+
- [ ] Add CI/CD pipeline with GitHub Actions
172+
- [ ] Enable autoscaling for the API tier
173+
- [ ] Implement managed identity-based DB auth
174+
175+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
176+
177+
---
178+
179+
## 🤝 Contributing <a name="contributing"></a>
180+
181+
Contributions, issues, and feature requests are welcome!
182+
183+
Feel free to open an issue or submit a pull request.
184+
185+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
186+
187+
---
188+
189+
## ⭐️ Show your support <a name="support"></a>
190+
191+
If you like this project, please ⭐️ the repository and share it with others!
192+
193+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
194+
195+
---
196+
197+
## 🙏 Acknowledgements <a name="acknowledgements"></a>
198+
199+
- Microsoft Azure documentation
200+
- Ansible Azure Collection contributors
201+
- HashiCorp Terraform Modules
202+
203+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
204+
205+
---
206+
207+
## ❓ FAQ <a name="faq"></a>
208+
209+
- **Can I deploy this to a different region?**
210+
- Yes, update the `location` variable in Terraform and Ansible inventory.
211+
212+
- **What if I want to use a container instead of a VM for the API?**
213+
- You can replace the VM setup with Azure Container Instances or Azure Kubernetes Service.
214+
215+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
216+
217+
---
218+
219+
## 📝 License <a name="license"></a>
220+
221+
This project is licensed under the [MIT License](./LICENSE).
222+
223+
<p align="right">(<a href="#readme-top">back to top</a>)</p>

ansible/deploy-frontend.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
connection: local
55
vars:
66
frontend_src: "{{ frontend_src_dir | default('src/movie-analyst-ui') }}"
7-
node_version: "14-lts" # Node.js version
7+
node_version: "16-lts" # Updated to Node.js 16
8+
azure_api_version: "2023-01-01" # Explicit API version
89

910
tasks:
1011
# --- Validate source directory ---
@@ -26,6 +27,7 @@
2627
- WebApp: {{ app_service_name }}
2728
- Resource Group: {{ resource_group_name }}
2829
- Backend API: {{ lb_api_url }}:8080
30+
- Node.js Version: {{ node_version }}
2931
3032
# --- Build frontend ---
3133
- name: Install dependencies
@@ -51,8 +53,10 @@
5153
--name "{{ app_service_name }}" \
5254
--linux-fx-version "NODE|{{ node_version }}" \
5355
--output none
56+
environment:
57+
AZURE_CLI_DEFAULT_API_VERSION: "{{ azure_api_version }}"
5458

55-
- name: Set app settings (environment variables)
59+
- name: Set app settings
5660
command: |
5761
az webapp config appsettings set \
5862
--resource-group "{{ resource_group_name }}" \
@@ -63,6 +67,8 @@
6367
BACKEND_URL="{{ lb_api_url }}:8080" \
6468
WEBSITES_ENABLE_APP_SERVICE_STORAGE=true \
6569
--output none
70+
environment:
71+
AZURE_CLI_DEFAULT_API_VERSION: "{{ azure_api_version }}"
6672

6773
- name: Deploy ZIP package
6874
command: |
@@ -71,6 +77,8 @@
7177
--name "{{ app_service_name }}" \
7278
--src "./frontend-deploy.zip" \
7379
--output none
80+
environment:
81+
AZURE_CLI_DEFAULT_API_VERSION: "{{ azure_api_version }}"
7482

7583
# --- Verify deployment ---
7684
- name: Check if application is reachable

0 commit comments

Comments
 (0)