{"id":20112971,"url":"https://github.com/cloudacademy/stocks-app-eks","last_synced_at":"2025-05-06T11:32:24.268Z","repository":{"id":183405372,"uuid":"668896845","full_name":"cloudacademy/stocks-app-eks","owner":"cloudacademy","description":"🚀 Kubernetes Stocks App - Cloud Native Development","archived":false,"fork":false,"pushed_at":"2023-12-01T03:11:36.000Z","size":2504,"stargazers_count":0,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T07:42:47.509Z","etag":null,"topics":["aws","cloudacademy","containers","devops","eks","kubernetes","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudacademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-20T21:19:17.000Z","updated_at":"2023-07-24T10:11:27.000Z","dependencies_parsed_at":"2023-09-27T09:55:29.958Z","dependency_job_id":null,"html_url":"https://github.com/cloudacademy/stocks-app-eks","commit_stats":null,"previous_names":["cloudacademy/stocks-app-eks"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fstocks-app-eks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fstocks-app-eks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fstocks-app-eks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fstocks-app-eks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudacademy","download_url":"https://codeload.github.com/cloudacademy/stocks-app-eks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224501640,"owners_count":17321869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cloudacademy","containers","devops","eks","kubernetes","terraform"],"created_at":"2024-11-13T18:23:04.512Z","updated_at":"2025-05-06T11:32:24.262Z","avatar_url":"https://github.com/cloudacademy.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://github.com/cloudacademy/stocks-app-eks/actions/workflows/release.yml/badge.svg) \n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/cloudacademy/stocks-app-eks)\n\n## EKS Cluster and Stocks Cloud Native App Deployment\nThe following instructions are provided to demonstrate how to provision a new EKS cluster and automatically deploy a fully functional Stocks cloud native web application.\n\nAn equivalent **ECS** setup is located here:\nhttps://github.com/cloudacademy/stocks-app-ecs\n\n![Stocks App](/docs/stocks.png)\n\n### Kubernetes Architecture\nTwo 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`.\n\n```\nlocals {\n  name        = \"cloudacademydevops\"\n  environment = \"prod\"\n\n  vpc_cidr = \"10.0.0.0/16\"\n  azs      = slice(data.aws_availability_zones.available.names, 0, 2)\n  //returns\n  #   tolist([\n  #   \"us-west-2a\",\n  #   \"us-west-2b\"\n  # ])\n\n  k8s = {\n    stocks_app_architecture = \"arch1\" #either arch1 or arch2\n\n    cluster_name   = \"${local.name}-eks-${local.environment}\"\n    version        = \"1.31\"\n    instance_types = [\"m5.large\"]\n    capacity_type  = \"ON_DEMAND\"\n    disk_size      = 20\n    min_size       = 2\n    max_size       = 2\n    desired_size   = 2\n  }\n\n  rds = {\n    master_username = \"root\"\n    master_password = \"followthewhiterabbit\"\n    db_name         = \"cloudacademy\"\n    engine          = \"aurora-mysql\"\n    engine_version  = \"8.0.mysql_aurora.3.08.0\"\n    acu = {\n      min = 0.5\n      max = 1.0\n    }\n  }\n}\n```\n\n#### Architecture 1 (arch1):\n\n![Stocks App](/docs/eks-stocks-arch1.png)\n\n#### Architecture 2 (arch2):\n\n![Stocks App](/docs/eks-stocks-arch2.png)\n\n### Web Application Architecture\nThe Stocks cloud native web app consists of the following 3 main components:\n\n#### Stocks Frontend (App)\n\nImplements a web UI using the following languages/frameworks/tools:\n\n- React 16\n- Yarn\n- Nginx\n\nSource Code and Artifacts:\n\n- GitHub Repo: https://github.com/cloudacademy/stocks-app\n- Container Image: [cloudacademydevops/stocks-app:v2](https://hub.docker.com/r/cloudacademydevops/stocks-app)\n\n#### Stocks API\n\nImplements a RESTful based API using the following languages/frameworks/tools:\n\n- Java 17\n- Spring Boot\n- Maven 3\n\nSource Code and Artifacts:\n\n- GitHub Repo: https://github.com/cloudacademy/stocks-api\n- Container Image: [cloudacademydevops/stocks-api:v2](https://hub.docker.com/r/cloudacademydevops/stocks-api)\n\n#### Stocks DB\n\nAurora RDS DB (serverless v2) SQL database:\n\n- MySQL 8.0\n\n### Prerequisites\nEnsure that the following tools are installed and configured appropriately.\n\n- Terraform CLI\n- AWS CLI\n- Helm CLI\n- Kubectl CLI\n\n**Note**: The terraforming commands below have been tested successfully using the following versions:\n\n- `terraform`: 1.5.3\n- `aws`: aws-cli/2.13.2\n- `helm`: 3.12.2\n- `kubectl`: 1.27.4\n\n### Installation\n\n1. Application Deployment\n\n    1.1. Initialise the Terraform working directory. Execute the following commands:\n\n    ```\n    cd terraform\n    terraform init\n    ```\n\n    1.2. Provision a new EKS cluster and deploy the Stocks cloud native application automatically. Execute the following command:\n\n    ```\n    terraform apply -auto-approve\n    ```\n\n2. Confirm Access to the EKS Cluster\n\n    2.1. Examine the EKS nodes setup. If this command returns successfully then the EKS cluster and access to it has been established successfully.\n\n    ```\n    kubectl get nodes\n    ```\n\n    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:\n\n    ```\n    export KUBECONFIG=$(pwd)/config\n    aws eks --region us-west-2 update-kubeconfig --name cloudacademydevops-eks\n    ```\n\n3. Examine EKS Cluster Resources\n\n    3.1. Check Namespaces\n\n    ```\n    kubectl get ns\n    ```\n\n    3.2. Check Ingress Controller Setup\n\n    ```\n    kubectl get all -n nginx-ingress\n    ```\n\n    3.3. Check Cloud Native App Setup\n\n    ```\n    kubectl get all,ingress,secret -n cloudacademy\n    ```\n\n4. Examine Aurora RDS DB\n\n    4.1. List Database Clusters\n\n    ```\n    aws rds describe-db-clusters --region us-west-2\n    ```\n\n    4.2. List Database Cluster Endpoints\n\n    ```\n    aws rds describe-db-cluster-endpoints --db-cluster-identifier cloudacademy --region us-west-2\n    ```\n\n5. Generate and Test Stocks API Endpoint\n\n    Execute the following command to generate Stocks API URL:\n\n    ```\n    echo http://$(kubectl get ing -n cloudacademy public -o jsonpath=\"{.spec.rules[0].host}\")/api/stocks/csv\n    ```\n\n    Copy the URL from the previous output and browse to it within your own browser. Confirm that the Stocks CSV formatted data is accessible.\n\n6. Generate and Test Stocks APP (frontend) Endpoint\n\n    Execute the following command to generate Stocks API URL:\n\n    ```\n    echo http://$(kubectl get ing -n cloudacademy public -o jsonpath=\"{.spec.rules[0].host}\")\n    ```\n\n    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.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fstocks-app-eks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudacademy%2Fstocks-app-eks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fstocks-app-eks/lists"}