Skip to content

Latest commit

ย 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Appwrite DevSecOps

๐Ÿš€ Appwrite DevSecOps Pipeline

Production-Grade CI/CD with Security Scanning, Kubernetes Deployment & Full Observability

Jenkins SonarQube Docker Kubernetes Helm Trivy Prometheus Grafana Slack

๐Ÿ“‹ Project Docs โ€ข ๐Ÿ—๏ธ Architecture โ€ข โš™๏ธ Pipeline โ€ข ๐Ÿ“Š Monitoring โ€ข ๐Ÿš€ Setup


๐Ÿ“‹ Project Overview

This project demonstrates a production-grade DevSecOps CI/CD pipeline for Appwrite - an open-source Firebase alternative with 54k+ GitHub stars. The pipeline automates the entire software delivery lifecycle from code commit to production deployment with integrated security scanning, container orchestration, and full-stack observability.

Why Appwrite? Appwrite is a real-world, enterprise-grade platform used by thousands of developers globally. Deploying it with a full DevSecOps pipeline demonstrates the ability to handle complex, multi-service architectures - exactly what companies like IBM, HCL, and Visa use in production.

๐ŸŽฏ Key Highlights

Feature Details
CI/CD Tool Jenkins with 11 automated pipeline stages
Security SonarQube SAST + Trivy CVE scanning (image + filesystem)
Registry DockerHub โ€” 20+ versioned image tags
Orchestration Kubernetes (k3s) with Helm charts
Observability Prometheus + Grafana + Alertmanager
Notifications Real-time Slack alerts on every deployment
Pipeline Time ~1 min 37 sec end-to-end

๐Ÿ—๏ธ Architecture

Project Architecture


โš™๏ธ CI/CD Pipeline

Pipeline Stages

Pipeline Stages

๐Ÿ“ธ Pipeline Screenshots

Jenkins Stage View โ€” Build #20 (All Green โœ…)

Jenkins Pipeline

SonarQube Quality Gate โ€” PASSED

SonarQube

Trivy Security Report โ€” 3 HIGH CVEs detected

Trivy

DockerHub โ€” 9 image tags published

DockerHub

Verify Deployment โ€” All Pods Running โœ… Verify Deployment

Kubernetes Services K8s Services

Slack Alert โ€” Deployment notification

Slack


๐Ÿ“Š Monitoring & Observability

Grafana Production Dashboard

Live metrics across all 4 pods โ€” Appwrite, MariaDB, MongoDB, Redis

Grafana Dashboard

Dashboard Panels

Panel Metric Description
Running Pods 4 Total healthy pods
Total Restarts 4 Pod restart count
CPU Usage % 3.24% Cluster CPU utilization
Memory Usage 194 MB Total memory used
Firing Alerts 5 Active Alertmanager alerts
Cluster Health 1 Healthy nodes
CPU per Pod Time series Per-pod CPU over time
Memory per Pod Time series Per-pod memory over time
Network I/O Time series Network in/out per pod
Security Panel Table Pod privileged status
Deployment Frequency Graph Jenkins deployments/hour
Active Alerts List CPUThrottling, ControllerDown

Alert Rules

- CPUThrottlingHigh      # CPU throttle > threshold
- KubeControllerManagerDown  # Controller manager health
- KubeDeploymentReplicasMismatch  # Replica count mismatch
- PodCrashLoopBackOff    # Pod restart loop
- HighMemoryUsage        # Memory > 85%

๐Ÿ› ๏ธ Tech Stack

Category Tool Version Purpose
Source Control GitHub - Code hosting + webhook triggers
CI/CD Jenkins 2.555.1 Pipeline automation
Code Quality SonarQube 9.9.8 SAST + quality gate
Security Scan Trivy 0.70.0 CVE + secret scanning
Containerization Docker 29.4.1 Image build + registry
Registry DockerHub - Image storage (20+ tags)
Orchestration Kubernetes (k3s) v1.36.0 Container orchestration
Package Manager Helm v3.20.2 K8s application packaging
Database MariaDB 10.11 Relational database
Cache/Queue Redis 7.2 Cache + message queue
Document DB MongoDB 5.0 Document store
Metrics Prometheus - Metrics collection
Dashboards Grafana - Visualization
Alerting Alertmanager - Alert routing
Notifications Slack - Deployment alerts
IaC Helm Charts - Declarative K8s config

๐Ÿ“ Repository Structure

