Skip to content

Terraform repository for deploying Fashion Store Finder's Azure infrastructure with modular and scalable setup.

License

Notifications You must be signed in to change notification settings

CeciliaCode/fashion-finder-infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enter image description here

Fashion Finder Infrastructure

Geo-Referenced Systems

Team Members

  • Becerra Díaz Alejandro
  • González Hernández Juan Pablo
  • Núñez Guerrero Melanie Guadalupe
  • Peña Bravo María Cecilia
  • Trujillo Ramírez César Andrés

Professor

Frausto Ramírez Juan de Dios

Date:

11/12/2024

Program:

Software Engineering and Computational Systems - 712


Table of Contents

  1. Introduction
  2. Prerequisites
  3. Infrastructure Overview
  4. Variables
  5. Usage
  6. Commands
  7. Directory Structure
  8. Troubleshooting
  9. Contributing

Introduction

The Fashion Finder Infrastructure repository is a Terraform-based solution to deploy the backend infrastructure required for the Fashion Finder application. The deployment includes Azure Virtual Machines, Virtual Networks, Subnets, Network Security Groups, and more.

-Fashion Finder application


Prerequisites

  • Terraform v1.3.7+
  • Azure CLI (az) configured and authenticated.
  • Azure subscription with appropriate permissions.
  • SSH keys generated for VM access.
  • Docker installed locally to validate configurations.

Infrastructure Overview

This repository provisions the following resources in Azure:

  1. Virtual Network (VNet): Connects all components securely.
  2. Subnet: Segments network traffic for the virtual machine.
  3. Network Security Group (NSG): Ensures controlled traffic flow.
  4. Virtual Machine: Hosts the Dockerized backend application.
  5. Public IP Address: Provides external access to the application.

Variables

Required Variables

Variable Description
RESOURCE_GROUP Name of the Azure Resource Group.
LOCATION Azure region for deployment.
ENVIRONMENT Deployment environment (dev, staging, prod).
VNET_NAME Name of the Virtual Network.
SUBNET_NAME Name of the Subnet.
SECURITY_GROUP_NAME Name of the Network Security Group.
IP_NAME Name of the Public IP.
NIC_NAME Name of the Network Interface.
SERVER_NAME Name of the Virtual Machine.
PORT Application listening port (e.g., 3000).
MONGODB_URI MongoDB connection string.
MONGO_INITDB_ROOT_USERNAME MongoDB root username.
MONGO_INITDB_ROOT_PASSWORD MongoDB root password.
EMAIL_SERVICE Email service provider (e.g., gmail).
EMAIL_USER Email user account.
EMAIL_PASS Email access token.
ADMIN_USERNAME Admin username for the VM.
SSH_KEY_PATH Path to the SSH private key.

Usage

1. Clone the Repository

git clone https://github.com/CeciliaCode/fashion-finder-infrastructure.git
cd fashion-finder-infrastructure

2. Set Up Environment Variables

Create a terraform.tfvars file in the root directory.

3. Initialize Terraform

Run the following command to initialize the working directory:

terraform init

4. Validate Configuration

Ensure the configuration is correct:

terraform validate

5. Plan Deployment

View the resources to be created:

terraform plan

6. Apply Changes

Deploy the infrastructure:

terraform apply

7. Destroy Infrastructure

Remove all resources:

terraform destroy

Commands

Command Description
terraform init Initialize the working directory.
terraform validate Validate configuration files.
terraform plan Show the execution plan.
terraform apply Apply the configuration and create resources.
terraform destroy Destroy all resources created by Terraform.

Directory Structure

.
├── env/
│   └── dev/
│       ├── main.tf         # Terraform configuration file
│       ├── variables.tf    # Definitions of all variables
│       └── outputs.tf      # Outputs for resources
├── modules/
│   └── vm/
│       ├── main.tf         # VM module configuration
│       ├── variables.tf    # Module variables
│       └── outputs.tf      # Module outputs
├── terraform.tfvars        # Environment-specific variable values
└── README.md               # Project documentation

Troubleshooting

Common Errors

  1. Authentication Error:

    • Ensure you are logged in to Azure using az login.
    • Verify the ARM_CLIENT_ID, ARM_CLIENT_SECRET, ARM_TENANT_ID, and ARM_SUBSCRIPTION_ID are correctly configured in your environment.
  2. SSH Key Not Found:

    • Verify the path to your SSH keys in the SSH_KEY_PATH variable.
  3. Plan/Apply Fails:

    • Ensure all required variables are defined in terraform.tfvars.

About

Terraform repository for deploying Fashion Store Finder's Azure infrastructure with modular and scalable setup.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •