The udagram users service is a microservice built with ExpressJS and Typescript provisioned for an AWS EKS Cluster. The microservice is refactored from the monolith version of Udagram. The microservice consists of an simple API handles authentication and locating users within the system.
- Node.js 11.15.0
- PostgreSQL Community Server
- Clone or download the repository
cd
into root directory and runnpm install
- Create a .env file and setup database connection within the config.ts
- Run
npm run dev
to start the local development server.
- Download and install Docker
- Clone or download the repository
cd
into the root directory- Run the command
docker run -d -p 3000:8080 --env POSTGRES_USERNAME=**setup** --env POSTGRES_PASSWORD=**setup** --env POSTGRES_HOST=**setup** --env POSTGRES_DB=**setup** --env URL=**setup** <image-id>
- Install Kubernetes command line tool kubectl.
- Create an AWS EKS Cluster and a Node Group
- Create a secrets.yaml
apiVersion: v1
kind: Secret
metadata:
name: secrets
stringData:
POSTGRES_USERNAME: **setup**
POSTGRES_PASSWORD: **setup**
POSTGRES_HOST: **setup**
POSTGRES_DB: **setup**
URL: **setup**
- Using the AWS CLI run the command
aws eks --region <region-of-eks-cluster> update-kubeconfig --name <name-of-cluster>
- Using the terminal or command prompt run the command
kubectl create -f secrets.yaml
- Using the the terminal or command prompt run the command
kubectl apply -f deployment.yaml
and then runkubectl apply -f service.yaml
- Verify the pods are running with
kubectl get pods
To learn about the kubectl commands visit kubectl docs