Skip to content

mmmihaeel/node-microservices-docker-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Microservices with Docker and Kubernetes

This repository contains a set of microservices implemented in Node.js, along with a React client. The microservices include users, tasks, and auth, each of which has a Dockerfile for containerization and Kubernetes configuration for deployment.

Table of Contents

Prerequisites

  • Node.js (v14+)
  • Docker
  • Kubernetes (minikube or a Kubernetes cluster)

Getting Started

Running Locally

  1. Clone this repository:

    git clone https://github.com/mmmihaeel/node-microservices-docker-kubernetes.git
    cd node-microservices-docker-kubernetes
    cd users-api
    npm install
    cd ../tasks-ap
    npm install
    cd ../auth-api
    npm install
    cd ../client
    npm install
    
  2. Run with docker: Start the microservices and client using Docker Compose:

    docker-compose build
    docker-compose up
    

Kubernetes

Apply Kubernetes configurations for each microservice and the client:

kubectl apply -f kubernetes/users-deployment.yaml
kubectl apply -f kubernetes/tasks-deployment.yaml
kubectl apply -f kubernetes/auth-deployment.yaml
kubectl apply -f kubernetes/client-deployment.yaml

Expose the services:

kubectl expose deployment users-deployment --type=LoadBalancer --port=80
kubectl expose deployment tasks-deployment --type=LoadBalancer --port=80
kubectl expose deployment auth-deployment --type=LoadBalancer --port=80
kubectl expose deployment client-deployment --type=LoadBalancer --port=80

Replace LoadBalancer with the appropriate service type for your environment.

Directory Structure

node-microservices-docker-kubernetes/
├── users-api/
│ ├── Dockerfile
│ ├── .env.dev # Users microservice development environment
│ ├── .env.prod # Users microservice production environment
│ ├── users-app.js
│ │ └── ... # Users microservice source files
├── tasks-api/
│ ├── Dockerfile
│ ├── .env.dev # Tasks microservice development environment
│ ├── .env.prod # Tasks microservice production environment
│ ├── tasks-app.js
│ │ └── ... # Tasks microservice source files
├── auth-api/
│ ├── Dockerfile
│ ├── .env.dev # Auth microservice development environment
│ ├── .env.prod # Auth microservice production environment
│ ├── auth-app.js
│ │ └── ... # Auth microservice source files
├── client/
│ ├── Dockerfile
│ ├── public/
│ ├── conf/ # Nginx production config for React client
│ ├── src/
│ │ └── ... # React client source files
├── kubernetes/
│ ├── users-deployment.yaml
│ ├── tasks-deployment.yaml
│ ├── auth-deployment.yaml
│ ├── configmap.yaml # kuberenetes env
│ ├── client-deployment.yaml
├── docker-compose.yml
├── .env # docker env
└── README.md

Contributing

Contributions are welcome! Please follow the standard GitHub fork and pull request workflow.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published