A containerized Node.js application demonstrating a complete GitOps CI/CD pipeline using GitHub Actions, ArgoCD, and Argo Workflows.
This project implements a production-ready CI/CD pipeline with the following components:
- GitHub Actions: Automated building and container registry publishing
- Argo Workflows: Manual deployment control with approval gates
- ArgoCD: GitOps-based continuous delivery
- Kubernetes: Container orchestration with health checks and resource management
- Slack Integration: Real-time deployment notifications
- Docker
- Kubernetes cluster (local or cloud)
- kubectl configured
- GitHub repository with Container Registry access
- Slack webhook URL (optional, for notifications)
git clone https://github.com/gm01x/sample-node-repo.git
cd sample-node-repo
npm install# Create namespace
kubectl create namespace argocd
# Install ArgoCD
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Access ArgoCD UI (port-forward)
kubectl port-forward svc/argocd-server -n argocd 8080:443
# Get initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d# Create namespace
kubectl create namespace argo
# Install Argo Workflows
kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo-workflows/stable/manifests/quick-start-postgres.yaml
# Create service account for workflows
kubectl apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: argo-workflow-sa
namespace: argo
---
apiVersion: rbac.authorization.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: argo-workflow-role
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec"]
verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
---
apiVersion: rbac.authorization.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: argo-workflow-binding
roleRef:
apiGroup: rbac.authorization.authorization.k8s.io
kind: ClusterRole
name: argo-workflow-role
subjects:
- kind: ServiceAccount
name: argo-workflow-sa
namespace: argo
EOFApply the ArgoCD application configuration:
kubectl apply -f argocd/application.yamlTrigger: Push to main branch or pull request
Process:
- Checks out code
- Logs into GitHub Container Registry
- Builds Docker image
- Pushes image with multiple tags:
- Branch name (e.g.,
main) - Commit SHA (e.g.,
main-abc123d) latestfor main branch
- Branch name (e.g.,
Trigger: Manual workflow execution
Process:
- Image Validation: Verifies image exists in registry
- Slack Notification: Announces deployment start
- Manual Approval: Requires human approval to proceed
- Manifest Update: Updates
k8s/deployment.yamlwith new image tag - Git Commit: Pushes changes to trigger ArgoCD sync
Trigger: Changes to k8s/ directory in Git
Process:
- Automatically detects manifest changes
- Syncs Kubernetes resources
- Self-heals if drift detected
- Prunes removed resources
- Push Code: Push changes to
mainbranch → GitHub Actions builds image - Trigger Workflow: Run Argo Workflow with desired image tag
- Approve: Click approve in Argo Workflows UI
- Auto-deploy: ArgoCD syncs automatically
image-tag: Docker image tag to deploy (e.g.,latest,main-abc123d)repo-owner: GitHub username/organizationrepo-name: Repository namegithub-repo: Full GitHub repo pathslack-webhook: Slack webhook URL for notifications
- Port: 3000
- Health Check:
/healthendpoint - Replicas: 2 (configured in deployment)
- Resources: CPU: 50m-100m, Memory: 64Mi-128Mi
env:
- name: PORT
value: "3000"
- name: APP_VERSION
value: "1.0.0"For Argo Workflows to update Git manifests, create this secret:
kubectl -n argo create secret generic github-credentials \
--from-literal=token=YOUR_GITHUB_TOKEN- Health Checks: Liveness and readiness probes
- Slack Notifications: Deployment status updates
- ArgoCD UI: Visual deployment status
- Argo Workflows UI: Pipeline execution monitoring
# Run locally
npm start
# Build Docker image
docker build -t sample-node-app .
# Run in Docker
docker run -p 3000:3000 sample-node-app# Run tests
npm test
# Health check
curl http://localhost:3000/healthGET /: Main application pageGET /health: Health check endpoint
- Fork the repository
- Create a feature branch
- Make changes and test locally
- Push to your fork
- Create a pull request
This project is licensed under the MIT License.