Skip to content

Commit 565639e

Browse files
committed
Added readme file and npm install
1 parent 7f04c36 commit 565639e

File tree

2 files changed

+128
-49
lines changed

2 files changed

+128
-49
lines changed

Cloud README.md

Lines changed: 116 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,25 @@ This project automates the provisioning and deployment of a scalable cloud appli
7676

7777
### Key Features <a name="key-features"></a>
7878

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
79+
- 🔧 Automated infrastructure provisioning with Terraform
80+
- 📦 Service configuration and app deployment using Ansible
81+
- 🐘 MySQL database initialized via Ansible using `ansible/files/mysql/movie_db.sql`
82+
- 🌐 Scalable API on 2 Azure VMs behind a Load Balancer
83+
- 💾 Managed Azure MySQL integration
84+
- 🚀 Web frontend deployed using Azure Web App
85+
- 🔐 Service Principal authentication using Client Secret
86+
- ⚙️ Fully automated deployment workflow with CI/CD integration
87+
- 🏗️ End-to-end Terraform deployment from scratch included in workflow
88+
- 🧹 Automated environment teardown using `terraform-destroy.yml`
89+
- 💸 Uses Azure Web App **F1 Free Tier** for cost-effective deployment
8490

8591
<p align="right">(<a href="#readme-top">back to top</a>)</p>
8692

8793
---
8894

8995
## 🚀 Live Demo <a name="live-demo"></a>
9096