appwrite-devsecops/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ Jenkinsfile                    # 11-stage CI/CD pipeline
โ”œโ”€โ”€ ๐Ÿ“„ sonar-project.properties       # SonarQube configuration
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore                     # Secrets excluded
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ helm/
โ”‚   โ””โ”€โ”€ ๐Ÿ“ appwrite/
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ Chart.yaml             # Helm chart metadata
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ values.yaml            # Image tag + config
โ”‚       โ””โ”€โ”€ ๐Ÿ“ templates/
โ”‚           โ”œโ”€โ”€ ๐Ÿ“„ deployment.yaml    # Appwrite Deployment
โ”‚           โ”œโ”€โ”€ ๐Ÿ“„ service.yaml       # ClusterIP/NodePort
โ”‚           โ””โ”€โ”€ ๐Ÿ“„ ingress.yaml       # Ingress rules
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ k8s/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ namespace.yaml             # appwrite namespace
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ mariadb.yaml               # MariaDB StatefulSet
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ mongodb.yaml               # MongoDB StatefulSet
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ redis.yaml                 # Redis StatefulSet
โ”‚
โ””โ”€โ”€ ๐Ÿ“ monitoring/
    โ”œโ”€โ”€ ๐Ÿ“„ servicemonitor.yaml        # Prometheus ServiceMonitor
    โ””โ”€โ”€ ๐Ÿ“„ alert-rules.yaml           # Custom alert rules (CPU, Memory, Pod crash)  
    โ””โ”€โ”€ ๐Ÿ“„ prometheus-values.yaml     # Prometheus Helm chart override values 
    โ””โ”€โ”€ ๐Ÿ“„ grafana-dashboard.json     # Custom Grafana dashboard (import-ready JSON)     

๐Ÿš€ Quick Start

Prerequisites

# Required tools
docker --version    # Docker 29.x+
kubectl version     # v1.36.x+
helm version        # v3.20.x+
trivy --version     # 0.70.x+

1. Clone Repository

git clone https://github.com/omprakash2929/appwrite-devsecops
cd appwrite-devsecops
git checkout dev

2. Setup k3s Kubernetes

# Install k3s
curl -sfL https://get.k3s.io | sh -

# Setup kubeconfig
mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $USER:$USER ~/.kube/config

# Verify
kubectl get nodes

3. Setup Jenkins

# Install Jenkins
sudo apt install openjdk-17-jdk jenkins -y
sudo systemctl start jenkins

# Install Docker for Jenkins
sudo apt install docker.io -y
sudo usermod -aG docker jenkins
sudo systemctl restart jenkins

4. Configure Jenkins

Required Plugins:
โœ… Docker Pipeline
โœ… SonarQube Scanner
โœ… Kubernetes CLI
โœ… Slack Notification

Required Credentials:
โœ… dockerhub-creds  (Username + Password/PAT)
โœ… SonarQube-Token  (Secret Text)
โœ… github-token     (Secret Text)

5. Create Pipeline Job

New Item โ†’ Pipeline โ†’ appwrite-devsecops
Definition: Pipeline script from SCM
SCM: Git
URL: https://github.com/omprakash2929/appwrite-devsecops
Branch: */dev
Script Path: Jenkinsfile

6. Deploy Monitoring

# Add Helm repos
helm repo add prometheus-community \
  https://prometheus-community.github.io/helm-charts
helm repo update

# Install monitoring stack
kubectl create namespace monitoring
helm install monitoring \
  prometheus-community/kube-prometheus-stack \
  --namespace monitoring \
  --set grafana.adminPassword=admin123

# Access Grafana
kubectl port-forward svc/monitoring-grafana \
  3000:80 -n monitoring
# Open: http://localhost:3000 (admin/admin123)

๐Ÿ“ˆ Results & Metrics

Metric Value
Total Builds 20+ builds
Successful Builds Build #20 โœ…
Pipeline Duration ~1 min 37 sec
Docker Image Size 536 MB
DockerHub Pulls 65+
CVEs Detected 3 HIGH (reported)
SonarQube Score A (all categories)
Quality Gate PASSED โœ…
K8s Pods Running 4/4
Grafana Dashboards Production-grade

๐ŸŽ“ What I Learned

  • Designing and implementing multi-stage Jenkins pipelines with parallel execution
  • Integrating SonarQube for static analysis and quality gates in CI/CD
  • Container vulnerability scanning with Trivy โ€” understanding CVE severity levels
  • Kubernetes resource management โ€” Deployments, StatefulSets, Services, PVCs
  • Helm chart development for parameterized, reusable Kubernetes deployments
  • Setting up full observability with Prometheus ServiceMonitors and Grafana dashboards
  • Configuring Alertmanager rules and Slack webhook integrations
  • Debugging real production issues โ€” CrashLoopBackOff, MongoDB connection pools, kubeconfig authentication
  • k3s single-node cluster setup as a cost-effective production-like environment

๐Ÿ”ฎ Future Improvements

  • Fix Appwrite pod stability โ€” complete all required MongoDB connection pools
  • Add OWASP Dependency Check stage to pipeline
  • Implement multi-node k3s cluster for HA
  • Add Loki + Promtail for centralized log aggregation
  • Integrate Jaeger for distributed tracing
  • Add automated rollback on deployment failure
  • Implement GitFlow with PR-based deployments
  • Add network policies for pod-to-pod security

๐Ÿ‘จโ€๐Ÿ’ป Author

Omprakash Chauhan

LinkedIn GitHub Portfolio DockerHub


โญ Star this repo if you found it helpful!

Built with โค๏ธ as a portfolio DevSecOps project

## Badges

Add badges from somewhere like: shields.io Jenkins SonarQube Docker Kubernetes Helm Trivy Prometheus Grafana Slack

About

Secure DevSecOps pipeline project using Appwrite with automated CI/CD, containerized deployment, security scanning, and cloud-native infrastructure setup for scalable and secure application delivery.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors