Skip to content

Jeriah12/infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Infrastructure

This repository contains all the infrastructure code required to deploy and manage the e-commerce platform, including Terraform scripts, Kubernetes manifests, and cloud configuration.

Table of Contents

Overview

This repository uses Infrastructure as Code (IaC) principles to provision, deploy, and manage the entire e-commerce platform. It includes:

  • Cloud resources provisioning with Terraform
  • Microservices deployment on Kubernetes
  • Configurations for Docker-based services
  • CI/CD pipeline integration for automated deployment

Technology Stack

  • IaC: Terraform
  • Container Orchestration: Kubernetes
  • Containerization: Docker
  • Cloud: AWS
  • CI/CD Tools: Github Actions

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Terraform v1.0 or higher
  • kubectl command-line tool
  • Docker installed and running
  • AWS CLI
  • AWS IAM credential

Directory Structure

The repository is structured as follows:

infrastructure/
├── terraform/
│   ├── main.tf
│   ├── variables.tf
│   ├── outputs.tf
│   └── modules/
├── kubernetes/
│   ├── deployments/
│   │   ├── user-service-deployment.yaml
│   │   ├── product-service-deployment.yaml
│   │   └── ...
│   ├── services/
│   │   ├── user-service.yaml
│   │   ├── product-service.yaml
│   │   └── ...
│   ├── ingress/
│   │   └── ingress.yaml
│   └── configmaps-secrets/
│       ├── configmap.yaml
│       └── secret.yaml
└── README.md

Installation

  1. Navigate to the Terraform directory:
cd terraform
  1. Initialise Terraform:
terraform init
  1. Review the execution plan:
terraform plan
  1. Apply the Terraform scripts:
terraform apply

This will provision the necessary cloud infrastructure, including the Kubernetes cluster, networking components, storage, and other cloud resources.

Kubernetes Setup

  1. Configure kubect1: Ensure your kubect1 context is set to the newly created Kubernetes cluster.

2.Deploy Services: Apply the Kubernetes manifests to deploy your services.

kubectl apply -f kubernetes/deployments/
kubectl apply -f kubernetes/services/

3.Apply ConfigMaps and Secrets

kubectl apply -f kubernetes/configmaps-secrets/
  1. Set up Ingress: If you are using ingress for routing traffic to your services:
kubectl apply -f kubernetes/ingress/ingress.yaml

Infrastructure Deployment

Once the infrastructure is deployed, you can view the resources in the AWS Console. Additionally, you can use Terraform to manage and update your infrastructure as needed.

Testing

Terraform Testing

You can validate your Terraform code using terraform validate to ensure there are no syntax or configuration errors:

terraform validate

You can also run terraform plan to simulate changes without applying them.

Kubernetes Testing

After deploying services to Kubernetes, you can check the status of the pods and services:

kubectl get pods
kubectl get services

Ensure that all pods are running and services are accessible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published