Giter Site home page Giter Site logo

2024-stocks-app-eks's Introduction

Build Status GitHub release (latest SemVer)

EKS Cluster and Stocks Cloud Native App Deployment

The following instructions are provided to demonstrate how to provision a new EKS cluster and automatically deploy a fully functional Stocks cloud native web application.

An equivalent ECS setup is located here: https://github.com/cloudacademy/stocks-app-ecs

Stocks App

Kubernetes Architecture

Two different Kubernetes architectures are provided for the deployment of the Stocks cloud native web app. The main difference between architectures is the Stock API routing path. To swap between the different architectures, set the k8s.stocks_app_architecture local variable to be either arch1 or arch2.

locals {
  name        = "cloudacademydevops"
  environment = "prod"

  vpc_cidr = "10.0.0.0/16"
  azs      = slice(data.aws_availability_zones.available.names, 0, 2)
  //returns
  #   tolist([
  #   "us-west-2a",
  #   "us-west-2b"
  # ])

  k8s = {
    stocks_app_architecture = "arch1" #either arch1 or arch2

    cluster_name   = "${local.name}-eks-${local.environment}"
    version        = "1.27"
    instance_types = ["m5.large"]
    capacity_type  = "ON_DEMAND"
    disk_size      = 10
    min_size       = 2
    max_size       = 2
    desired_size   = 2
  }

  rds = {
    master_username = "root"
    master_password = "followthewhiterabbit"
    db_name         = "cloudacademy"
    scaling_min     = 2
    scaling_max     = 4
  }
}

Architecture 1 (arch1):

Stocks App

Architecture 2 (arch2):

Stocks App

Web Application Architecture

The Stocks cloud native web app consists of the following 3 main components:

Stocks Frontend (App)

Implements a web UI using the following languages/frameworks/tools:

  • React 16
  • Yarn
  • Nginx

Source Code and Artifacts:

Stocks API

Implements a RESTful based API using the following languages/frameworks/tools:

  • Java 17
  • Spring Boot
  • Maven 3

Source Code and Artifacts:

Stocks DB

Aurora RDS DB (serverless v1) SQL database:

  • MySQL 5.7

Prerequisites

Ensure that the following tools are installed and configured appropriately.

  • Terraform CLI
  • AWS CLI
  • Helm CLI
  • Kubectl CLI

Note: The terraforming commands below have been tested successfully using the following versions:

  • terraform: 1.5.3
  • aws: aws-cli/2.13.2
  • helm: 3.12.2
  • kubectl: 1.27.4

Installation

  1. Application Deployment

    1.1. Initialise the Terraform working directory. Execute the following commands:

    cd terraform
    terraform init
    

    1.2. Provision a new EKS cluster and deploy the Stocks cloud native application automatically. Execute the following command:

    terraform apply -auto-approve
    
  2. Confirm Access to the EKS Cluster

    2.1. Examine the EKS nodes setup. If this command returns successfully then the EKS cluster and access to it has been established successfully.

    kubectl get nodes
    

    If the previous command errors out due to an authentication issue, consider running the following AWS CLI command to re-establish a KUBECONFIG settings file:

    export KUBECONFIG=$(pwd)/config
    aws eks --region ap-south-1 update-kubeconfig --name cloudacademydevops-eks
    
  3. Examine EKS Cluster Resources

    3.1. Check Namespaces

    kubectl get ns
    

    3.2. Check Ingress Controller Setup

    kubectl get all -n nginx-ingress
    

    3.3. Check Cloud Native App Setup

    kubectl get all,ingress,secret -n cloudacademy
    
  4. Examine Aurora RDS DB

    4.1. List Database Clusters

    aws rds describe-db-clusters --region us-west-2
    

    4.2. List Database Cluster Endpoints

    aws rds describe-db-cluster-endpoints --db-cluster-identifier cloudacademy --region us-west-2
    
  5. Generate and Test Stocks API Endpoint

    Execute the following command to generate Stocks API URL:

    echo http://$(kubectl get ing -n cloudacademy public -o jsonpath="{.spec.rules[0].host}")/api/stocks/csv
    

    Copy the URL from the previous output and browse to it within your own browser. Confirm that the Stocks CSV formatted data is accessible.

  6. Generate and Test Stocks APP (frontend) Endpoint

    Execute the following command to generate Stocks API URL:

    echo http://$(kubectl get ing -n cloudacademy public -o jsonpath="{.spec.rules[0].host}")
    

    Copy the URL from the previous output and browse to it within your own browser. Confirm that the Stocks App (frontend) loads successfully, complete with stocks data.

2024-stocks-app-eks's People

Contributors

jeremycook123 avatar rstraining4 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.