Skip to content

This is a gitops repository for Argocd that is used to deploy Project Marketverse and explore gitops and devops, and this file contain IAC too with Terraform and Ansible

License

iamanonymous419/marketverse-gitops

Repository files navigation

Project - MarketVerse Deployment

Terraform Ansible AWS Jenkins ArgoCD Prometheus Grafana

MarketVerse is a cloud-native e-commerce platform that can be deployed using Kubernetes and Minikube. This guide provides step-by-step instructions for deploying MarketVerse on Minikube, setting up monitoring with Prometheus and Grafana, using automation with Makefile, and managing deployments with Argo CD.

Warning

This project is for learning purposes and aims to explore DevOps best practices.

References


Table of Contents


Prerequisites

Ensure the following tools are installed before proceeding:


Setup and Deployment

1. Clone the Repository

# Clone the project repository
git clone https://github.com/iamanonymous419/marketverse-gitops.git marketverse-gitops
cd marketverse-gitops

# For a specific branch
git clone -b main https://github.com/iamanonymous419/marketverse-gitops.git marketverse-gitops
cd marketverse-gitops

2. Set Up Kubernetes Namespace

kubectl apply -f namespace.yml

3. Deploy Database

kubectl apply -f ./database

4. Configure and Push Database Schema

Before running this command, make sure to set up the database URL of the Minikube service:

DATABASE_URL="postgresql://something:something@localhost:5432/database"

Then, forward the database port and push the schema:

kubectl port-forward service/database-service 5432:5432 -n marketverse &
pnpm exec drizzle-kit push

To verify the tables:

psql -h localhost -U something -d database

To access the database pod:

kubectl exec -it pod/database-0 -n marketverse -- bash
psql -U something -d database

5. Deploy Application

kubectl apply -f ./app

6. Deploy Cron Jobs

kubectl apply -f ./cron-job

7. Access the Application

kubectl port-forward service/marketverse-svc 3000:80 -n marketverse &

Now, open http://localhost:3000 in your browser.


Automated Deployment with Makefile

For easier deployment, use the provided Makefile:

make create-ns        # Create Kubernetes namespace
make delete-ns        # Delete Kubernetes namespace
make run-database     # Deploy database
make delete-database  # Remove database
make run-app          # Deploy application
make delete-app       # Remove application
make run-job          # Deploy scheduled jobs
make remove-job       # Remove scheduled jobs
make forward-app      # Forward port 3000 for the app
make forward-database # Forward port 5432 for the database

πŸ› οΈ Database Schema:

make schema-push      # Push latest schema changes to DB

πŸš€ Full Deployment:

make run-all          # Deploys everything including schema push

🧹 Cleanup:

make delete           # Deletes all resources

Kubernetes Dashboard in Minikube

Enable the Minikube dashboard:

minikube addons enable dashboard
minikube addons enable metrics-server
minikube dashboard

Access the dashboard at:

http://127.0.0.1:37725/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/


Monitoring with Grafana and Prometheus

Step 1: Install Prometheus and Grafana

helm install prometheus prometheus-community/kube-prometheus-stack --namespace monitoring --create-namespace

Step 2: Expose Prometheus & Grafana

kubectl port-forward svc/prometheus-kube-prometheus-prometheus -n monitoring 9090:9090 &
kubectl port-forward svc/prometheus-grafana -n monitoring 4000:80 &

Step 3: Get Grafana Credentials

kubectl get secret prometheus-grafana -n monitoring -o jsonpath="{.data.admin-password}" | base64 --decode

Username: admin


Argo CD Deployment

Step 1: Install Argo CD

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Step 2: Expose Argo CD UI

kubectl port-forward svc/argocd-server -n argocd 8080:443 &

Step 3: Get Argo CD Admin Credentials

kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode

Username: admin


Infrastructure as Code (IaC) Deployment

Important

For production-grade AWS EKS deployment using Infrastructure as Code (IaC), please refer to our comprehensive guide:

πŸ“„ Marketverse Infrastructure as Code (IaC) with Terraform and Ansible

This guide provides a complete production-ready infrastructure setup, including:

  • ☁️ AWS EKS Cluster setup using Terraform
  • πŸ”„ CI/CD Pipeline with Jenkins on AWS EC2
  • πŸ” Remote Backend for secure Terraform state management
  • 🚒 GitOps Deployment using ArgoCD
  • πŸ“Š Monitoring Stack with Prometheus and Grafana
  • 🧩 Configuration Management using Ansible

IaC CI/CD Cloud

Tip

The IaC deployment is ideal for production environments and follows industry best practices for secure, scalable, and maintainable infrastructure.


Cleanup

To delete everything:

kubectl delete -f namespace.yml
make delete

πŸš€ MarketVerse is now successfully deployed on Kubernetes with Argo CD! Happy coding! πŸŽ‰

About

This is a gitops repository for Argocd that is used to deploy Project Marketverse and explore gitops and devops, and this file contain IAC too with Terraform and Ansible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published