Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.terraform/
*terraform.tfstate
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# TODO: Step 1 - Use an official Python runtime as a parent image. You can use `python:3.8-slim`.
FROM python:3.8-slim
# TODO: Step 2 - Set the working directory in the container
WORKDIR /app
# TODO: Step 3 Copy the application files in the container
COPY . .
# Install system dependencies and ODBC driver
RUN apt-get update && apt-get install -y \
unixodbc unixodbc-dev odbcinst odbcinst1debian2 libpq-dev gcc && \
apt-get install -y gnupg && \
apt-get install -y wget && \
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
wget -qO- https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y msodbcsql18 && \
apt-get purge -y --auto-remove wget && \
apt-get clean

# Install pip and setuptools
RUN pip install --upgrade pip setuptools

# TODO: Step 4 - Install Python packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# TODO: Step 5 - Expose port
EXPOSE 5000
# TODO: Step 6 - Define Startup Command
CMD ["python", "app.py"]
72 changes: 67 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Welcome to the Web App DevOps Project repo! This application allows you to effic
## Features

- **Order List:** View a comprehensive list of orders including details like date UUID, user ID, card number, store code, product code, product quantity, order date, and shipping date.

![Screenshot 2023-08-31 at 15 48 48](https://github.com/maya-a-iuga/Web-App-DevOps-Project/assets/104773240/3a3bae88-9224-4755-bf62-567beb7bf692)

- **Pagination:** Easily navigate through multiple pages of orders using the built-in pagination feature.

![Screenshot 2023-08-31 at 15 49 08](https://github.com/maya-a-iuga/Web-App-DevOps-Project/assets/104773240/d92a045d-b568-4695-b2b9-986874b4ed5a)

- **Add New Order:** Fill out a user-friendly form to add new orders to the system with necessary information.

![Screenshot 2023-08-31 at 15 49 26](https://github.com/maya-a-iuga/Web-App-DevOps-Project/assets/104773240/83236d79-6212-4fc3-afa3-3cee88354b1a)

- **Data Validation:** Ensure data accuracy and completeness with required fields, date restrictions, and card number validation.
Expand Down Expand Up @@ -53,10 +53,72 @@ To run the application, you simply need to run the `app.py` script in this repos

- **Database:** The application employs an Azure SQL Database as its database system to store order-related data.

## Contributors
## Contributors

- [Maya Iuga]([https://github.com/yourusername](https://github.com/maya-a-iuga))
- [Maya Iuga](<[https://github.com/yourusername](https://github.com/maya-a-iuga)>)

## License

This project is licensed under the MIT License. For more details, refer to the [LICENSE](LICENSE) file.

## Robin Winters Azure End-to-End DevOps Pipeline Project

1. _delivery-date column:_ delivery_date added to both backend (app.py) and frontend (order.html) files.
2. _removed delivery-date column:_ delivery_date removed from both backend (app.py) and frontend (order.html) files.

### Containerization

1. Dockerfile created based on python:3.8-slim
2. Docker image builded.
**imagename:** web-app-image
**imagetag:** 1.0
3. Image pushed to Docker Hub

- Image can be seen from the link below
- https://hub.docker.com/repository/docker/robinwinters/web-app-image/general

### Networking Services Deployment with Terraform

#### Overview

This repository contains Terraform configurations for deploying networking resources in Azure, including a Virtual Network (VNet), subnets, and Network Security Groups (NSGs). This README provides an overview of the networking services deployed using Infrastructure as Code (IaC) with Terraform.

#### Prerequisites

Before running the Terraform configurations, ensure you have the following prerequisites set up:

Azure subscription
Azure CLI installed and configured
Terraform CLI installed

#### Terraform Configuration

1. Input Variables

- resource_group_name: The name of the Azure resource group where networking resources will be created.
- location: The Azure region where networking resources will be deployed.
- vnet_address_space: The address space for the Virtual Network (VNet).

2. Networking Resources

- Azure Resource Group
- Virtual Network (VNet)
- Subnets
- Network Security Group (NSG)

3. Output Variables
- vnet_id: ID of the Virtual Network (VNet).
- control_plane_subnet_id: ID of the control plane subnet.
- worker_node_subnet_id: ID of the worker node subnet.
- resource_group_name: Name of the Azure Resource Group for networking resources.
- aks_nsg_id: ID of the Network Security Group (NSG) for AKS.

#### Usage

1. Clone Repository: Clone this repository to your local machine.
2. Set Terraform Variables: Update the variables.tf file with your desired values for input variables.
3. Initialize Terraform: Run terraform init to initialize the Terraform configuration.
4. Review Execution Plan: Run terraform plan to review the execution plan and ensure it matches your expectations.
5. Apply Terraform Changes: Run terraform apply to apply the Terraform changes and deploy networking resources to Azure.

- \*\*git can only support files of a certain size & that the .terraform is larger so has to be avoided
Binary file added aks-terraform/.DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions aks-terraform/networking-module/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions aks-terraform/networking-module/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Create the Azure Resource Group for networking resources
resource "azurerm_resource_group" "networking" {
name = var.resource_group_name
location = var.location
}

# Define the Virtual Network (VNet) for the AKS cluster
resource "azurerm_virtual_network" "aks_vnet" {
name = "aks-vnet"
address_space = var.vnet_address_space
location = azurerm_resource_group.networking.location
resource_group_name = azurerm_resource_group.networking.name
}

# Define subnets within the VNet for control plane and worker nodes
resource "azurerm_subnet" "control_plane_subnet" {
name = "aks-subnet-control-plane"
resource_group_name = azurerm_resource_group.networking.name
virtual_network_name = azurerm_virtual_network.aks_vnet.name
address_prefixes = ["10.0.1.0/24"]
}

resource "azurerm_subnet" "worker_node_subnet" {
name = "aks-node-subnet"
resource_group_name = azurerm_resource_group.networking.name
virtual_network_name = azurerm_virtual_network.aks_vnet.name
address_prefixes = ["10.0.2.0/24"]
}

# Define Network Security Group (NSG) for the AKS subnet
resource "azurerm_network_security_group" "aks_nsg" {
name = "aks-nsg"
location = azurerm_resource_group.networking.location
resource_group_name = azurerm_resource_group.networking.name
}

# Allow inbound traffic to kube-apiserver (TCP/443) from your public IP address
resource "azurerm_network_security_rule" "kube_apiserver" {
name = "aks-kubi-api-server"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "150.143.254.11"
destination_address_prefix = "*"
resource_group_name = azurerm_resource_group.networking.name
network_security_group_name = azurerm_network_security_group.aks_nsg.name
}

# Allow inbound traffic for SSH (TCP/22) - Optional
resource "azurerm_network_security_rule" "ssh" {
name = "aks-ssh"
priority = 1002
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "150.143.254.11"
destination_address_prefix = "*"
resource_group_name = azurerm_resource_group.networking.name
network_security_group_name = azurerm_network_security_group.aks_nsg.name
}
25 changes: 25 additions & 0 deletions aks-terraform/networking-module/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
output "vnet_id" {
description = "ID of the Virtual Network (VNet)."
value = azurerm_virtual_network.aks_vnet.id
}

output "control_plane_subnet_id" {
description = "ID of the control plane subnet."
value = azurerm_subnet.control_plane_subnet.id
}

output "worker_node_subnet_id" {
description = "ID of the worker node subnet."
value = azurerm_subnet.worker_node_subnet.id
}

output "resource_group_name" {
description = "Name of the Azure Resource Group for networking resources."
value = azurerm_resource_group.networking.name
}

# Define more output variables as needed...
output "aks_nsg_id" {
description = "ID of the Network Security Group (NSG) for AKS."
value = azurerm_network_security_group.aks_nsg.id
}
18 changes: 18 additions & 0 deletions aks-terraform/networking-module/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "resource_group_name" {
description = "The Azure resource group where the networking resources will be created in"
type = string
default = "azure-devops-project-resource-group"

}

variable "location" {
description = "The Azure region where the networking resources will be deployed."
type = string
default = "UK South"
}

variable "vnet_address_space" {
description = "Address space for the Virtual Network (VNet)."
type = list(string)
default = ["10.0.0.0/16"]
}