91-
- [Frontend Web App](https://your-frontend-url.azurewebsites.net)
97+
- [Frontend Web App](https://softdefault-movies-app.azurewebsites.net/)
9298
- [API Endpoint (behind Load Balancer)](http://your-lb-ip-or-dns)
9399

94100
<p align="right">(<a href="#readme-top">back to top</a>)</p>
@@ -101,66 +107,112 @@ To get a local copy up and running, follow these instructions.
101107

102108
### Prerequisites
103109

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
110+
Most dependencies are installed automatically in the GitHub Actions workflow. However, for local development or debugging, ensure you have the following:
109111

110-
### Setup
112+
- 🖥️ Azure CLI (`az`)
113+
- 📦 Terraform ≥ 1.5
114+
- ⚙️ Ansible ≥ 2.15
115+
- 🔐 SSH key pair for accessing virtual machines
116+
- 📦 Node.js ≥ 14 and npm (required for both frontend and backend)
117+
- 📚 `zip` utility (used to package the frontend app)
118+
- ☁️ Azure Service Principal credentials (used by the workflow):
119+
- `ARM_CLIENT_ID`
120+
- `ARM_CLIENT_SECRET`
121+
- `ARM_TENANT_ID`
122+
- `ARM_SUBSCRIPTION_ID`
123+
- 💡 *(Optional)* GitHub CLI (`gh`) – useful for managing secrets or manually triggering workflows
111124

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>
118125

119-
1. Initialize Terraform:
126+
### 🔧 Setup
120127

121128
```bash
122-
cd terraform/
123-
terraform init
129+
# Clone this repository
130+
git clone https://github.com/NeckerFree/azure-fullstack-automation.git
131+
cd azure-fullstack-automation
124132
```
125133

126-
2. Set your variables in `terraform.tfvars` or export them:
134+
## 📦 Provision Infrastructure (Terraform) <a name="terraform"></a>
127135

128-
```bash
129-
terraform plan -out plan.tfout
130-
terraform apply "plan.tfout"
131-
```
136+
Infrastructure provisioning is fully automated and triggered via **GitHub Actions** on every push or pull request to the `main` branch.
132137

133-
## ⚙️ Configure Services (Ansible) <a name="ansible"></a>
138+
- Terraform is initialized and executed within the workflow using predefined variables.
139+
- The deployment includes:
140+
- A MySQL database on Azure
141+
- A Load Balancer with 2 backend VMs
142+
- Network and security resources
143+
- The entire infrastructure is provisioned from scratch via `terraform.yml`.
134144

135-
1. Install Azure collection:
145+
## ⚙️ Configure Services (Ansible) <a name="ansible"></a>
136146

137-
```bash
138-
ansible-galaxy collection install azure.azcollection
139-
```
147+
Once the infrastructure is up, **Ansible playbooks** are automatically triggered within the same CI/CD workflow to:
140148

141-
2. Run Ansible Playbooks:
149+
- Configure the VMs with the required packages
150+
- Deploy the Node.js API to both backend nodes
151+
- Apply application settings
152+
- Validate MySQL schema creation and data population
142153

143-
```bash
144-
cd ansible/
145-
ansible-playbook -i inventory.ini site.yml
146-
```
154+
This configuration is handled through the `deploy-api.yml` GitHub Actions workflow.
147155

148156
## 🚢 Deployment <a name="deployment"></a>
149157

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.
158+
- 🎯 **Trigger**: Every push or pull request to `main` kicks off a full deployment pipeline.
159+
- 🌐 **API** is publicly reachable via the Load Balancer’s IP address.
160+
- 💻 **Frontend** is deployed to Azure Web App using the **F1 Free Tier**.
161+
- 🔐 **Secure integration** between services via environment variables and Azure-managed credentials.
162+
- 🧨 A separate `terraform-destroy.yml` workflow is available to automatically destroy all infrastructure when needed.
153163

154164
<p align="right">(<a href="#readme-top">back to top</a>)</p>
155165

166+
---
167+
## 🔧 Customizing Variables <a name="custom-variables"></a>
168+
169+
You can modify the following variables to adapt the deployment to your needs. These are defined in the Terraform configuration files:
170+
171+
### `infra/terraform.tfvars`
172+
173+
```hcl
174+
allowed_ssh_ip = "186.155.19.140/32" # IP allowed to access VMs via SSH
175+
mysql_user = "mysqladmin" # MySQL admin user
176+
mysql_admin_password = "Sec#reP@ssword123!" # MySQL admin password
177+
178+
variable "location" {
179+
default = "westus2" # Azure region to deploy resources
180+
}
181+
182+
variable "admin_username" {
183+
default = "myadminuser" # Admin username for virtual machines
184+
}
185+
186+
variable "lb_api_port" {
187+
default = 8080 # API port exposed by Load Balancer
188+
}
189+
```
190+
---
191+
## ☁️ Remote Terraform State in Azure <a name="remote-state"></a>
192+
193+
Terraform uses remote state storage to persist infrastructure state across executions and team members.
194+
195+
This project stores the Terraform state file (`terraform.tfstate`) securely in an **Azure Storage Account** using a backend configuration like the following:
196+
197+
```hcl
198+
terraform {
199+
backend "azurerm" {
200+
resource_group_name = "my-resource-group"
201+
storage_account_name = "myterraformstate"
202+
container_name = "tfstate"
203+
key = "infrastructure.tfstate"
204+
}
205+
}
206+
```
156207
---
157208

158209
## 👥 Authors <a name="authors"></a>
159210

160-
👤 **Your Name**
211+
👤 **Elio Cortés**
161212

162-
- GitHub: [@yourhandle](https://github.com/yourhandle)
163-
- LinkedIn: [Your Profile](https://linkedin.com/in/yourhandle)
213+
- GitHub: [@NeckerFree](https://github.com/NeckerFree)
214+
- Twitter: [@ElioCortesM](https://twitter.com/ElioCortesM)
215+
- LinkedIn: [elionelsoncortes](https://www.linkedin.com/in/elionelsoncortes/)
164216

165217
<p align="right">(<a href="#readme-top">back to top</a>)</p>
166218

@@ -196,21 +248,36 @@ If you like this project, please ⭐️ the repository and share it with others!
196248

197249
## 🙏 Acknowledgements <a name="acknowledgements"></a>
198250

199-
- Microsoft Azure documentation
200-
- Ansible Azure Collection contributors
201-
- HashiCorp Terraform Modules
251+
- [Microsoft Azure documentation](https://learn.microsoft.com/en-us/azure/)
252+
- [Ansible Azure Collection](https://galaxy.ansible.com/azure/azcollection) contributors
253+
- [HashiCorp Terraform Modules](https://registry.terraform.io/)
254+
- [devops-rampup](https://github.com/aljoveza/devops-rampup) — Backend & frontend prototype used as base for this project
255+
- [EPAM DevOps Campus](https://campus.epam.com/en/training) — Cloud and DevOps learning program
256+
- [ChatGPT](https://chatgpt.com/) — Assistance in automation, CI/CD, and documentation
202257

203258
<p align="right">(<a href="#readme-top">back to top</a>)</p>
204259

205260
---
206261

207262
## ❓ FAQ <a name="faq"></a>
208263

209-
- **Can I deploy this to a different region?**
210-
- Yes, update the `location` variable in Terraform and Ansible inventory.
264+
### 🔐 Where are secrets like passwords and keys stored?
265+
Secrets are securely stored as GitHub Actions secrets and injected at runtime into the workflows.
266+
267+
### 🧪 Can I test changes before deploying to Azure?
268+
Yes! You can test locally using `terraform plan` and `ansible-playbook` in dry-run mode before committing changes.
269+
270+
### 🌎 Where is the infrastructure deployed?
271+
By default, all resources are deployed to the `westus2` Azure region. You can change this in `infra/variables.tf`.
272+
273+
### 🛠 What if I want to destroy all resources?
274+
You can run the `terraform-destroy.yml` GitHub Actions workflow to safely destroy the provisioned infrastructure.
275+
276+
### 🐘 How is the database created?
277+
The Azure MySQL database is provisioned with Terraform and initialized using `movie_db.sql` from Ansible.
211278

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.
279+
### 🌐 What is the default URL for the frontend?
280+
The frontend is hosted on Azure Web App. The exact URL depends on the generated Azure App Service name. Check the Azure Portal or output logs.
214281

215282
<p align="right">(<a href="#readme-top">back to top</a>)</p>
216283

src/movie-analyst-ui/package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)