This guide will help you set up and run the devHive application locally on your system. Follow the steps below based on your operating system.
in ubuntu,
- install docker (refer any documents)
- install minikube (refer any documents)
- enable ingress,
minikube addons enable ingress
- enable dashboard (optional)
minikube addons enable dashboard
- Install kubectl
- Install Skaffold (optional)
in windows,
- Download and install Docker Desktop from Docker's official website.
- Enable Kubernetes in Docker Desktop settings.
- Install kubectl
- Install skaffold
- Install Ingress Nginx using helm
-
Create the required secrets(env's) check the .env.example file
-
start minikube
minikube start
- To check minikube is running
minikube status
- To apply the configurations of deployment, services and pods
- Go to root folder For ingress deployments
kubectl apply -f k8s/ingress/dev/ingress-srv.yaml
For stateful deployments (data that should persist)
- If using mongodb atlas, it's not necessary to apply the mongodb-deployment yaml files inside the stateful folder.
- But we need to apply the configuration file for kafka (message broker).
kubectl apply -f k8s/stateful/kafka-deployment.yaml
- if not using mongodb atlas
kubectl apply -f k8s/stateful/
For stateless deployments (servers)
kubectl apply -f ./k8s/stateless
- If Skaffold is installed run
skaffold dev
minikube ip
- Open '/etc/hosts' file in nano editor
sudo nano /etc/hosts
- Add at last,
192.168.49.2 devhive.dev
here "192.168.49.2" is the minikube ip
ctrl+o - to save press enter ctrl x - to exit nano editor
https://devhive.dev
- to stop minikube context or cluster
- if for the first time
minikube addons enable metrics-server
- then
minikube dashboard
- to see deployments
kubectl get deployments
- to see services
kubectl get services
- to see pods
kubectl get pods
- to see pods in another namespace( ingress is on another namespace )
kubectl get namespaces
kubectl get pods -n namespace_name
- to delete all pods ( also can be used for deployments and services by changing word 'pods' )
kubectl delete pods --all
docker build -t <your_image_name>:<tag> .
here,
- -t: Specifies the name and optionally a tag to the Docker image.
- your_image_name: The desired name for your Docker image.
- tag: An optional tag for versioning your Docker image.
- '.': The path to the Dockerfile and context. '.' indicates the current directory.
eg:- if we want to create the image of auth service,
- Go to the root directory of the service, cd auth
- create image, docker build -t abin12334324/auth .
- Before pushing, make sure you are logged in to your Docker Hub account from command line,
docker login
- After logging in, you can push the image:
docker push <your_image_name>:<tag>
eg:- docker push abin12334324/auth:latest