Skip to content

Falconcoder01/realtime-spotify-clone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MERN Spotify App Deployment on Kubernetes🎵✨


🎵 A Spotify-like real-time music streaming web application.

✨This fork extends the original project with Docker containerization and Kubernetes orchestration for seamless deployment and scalability.


Features

  • Real-time music streaming
  • Search and browse playlists
  • User authentication and profiles
  • Realtime updates using WebSockets
  • Containerized with Docker
  • Kubernetes-ready deployment

Tech Stack

  • Frontend: React, TypeScript
  • Backend: Node.js, Express
  • Database: MongoDB
  • Realtime Communication: WebSockets / Socket.IO
  • Containerization: Docker
  • Orchestration: Kubernetes (Deployment, Service, Ingress)

Prerequisites

  • Basic knowledge of Docker,kubernetes and AWS services.
  • An AWS account with necessary permissions.

Setup .env file in backend folder

PORT=...
MONGODB_URI=...
ADMIN_EMAIL=...
NODE_ENV=...

CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...
CLOUDINARY_CLOUD_NAME=...


CLERK_PUBLISHABLE_KEY=...
CLERK_SECRET_KEY=...

Setup .env file in frontend folder

VITE_CLERK_PUBLISHABLE_KEY=...

Getting Started

Step 1: IAM Configuration

  • Create a user eks-admin with AdministratorAccess.
  • Generate Security Credentials: Access Key and Secret Access Key.

Step 2: EC2 Setup

  • Launch an Ubuntu instance in your favourite region (eg. region us-west-2).
  • SSH into the instance from your local machine.

Step 3: Install AWS CLI v2

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt install unzip
unzip awscliv2.zip
sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin --update
aws configure

Step 4: Install Docker

sudo apt-get update
sudo apt install docker.io
docker ps
sudo chown $USER /var/run/docker.sock

Step 5: Install kubectl

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --client

Step 6: Install eksctl

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl version

Step 7: Setup EKS Cluster

eksctl create cluster --name three-tier-cluster --region us-west-2 --node-type t2.medium --nodes-min 2 --nodes-max 2
aws eks update-kubeconfig --region us-west-2 --name three-tier-cluster
kubectl get nodes

Step 8: Run Manifests

kubectl apply -f .
kubectl delete -f .

Step 9: Install AWS Load Balancer

curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/install/iam_policy.json
aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json
eksctl utils associate-iam-oidc-provider --region=us-west-2 --cluster=three-tier-cluster --approve
eksctl create iamserviceaccount --cluster=three-tier-cluster --namespace=kube-system --name=aws-load-balancer-controller --role-name AmazonEKSLoadBalancerControllerRole --attach-policy-arn=arn:aws:iam::626072240565:policy/AWSLoadBalancerControllerIAMPolicy --approve --region=us-west-2

Step 10: Deploy AWS Load Balancer Controller

sudo snap install helm --classic
helm repo add eks https://aws.github.io/eks-charts
helm repo update eks
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=my-cluster --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller
kubectl get deployment -n kube-system aws-load-balancer-controller
kubectl apply -f full_stack_lb.yaml

Cleanup

  • To delete the EKS cluster:
eksctl delete cluster --name three-tier-cluster --region us-west-2
  • To clean up rest of the stuff and not incure any cost
Stop or Terminate the EC2 instance created in step 2.
Delete the Load Balancer created in step 9 and 10.
Go to EC2 console, access security group section and delete security groups created in previous steps

About

Deployed a MERN spotify App on the kubernetes cluster in EKS (AWS)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 77.4%
  • JavaScript 20.3%
  • CSS 1.3%
  • Other 1.0%