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
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.8-slim
WORKDIR /app
COPY . .
RUN 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
RUN pip install --upgrade pip setuptools
RUN pip install --trusted-host pypi.python.org -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ Welcome to the Web App DevOps Project repo! This application allows you to effic

## Table of Contents

- [Features](#features)
- [Getting Started](#getting-started)
- [Technology Stack](#technology-stack)
- [Contributors](#contributors)
- [License](#license)
- [Web-App-DevOps-Project](#web-app-devops-project)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [Technology Stack](#technology-stack)
- [Contributors](#contributors)
- [License](#license)

## Features

Expand All @@ -26,6 +30,9 @@ Welcome to the Web App DevOps Project repo! This application allows you to effic

- **Data Validation:** Ensure data accuracy and completeness with required fields, date restrictions, and card number validation.

- **Additional feature (delivery date):** It may be possible to add an additonal column for delivery date

-
## Getting Started

### Prerequisites
Expand Down Expand Up @@ -60,3 +67,5 @@ To run the application, you simply need to run the `app.py` script in this repos
## License

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


6 changes: 6 additions & 0 deletions aks-terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#files not to be tracked
aks-terraform/terraform.tfstate

aks-terraform/networking-module/.terraform

aks-terraform/aks-cluster-module/.terraform/providers/registry.terraform.io/hashicorp/azurerm/3.91.0/darwin_arm64
22 changes: 22 additions & 0 deletions aks-terraform/aks-cluster-module/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "azurerm_kubernetes_cluster" "aks_cluster" {
name = var.aks_cluster_name
location = var.cluster_location
resource_group_name = var.resource_group_name
dns_prefix = var.dns_prefix
kubernetes_version = var.kubernetes_version

default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_DS2_v2"
enable_auto_scaling = true
min_count = 1
max_count = 3
}

service_principal {
client_id = var.service_principal_client_id
client_secret = var.service_principal_client_secret
}
}

14 changes: 14 additions & 0 deletions aks-terraform/aks-cluster-module/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "aks_cluster_name" {
description = "Name of the AKS cluster."
value = azurerm_kubernetes_cluster.aks_cluster.name
}

output "aks_cluster_id" {
description = "ID of the AKS cluster."
value = azurerm_kubernetes_cluster.aks_cluster.id
}

output "aks_kubeconfig" {
description = "Kubeconfig file for accessing the AKS cluster."
value = azurerm_kubernetes_cluster.aks_cluster.kube_config_raw
}
60 changes: 60 additions & 0 deletions aks-terraform/aks-cluster-module/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
variable "aks_cluster_name" {
default = "terraform-aks-cluster"
type = string
description = "name of AKS cluster"
}

variable "cluster_location" {
default = "UK South"
type = string
description = "location of AKS cluster"
}

variable "dns_prefix" {
default = "myaks-project"
type = string
description = "the DNS prefic of cluster"
}

variable "kubernetes_version" {
default = "1.26.6"
type = string
description = "version of kubernetes used for AKS cluster"
}

variable "service_principal_client_id" {


}

variable "service_principal_client_secret" {


}

variable "resource_group_name" {


}


variable "vnet_id" {


}

variable "control_plane_subnet_id" {



}

variable"worker_node_subnet_id" {


}

variable "aks_nsg_id" {


}
47 changes: 47 additions & 0 deletions aks-terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
}
}

provider "azurerm" {
features {}
client_id = var.client_id
client_secret = var.client_secret
subscription_id = "6219b3ad-1cf8-451d-95de-cc14e4f48dbd"
tenant_id = "47d4542c-f112-47f4-92c7-a838d8a5e8ef"
}

module "networking" {
source = "./networking-module"

# Input variables for the networking module
resource_group_name = "networking-rg"
location = "UK South"
vnet_address_space = ["10.0.0.0/24"]
# Define more input variables as needed...
}

module "aks_cluster" {
source = "./aks-cluster-module"

# Input variables for the AKS cluster module
aks_cluster_name = "terraform-aks-cluster"
cluster_location = "UK South"
dns_prefix = "myaks-project"
kubernetes_version = "1.26.6" # Adjust the version as needed
service_principal_client_id = var.client_id
service_principal_client_secret = var.client_secret

# Input variables referencing outputs from the networking module
resource_group_name = module.networking.resource_group_name
vnet_id = module.networking.vnet_id
control_plane_subnet_id = module.networking.control_plane_subnet_id
worker_node_subnet_id = module.networking.worker_node_subnet_id
aks_nsg_id = module.networking.aks_nsg_id

# Define more input variables as needed...
}
55 changes: 55 additions & 0 deletions aks-terraform/networking-module/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
resource "azurerm_resource_group" "aks_group" {
name = "networking-rg"
location = "UK South"
}

resource "azurerm_virtual_network" "aks_vnet" {
name = "aks-terraform-vnet"
location = var.location
resource_group_name = var.resource_group_name
address_space = ["10.0.0.0/16"]
}

resource "azurerm_subnet" "control_plane_subnet" {
name = "control-plane-subnet"
resource_group_name = azurerm_resource_group.aks_group.name
virtual_network_name = azurerm_virtual_network.aks_vnet.name
address_prefixes = ["10.0.1.0/24"]
}

resource "azurerm_subnet" "worker_node" {
name = "worker-node-subnet"
resource_group_name = azurerm_resource_group.aks_group.name
virtual_network_name = azurerm_virtual_network.aks_vnet.name
address_prefixes = ["10.0.2.0/24"]
}

resource "azurerm_network_security_group" "aks_nsg" {
name = "aks-nsg"
location = azurerm_resource_group.aks_group.location
resource_group_name = azurerm_resource_group.aks_group.name

security_rule {
name = "kube-apiserver-rule"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "2603:1020:702:3::21" # Replace with your public IP or IP range
destination_address_prefix = "*"
}
security_rule {
name = "ssh-rule"
priority = 1002
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "2603:1020:702:3::21" # Replace with your public IP or IP range
destination_address_prefix = "*"
}
}

25 changes: 25 additions & 0 deletions aks-terraform/networking-module/outputs.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.id
}

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


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" {
default = "networking-rg"
type = string
description = "the name of resource group"
}

variable "location" {
default = "UK South"
type = string
description = "deployment"

}

variable "vnet_address_space" {
default = ["10.0.0.0/16"]
type = list(string)
description = "ip address of virtual network"
}
11 changes: 11 additions & 0 deletions aks-terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "client_id" {
description = "Access key for the provider"
type = string
sensitive = true
}

variable "client_secret" {
description = "Secret key for the provider"
type = string
sensitive = true
}