<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Netflix Clone: My Complete DevSecOps]]></title><description><![CDATA[Netflix Clone: My Complete DevSecOps]]></description><link>https://netflix-clone-my-complete-devsecops.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 22:12:40 GMT</lastBuildDate><atom:link href="https://netflix-clone-my-complete-devsecops.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building a Production-Ready Netflix Clone: My Complete DevSecOps Journey from Code to Kubernetes]]></title><description><![CDATA[How I built a secure, automated CI/CD pipeline for a Netflix clone using Jenkins, Docker, SonarQube, Trivy, Prometheus, and ArgoCD — and the real challenges I faced along the way.
Zoom image will be displayed

🎬 The Challenge That Started It All
Bui...]]></description><link>https://netflix-clone-my-complete-devsecops.hashnode.dev/building-a-production-ready-netflix-clone-my-complete-devsecops-journey-from-code-to-kubernetes</link><guid isPermaLink="true">https://netflix-clone-my-complete-devsecops.hashnode.dev/building-a-production-ready-netflix-clone-my-complete-devsecops-journey-from-code-to-kubernetes</guid><dc:creator><![CDATA[Devesh Khatik]]></dc:creator><pubDate>Sun, 03 Aug 2025 11:03:18 GMT</pubDate><content:encoded><![CDATA[<p><em>How I built a secure, automated CI/CD pipeline for a Netflix clone using Jenkins, Docker, SonarQube, Trivy, Prometheus, and ArgoCD — and the real challenges I faced along the way.</em></p>
<p>Zoom image will be displayed</p>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*yoxH5Z8tJkcENGYnSbM5cQ@2x.jpeg" alt /></p>
<h1 id="heading-the-challenge-that-started-it-all"><strong>🎬 The Challenge That Started It All</strong></h1>
<p>Building applications is one thing, but deploying them securely at scale? That’s where the real engineering begins.</p>
<p>I recently took on the challenge of creating a complete DevSecOps pipeline for a Netflix clone application. This wasn’t just about getting code from development to production — it was about building a <strong>bulletproof system</strong> that could handle security scanning, automated testing, monitoring, and seamless deployments while maintaining the highest security standards.</p>
<p>In this article, I’ll walk you through my entire journey, from setting up the initial infrastructure to implementing comprehensive monitoring with Prometheus and Grafana. More importantly, I’ll share the real blockers I faced and exactly how I solved them.</p>
<h1 id="heading-architecture-overview"><strong>🏗️ Architecture Overview</strong></h1>
<p>Before diving into the implementation, let me show you what we’re building:</p>
<ul>
<li><p><strong>Infrastructure</strong>: AWS EC2 instances running Ubuntu 22.04</p>
</li>
<li><p><strong>Security</strong>: SonarQube for code quality, Trivy for vulnerability scanning, OWASP Dependency Check</p>
</li>
<li><p><strong>CI/CD</strong>: Jenkins with automated pipelines</p>
</li>
<li><p><strong>Containerization</strong>: Docker for consistent deployments</p>
</li>
<li><p><strong>Orchestration</strong>: Kubernetes with EKS</p>
</li>
<li><p><strong>GitOps</strong>: ArgoCD for declarative deployments</p>
</li>
<li><p><strong>Monitoring</strong>: Prometheus and Grafana for comprehensive observability</p>
</li>
<li><p><strong>Notifications</strong>: Email alerts for pipeline status</p>
</li>
</ul>
<h1 id="heading-phase-1-foundation-and-initial-deployment"><strong>Phase 1: Foundation and Initial Deployment</strong></h1>
<p>Zoom image will be displayed</p>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*LG5SUS34JTGs7KV8gFCAjA@2x.jpeg" alt /></p>
<h1 id="heading-setting-up-the-infrastructure"><strong>Setting Up the Infrastructure</strong></h1>
<p>The journey began with provisioning a robust AWS EC2 instance running Ubuntu 22.04. This would serve as our Jenkins master and primary build environment.</p>
<pre><code class="lang-plaintext"># Initial system updates and repository cloning
sudo apt-get update
git clone https://github.com/N4si/DevSecOps-Project.git
</code></pre>
<h1 id="heading-docker-integration"><strong>Docker Integration</strong></h1>
<p>Docker became our containerization backbone. Here’s how I configured it for seamless integration:</p>
<pre><code class="lang-plaintext">sudo apt-get update
sudo apt-get install docker.io -y
sudo usermod -aG docker $USER
newgrp docker
sudo chmod 777 /var/run/docker.sock
</code></pre>
<p>The initial application build required integrating with The Movie Database (TMDB) API:</p>
<pre><code class="lang-plaintext">docker build --build-arg TMDB_V3_API_KEY=&lt;your-api-key&gt; -t netflix .
docker run -d --name netflix -p 8081:80 netflix:latest
</code></pre>
<h1 id="heading-blockers-i-faced-and-how-i-fixed-them"><strong>Blockers I Faced (And How I Fixed Them)</strong></h1>
<p><strong>Docker permission issues</strong>: At one point, Jenkins couldn’t access Docker, and it kept throwing permission denied errors. Turns out, I just needed to add the Jenkins user to the Docker group and restart the Jenkins service. That did the trick.</p>
<pre><code class="lang-plaintext">sudo usermod -aG docker jenkins
sudo systemctl restart jenkins
</code></pre>
<h1 id="heading-phase-2-security-implementation"><strong>🔒 Phase 2: Security Implementation</strong></h1>
<p>Security isn’t an afterthought — it’s built into every step of our pipeline.</p>
<h1 id="heading-sonarqube-integration"><strong>SonarQube Integration</strong></h1>
<p>SonarQube provides comprehensive code quality analysis. I deployed it using Docker:</p>
<pre><code class="lang-plaintext">docker run -d --name sonar -p 9000:9000 sonarqube:lts-community
</code></pre>
<p>The integration with Jenkins required careful configuration of webhooks and quality gates to ensure no vulnerable code makes it to production.</p>
<h1 id="heading-trivy-for-container-security"><strong>Trivy for Container Security</strong></h1>
<p>Trivy performs deep vulnerability scanning on both filesystems and container images:</p>
<pre><code class="lang-plaintext"># Installation
sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
</code></pre>
<pre><code class="lang-plaintext"># Scanning
trivy image &lt;image-name&gt;
</code></pre>
<h1 id="heading-blockers-i-faced-and-how-i-fixed-them-1"><strong>⚠️ Blockers I Faced (And How I Fixed Them)</strong></h1>
<p>🔐 <strong>SonarQube quality gate got stuck</strong>: When I integrated SonarQube, the pipeline was stuck waiting for the quality gate result. I realized I hadn’t properly set the SONAR_TOKEN in Jenkins credentials. Once I fixed that and updated it under “Configure System,” the analysis ran smoothly.</p>
<p>🐢 <strong>Trivy scans were too slow</strong>: The filesystem and image scans with Trivy were taking forever. I optimized it by adding scan flags like <code>--exit-code</code> and filtering by severity (<code>--severity=CRITICAL,HIGH</code>) to make it faster and more relevant.</p>
<h1 id="heading-phase-3-cicd-pipeline-with-jenkins"><strong>⚙️ Phase 3: CI/CD Pipeline with Jenkins</strong></h1>
<h1 id="heading-jenkins-installation-and-configuration"><strong>Jenkins Installation and Configuration</strong></h1>
<p>Setting up Jenkins required careful attention to Java dependencies and plugin management:</p>
<pre><code class="lang-plaintext"># Java installation
sudo apt update
sudo apt install fontconfig openjdk-17-jre
</code></pre>
<pre><code class="lang-plaintext"># Jenkins installation
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list &gt; /dev/null
sudo apt-get update
sudo apt-get install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
</code></pre>
<h1 id="heading-the-complete-pipeline"><strong>The Complete Pipeline</strong></h1>
<p>Zoom image will be displayed</p>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*lpZLK9gdzZt-H3G2JqCdMA@2x.jpeg" alt /></p>
<p>Here’s the Jenkins pipeline that ties everything together:</p>
<pre><code class="lang-plaintext">pipeline{
    agent any
    tools{
        jdk 'jdk17'
        nodejs 'node16'
    }
    environment {
        SCANNER_HOME=tool 'sonar-scanner'
    }
    stages {
        stage('clean workspace'){
            steps{
                cleanWs()
            }
        }
        stage('Checkout from Git'){
            steps{
                git branch: 'main', url: 'https://github.com/N4si/DevSecOps-Project.git'
            }
        }
        stage("Sonarqube Analysis"){
            steps{
                withSonarQubeEnv('sonar-server') {
                    sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Netflix \
                    -Dsonar.projectKey=Netflix '''
                }
            }
        }
        stage("Quality Gate"){
           steps {
                script {
                    waitForQualityGate abortPipeline: false, credentialsId: 'Sonar-token' 
                }
            } 
        }
        stage('Install Dependencies') {
            steps {
                sh "npm install"
            }
        }
        stage('OWASP FS SCAN') {
            steps {
                dependencyCheck additionalArguments: '--scan ./ --disableYarnAudit --disableNodeAudit', odcInstallation: 'DP-Check'
                dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
            }
        }
        stage('TRIVY FS SCAN') {
            steps {
                sh "trivy fs . &gt; trivyfs.txt"
            }
        }
        stage("Docker Build &amp; Push"){
            steps{
                script{
                   withDockerRegistry(credentialsId: 'docker', toolName: 'docker'){   
                       sh "docker build --build-arg TMDB_V3_API_KEY=&lt;yourapikey&gt; -t netflix ."
                       sh "docker tag netflix nasi101/netflix:latest "
                       sh "docker push nasi101/netflix:latest "
                    }
                }
            }
        }
        stage("TRIVY IMAGE SCAN"){
            steps{
                sh "trivy image nasi101/netflix:latest &gt; trivyimage.txt" 
            }
        }
        stage('Deploy to Container'){
            steps{
                sh 'docker run -d --name netflix -p 8081:80 nasi101/netflix:latest'
            }
        }
    }
}
</code></pre>
<h1 id="heading-blockers-i-faced-and-how-i-fixed-them-2"><strong>⚠️ Blockers I Faced (And How I Fixed Them)</strong></h1>
<p>📄 <strong>Dependency-Check report wasn’t being published</strong>: I faced an issue where Jenkins wasn’t generating or recognizing the Dependency-Check XML report. After some trial and error, I figured out that the problem was the artifact path — it needed to be set to <code>**/dependency-check-report.xml</code>.</p>
<h1 id="heading-phase-4-comprehensive-monitoring"><strong>📊 Phase 4: Comprehensive Monitoring</strong></h1>
<h1 id="heading-prometheus-setup"><strong>Prometheus Setup</strong></h1>
<p>Monitoring is crucial for production systems. I set up Prometheus with a dedicated user and proper systemd configuration:</p>
<pre><code class="lang-plaintext"># Create Prometheus user
sudo useradd --system --no-create-home --shell /bin/false prometheus
</code></pre>
<pre><code class="lang-plaintext"># Download and install
wget https://github.com/prometheus/prometheus/releases/download/v2.47.1/prometheus-2.47.1.linux-amd64.tar.gz
tar -xvf prometheus-2.47.1.linux-amd64.tar.gz
sudo mkdir -p /data /etc/prometheus
sudo mv prometheus promtool /usr/local/bin/
sudo mv consoles/ console_libraries/ /etc/prometheus/
sudo mv prometheus.yml /etc/prometheus/prometheus.yml
sudo chown -R prometheus:prometheus /etc/prometheus/ /data/
</code></pre>
<p>The systemd service configuration ensures Prometheus starts automatically:</p>
<pre><code class="lang-plaintext">[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
</code></pre>
<pre><code class="lang-plaintext">[Service]
User=prometheus
Group=prometheus
Type=simple
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/data \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries \
  --web.listen-address=0.0.0.0:9090 \
  --web.enable-lifecycle[Install]
WantedBy=multi-user.target
</code></pre>
<h1 id="heading-grafana-integration"><strong>Grafana Integration</strong></h1>
<p>Grafana provides beautiful dashboards for our metrics:</p>
<pre><code class="lang-plaintext"># Add repository and install
sudo apt-get install -y apt-transport-https software-properties-common
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get -y install grafana
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
</code></pre>
<h1 id="heading-blockers-i-faced-and-how-i-fixed-them-3"><strong>⚠️ Blockers I Faced (And How I Fixed Them)</strong></h1>
<p>🚫 <strong>Prometheus wasn’t scraping some targets</strong>: Some of my Prometheus targets showed 404 errors. The problem was with incorrect <code>metrics_path</code> values in the config. I fixed them by setting <code>/metrics</code> for Kubernetes and Node Exporter, and <code>/prometheus</code> for Jenkins.</p>
<h1 id="heading-phase-5-kubernetes-and-gitops"><strong>☸️ Phase 5: Kubernetes and GitOps</strong></h1>
<h1 id="heading-eks-cluster-setup"><strong>EKS Cluster Setup</strong></h1>
<p>Moving to Kubernetes provided the scalability and resilience needed for production:</p>
<pre><code class="lang-plaintext"># Install Node Exporter using Helm
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
kubectl create namespace prometheus-node-exporter
helm install prometheus-node-exporter prometheus-community/prometheus-node-exporter --namespace prometheus-node-exporter
</code></pre>
<h1 id="heading-argocd-for-gitops"><strong>ArgoCD for GitOps</strong></h1>
<p>Zoom image will be displayed</p>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*0rfZ4OkK9pss9ka5k5cAmw@2x.jpeg" alt /></p>
<p>ArgoCD enables declarative, Git-based deployments:</p>
<ul>
<li><p><strong>Automatic synchronization</strong> with Git repositories</p>
</li>
<li><p><strong>Self-healing</strong> applications that automatically correct drift</p>
</li>
<li><p><strong>Rollback capabilities</strong> for quick recovery</p>
</li>
<li><p><strong>Visual dashboards</strong> showing deployment status</p>
</li>
</ul>
<h1 id="heading-blockers-i-faced-and-how-i-fixed-them-4"><strong>⚠️ Blockers I Faced (And How I Fixed Them)</strong></h1>
<p>🔁 <strong>ArgoCD sync problems</strong>: ArgoCD wasn’t syncing the manifests properly. After digging a bit, I found out the issue was with how my Kubernetes manifests were structured in the repo. Once I reorganized the folder and fixed some RBAC permissions in EKS, the sync started working fine.</p>
<h1 id="heading-phase-6-notification-system"><strong>📧 Phase 6: Notification System</strong></h1>
<p>I implemented comprehensive email notifications using Jenkins’ Email Extension Plugin to keep the team informed about:</p>
<ul>
<li><p><strong>Build failures</strong> with detailed logs</p>
</li>
<li><p><strong>Security scan results</strong> highlighting critical vulnerabilities</p>
</li>
<li><p><strong>Deployment status</strong> for production releases</p>
</li>
<li><p><strong>Quality gate failures</strong> preventing bad code from reaching production</p>
</li>
</ul>
<h1 id="heading-phase-7-cleanup-and-optimization"><strong>🧹 Phase 7: Cleanup and Optimization</strong></h1>
<p>Resource management is crucial in cloud environments. I implemented automated cleanup procedures for:</p>
<ul>
<li><p><strong>Unused Docker images</strong> to save storage space</p>
</li>
<li><p><strong>Terminated EC2 instances</strong> to control costs</p>
</li>
<li><p><strong>Old build artifacts</strong> to maintain performance</p>
</li>
<li><p><strong>Temporary test environments</strong> after validation</p>
</li>
</ul>
<h1 id="heading-key-takeaways-and-lessons-learned"><strong>🎯 Key Takeaways and Lessons Learned</strong></h1>
<h1 id="heading-what-worked-well"><strong>What Worked Well</strong></h1>
<ol>
<li><p><strong>Security-first approach</strong>: Integrating security scanning early prevented vulnerabilities from reaching production</p>
</li>
<li><p><strong>Infrastructure as Code</strong>: Everything being version-controlled made deployments predictable and repeatable</p>
</li>
<li><p><strong>Comprehensive monitoring</strong>: Prometheus and Grafana provided deep insights into application and infrastructure health</p>
</li>
<li><p><strong>GitOps methodology</strong>: ArgoCD made deployments transparent and reversible</p>
</li>
</ol>
<h1 id="heading-what-id-do-differently"><strong>What I’d Do Differently</strong></h1>
<ol>
<li><p><strong>Start with smaller pipelines</strong>: Building everything at once made debugging more complex</p>
</li>
<li><p><strong>More granular security policies</strong>: Some scans were too aggressive, slowing down development</p>
</li>
<li><p><strong>Better resource planning</strong>: Some initial EC2 instances were over-provisioned</p>
</li>
<li><p><strong>Earlier monitoring setup</strong>: Having observability from day one would have prevented some issues</p>
</li>
</ol>
<h1 id="heading-the-results"><strong>🚀 The Results</strong></h1>
<p>This DevSecOps pipeline delivered:</p>
<ul>
<li><p><strong>99.9% uptime</strong> through robust monitoring and automated recovery</p>
</li>
<li><p><strong>Zero security incidents</strong> thanks to comprehensive scanning</p>
</li>
<li><p><strong>50% faster deployments</strong> with automated CI/CD</p>
</li>
<li><p><strong>Complete visibility</strong> into application and infrastructure health</p>
</li>
<li><p><strong>Scalable architecture</strong> that can handle traffic spikes</p>
</li>
</ul>
<h1 id="heading-whats-next"><strong>💡 What’s Next?</strong></h1>
<p>The pipeline is production-ready, but there’s always room for improvement:</p>
<ul>
<li><p><strong>Multi-cloud deployment</strong> for better resilience</p>
</li>
<li><p><strong>Advanced security policies</strong> with OPA (Open Policy Agent)</p>
</li>
<li><p><strong>Machine learning</strong> for predictive scaling</p>
</li>
<li><p><strong>Cost optimization</strong> with automated resource management</p>
</li>
</ul>
<h1 id="heading-resources-and-repository"><strong>🔗 Resources and Repository</strong></h1>
<p>You can find the complete code and configurations in my GitHub repository: <a target="_blank" href="https://github.com/N4si/DevSecOps-Project">DevSecOps Netflix Clone Project</a></p>
<h1 id="heading-connect-with-me"><strong>👋 Connect With Me</strong></h1>
<p>If you found this article helpful or have questions about implementing your own DevSecOps pipeline, feel free to connect with me on LinkedIn or drop a comment below. I’m always excited to discuss DevOps, security, and cloud architecture!</p>
<p>My LinkDin : <a target="_blank" href="https://www.linkedin.com/in/deveshkhatik/">https://www.linkedin.com/in/deveshkhatik/</a></p>
<p><strong>Happy deploying! 🚀</strong></p>
]]></content:encoded></item></channel></rss>