{"id":15176583,"url":"https://github.com/allwelldotdev/sock-shop","last_synced_at":"2026-01-20T22:01:36.379Z","repository":{"id":253016206,"uuid":"842185667","full_name":"allwelldotdev/sock-shop","owner":"allwelldotdev","description":"A sock shop microservices app deployment using weaveworks deployment scripts \u0026 config","archived":false,"fork":false,"pushed_at":"2024-09-24T17:26:39.000Z","size":4112,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T19:45:29.566Z","etag":null,"topics":["alertmanager","aws","cicd","docker","eks","grafana","hashicorp","kubernetes","microservices","prometheus","terraform"],"latest_commit_sha":null,"homepage":null,"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/allwelldotdev.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T21:06:48.000Z","updated_at":"2024-09-24T17:26:42.000Z","dependencies_parsed_at":"2024-08-14T01:12:14.650Z","dependency_job_id":"2d0e4273-35ae-4a6a-9921-468a5a740509","html_url":"https://github.com/allwelldotdev/sock-shop","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"5c1c7bd86e32eae002014a560895256767477ee4"},"previous_names":["allwelldotdev/sock-shop"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/allwelldotdev/sock-shop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allwelldotdev%2Fsock-shop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allwelldotdev%2Fsock-shop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allwelldotdev%2Fsock-shop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allwelldotdev%2Fsock-shop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allwelldotdev","download_url":"https://codeload.github.com/allwelldotdev/sock-shop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allwelldotdev%2Fsock-shop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28615542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T21:52:42.722Z","status":"ssl_error","status_checked_at":"2026-01-20T21:52:20.513Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["alertmanager","aws","cicd","docker","eks","grafana","hashicorp","kubernetes","microservices","prometheus","terraform"],"created_at":"2024-09-27T13:21:35.030Z","updated_at":"2026-01-20T22:01:36.364Z","avatar_url":"https://github.com/allwelldotdev.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Deployment \u0026 Monitoring of Java-based Sock-Shop Microservices App from WeaveWorks on AWS EKS\n\nThe sock-shop app is a microservice architecture that comprises of 14 application services distributed across a Kubernetes Cluster of 3 worker nodes and 1 'managed' control plane (managed by AWS' Elastic Kubernetes Service or EKS). It's a moderately engaging microservice architecture that teaches and demonstrates the mechanism and workflow involved in a microservice deployment and orchestration on Kubernetes.\n\nWithin this README, I endeavour to elaborate my process of building, architecting, and orchestrating the sock-shop microservice application using:\n1. Infrastructure as code (IAC) tools like Terraform,\n2. Version control tools like Git,\n3. Containerization Technnologies like Docker and ContainerD,\n4. Orchestration tools like Kubernetes (K8s),\n5. A Kubernetes Package Manager tool known as Helm,\n6. Cluster monitoring tools such as:\n   1. Prometheus for cluster, node, and pod metrics,\n   2. Grafana for data visualization of metrics (primarily datasourced by Prometheus),\n   3. Alertmanager for alerting \u0026 notifications.\n7. Bash scripting for automating and securing workflows,\n8. Cluster Ingress Controller tools such as ingress-nginx,\n9. Cluster HTTPS TLS Certificate Authority Management tools such as cert-manager,\n10. Cloud-managed Kubernetes Services like AWS EKS.\n\n## Project Filesystem\n\nBelow I provide my project filesystem organization for easy traversal and understanding of my project workflow, files, directories, and application.\n\n```plaintext\n.\n|-- deploy\n|   |-- ingress\n|   |   |-- issuer.yaml\n|   |   `-- sockshop\n|   |       `-- ingress.yaml\n|   |-- manifests\n|   |   |-- 00-sock-shop-ns.yaml\n|   |   |-- 01-carts-dep.yaml\n|   |   |-- 02-carts-svc.yml\n|   |   |-- 03-carts-db-dep.yaml\n|   |   |-- 04-carts-db-svc.yaml\n|   |   |-- 05-catalogue-dep.yaml\n|   |   |-- 06-catalogue-svc.yaml\n|   |   |-- 07-catalogue-db-dep.yaml\n|   |   |-- 08-catalogue-db-svc.yaml\n|   |   |-- 09-front-end-dep.yaml\n|   |   |-- 10-front-end-svc.yaml\n|   |   |-- 11-orders-dep.yaml\n|   |   |-- 12-orders-svc.yaml\n|   |   |-- 13-orders-db-dep.yaml\n|   |   |-- 14-orders-db-svc.yaml\n|   |   |-- 15-payment-dep.yaml\n|   |   |-- 16-payment-svc.yaml\n|   |   |-- 17-queue-master-dep.yaml\n|   |   |-- 18-queue-master-svc.yaml\n|   |   |-- 19-rabbitmq-dep.yaml\n|   |   |-- 20-rabbitmq-svc.yaml\n|   |   |-- 21-session-db-dep.yaml\n|   |   |-- 22-session-db-svc.yaml\n|   |   |-- 23-shipping-dep.yaml\n|   |   |-- 24-shipping-svc.yaml\n|   |   |-- 25-user-dep.yaml\n|   |   |-- 26-user-svc.yaml\n|   |   |-- 27-user-db-dep.yaml\n|   |   `-- 28-user-db-svc.yaml\n|   `-- monitoring\n|       |-- alertmanager\n|       |   `-- test-slack-integration.sh\n|       `-- values.yaml\n`-- terraform\n    |-- main.tf\n    |-- outputs.tf\n    |-- terraform.tf\n    `-- variables.tf\n\n7 directories, 37 files\n```\n\n## Sock-Shop Architecture\n\nBelow is the Kubernetes deployment architecture of the sock-shop microservices app.\n\n\u003e Sock-Shop AWS EKS Cloud Architecture\n\n![sock-shop-cloud-architecture.png](./img/architecture/cloud-arch.jpg)\n\n\u003e Sock-Shop Microservices App Architecture\n\n![sock-shop-software-architecture.png](./img/architecture/software-arch.jpg)\n\n## Deployment Walkthrough\n\n### Sourcing Environment Variables\n\nBefore we commence the deployment walkthrough, there are some environment variables required for some technologies to functions properly which I provision within my dev and prod environment but are not available with this git repo. You'll have to generate them using your own outputs for your own use. These environment variables are:\n- `SLACK_WEBHOOK_URL`\n- `SLACK_CHANNEL`\n- `GRAFANA_ADMIN_PASSWORD`\n- `LETS_ENCRYPT_EMAIL`\n- awscli configuration credentials and environment variables (needed by Terraform IAC).\n\nThis is done to improve the security of our deployment and version control storage of our config files. To include environment variables in the configuration, export them into the shell/terminal process like so:\n\n```bash\nexport SLACK_WEBHOOK_URL='input_url_here'\n```\n\nOr via a file, like so:\n\n```bash\nsource /path/to/file\n```\n\n### Building AWS EKS Infrastructure using Terraform\n\n```console\nterraform init\n```\n\nI used Terraform (IAC) to automate, plan, and manage the infrastructure building of AWS EKS. My Terraform configuration `./terraform/main.tf` creates:\n- a VPC (Virtual Private Cloud) in AWS,\n- 3 private and public subnets within the VPC,\n- an EKS (AWS Kubernetes Service) in the private subnets spread across 3 availabliity zones for high-availability,\n- and an AWS IAM role that allows the EKS service to assume an IAM role to create persistent volumes and block storage with the cluster.\n\n```console\nterraform plan\n```\n\nTo run the Terraform configuration, I have added variables to allow further customization and infrastructure management. These variables, which can be found in `./terraform/variables.tf`, include:\n- `aws_region` [The aws region to create resources in. Default: `us-east-1`],\n- `vpc_cidr` [The VPC CIDR block. Default: `10.0.0.0/16`],\n- `private_subnet_cidrs` [The private subnet CIDR block. Default: `[\"10.0.0.0/24\", \"10.0.1.0/24\", \"10.0.2.0/24\"]`]\n- `public_subnet_cidrs` [The public subnet CIDR block. Default: `[10.0.100.0/24\", \"10.0.101.0/24\", \"10.0.102.0/24]`]\n- `instance_type` [The instance type to use for the Kubernetes nodes. Default: `t3.large`],\n- `node_count` [The number of nodes in the cluster. Default: `3`].\n\n```console\nterraform apply\n```\n\nThe Terraform configuration takes ~ 10 mins to run. After it's finished running, the following outputs below are parsed which allow me to configure my kubectl Kubernetes server using the AWS EKS kubeconfig I just spun up using Terraform IAC. Terraform outputs include:\n- `cluster_endpoint` [Endpoint for EKS control plane]\n- `region` [AWS region]\n- `cluster_name` [Kubernetes Cluster Name]\n\n```console\naws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)\n```\n\n### Deploy Microservices in Kubernetes Cluster\n\nAt this point, I've configured three things; environment variables, AWS EKS using terraform, and kubeconfig. Next, I deploy the sock-shop microservices app via the Kubernetes manifests in `./deploy/manifests/`.\n\n```console\nkubectl apply -f deploy/manifests\n```\n\n\u003e At the first attempt of deploying the raw config files from the [deprecated Weaveworks repo](https://github.com/microservices-demo/microservices-demo), I came up on some errors which I later engineered solutions for (to be described in a later heading to be titled 'Encountered Problems \u0026 Solutions').\n\n### Deploy Monitoring \n\nOnce sock-shop microservices is deployed in Kubernetes cluster, I used Helm to install Kubernetes monitoring resources like Prometheus, Grafana, and AlertManager via the kube\n\n```console\nenvsubst \u003c source_file | helm install prometheus -n monitoring --values=-\n```\n\n...[updating]\n\n## Sock-Shop Deployment \u0026 Monitoring Images\n\n\u003e WeaveWorks Sock-Shop microservice app deployed on Kubernetes Cluster (AWS EKS).\n\n![sock-shop-deployed.png](./img/sock-shop-deployed.png)\n\n\u003e Fully Qualified Domain Name (FQDN) \"sockshop.allwell.cloud\" affixed/configured together with ingress and tls termination at the ingress controller (powered by cert-manager).\n\n![sock-shop-tls-certificate-configured.png](./img/sock-shop-tls-certificate-configured.png)\n\n\u003e Testing: trying to log into sock-shop microservice app to test `user` and `user-db` service.\n\n![sock-shop-login.png](./img/sock-shop-login.png)\n\n\u003e Logged in! (see user credentials at top-right of browser window) Testing: `cart` and `cart-db` service is working. I changed the container image from `:latest` to an older, more stable image, different from what was specified in the WeaveWorks config files to get it to function properly.\n\n![sock-shop-cart-solution.png](./img/sock-shop-cart-solution.png)\n\n\u003e Testing: confirmed Prometheus connection to the cluster, nodes, and pods, by checking status targets. They were all UP.\n\n![prometheus-status-targets-up.png](./img/prometheus-status-targets-up.png)\n\n\u003e Monitoring: node CPU load with a 15-min interval on Prometheus.\n\n![prometheus-node-load-per-15min-interval.png](./img/prometheus-node-load-per-15min-interval.png)\n\n\u003e Data Visualization: Grafana datasourcing node-exporter metrics from Prometheus of all 3 worker node and displaying it.\n\n![grafana-node-exporter-data-by-nodes.png](./img/grafana-node-exporter-data-by-nodes.png)\n\n\u003e Data Visualization: Grafana displaying Kubernetes Compute Resources by Cluster.\n\n![grafana-kubernetes-compute-resources-by-cluster.png](./img/grafana-kubernetes-compute-resources-by-cluster.png)\n\n\u003e Data Visualization: Grafana displaying Kubernetes Compute Resources by Namespace (Pods).\n\n![grafana-kubernetes-compute-resources-by-namespace-pods.png](./img/grafana-kubernetes-compute-resources-by-namespace-pods.png)\n\n\u003e Alerting: Alertmanager configured to send firing alerts to Slack channel called `#sockshop-alerts`.\n\n![alertmanager-alerts-to-slack-firing.png](./img/alertmanager-alerts-to-slack-firing.png)\n\n\n\u003c!-- The WeaveWorks sock-shop microservices app deployment using WeaveWork's deployment scripts \u0026amp; config. --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallwelldotdev%2Fsock-shop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallwelldotdev%2Fsock-shop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallwelldotdev%2Fsock-shop/lists"}