<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aakib on Medium]]></title>
        <description><![CDATA[Stories by Aakib on Medium]]></description>
        <link>https://medium.com/@aakibkhan1?source=rss-21bf1599fd67------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Bl31Zf0eP5ujQFC7</url>
            <title>Stories by Aakib on Medium</title>
            <link>https://medium.com/@aakibkhan1?source=rss-21bf1599fd67------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 22:55:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aakibkhan1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AWS Shared Responsibility Model — Part 1]]></title>
            <link>https://aakibkhan1.medium.com/aws-shared-responsibility-model-part-1-65be5ad93453?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/65be5ad93453</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 13:51:04 GMT</pubDate>
            <atom:updated>2025-09-10T13:51:04.991Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Shared Responsibility Model — Part 1</h3><p><em>(Introduction + Basics + Why it Matters)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/0*y5Xp3mwnDfdynhTH.jpg" /></figure><h3>1. What is the Shared Responsibility Model?</h3><p>Let’s imagine you rent an apartment.</p><ul><li>The <strong>landlord</strong> makes sure the building is safe, the lifts are working, fire alarms are installed, and water and electricity lines are fine.</li><li>But <strong>you, as the tenant</strong>, must lock your door, keep your valuables safe, and make sure you don’t leave the stove on.</li></ul><p>That’s exactly how AWS works.</p><ul><li><strong>AWS (the landlord)</strong> is responsible for securing the infrastructure — the physical servers, data centers, networking, and hardware.</li><li><strong>You (the customer)</strong> are responsible for what you do inside — like securing your data, managing access, and configuring services correctly.</li></ul><p>This clear line of division is called the <strong>AWS Shared Responsibility Model</strong>.</p><p>👉 AWS secures <strong>“Security OF the Cloud”</strong>.<br> 👉 Customers secure <strong>“Security IN the Cloud”</strong>.</p><h3>2. Why Does It Matter?</h3><p>A lot of companies think:<br> “Hey, we are on AWS, so everything is automatically secure!” ❌<br> That’s wrong.</p><p>Here’s a real-world example:</p><ul><li>In 2019, a major financial company had a data breach.</li><li>The issue wasn’t with AWS servers. The issue was that the company misconfigured their <strong>S3 bucket</strong> (they left it open to the internet).</li><li>Who was at fault? The customer. Because <strong>S3 is secure by default</strong>, but the customer didn’t configure access properly.</li></ul><p>That’s why AWS created the Shared Responsibility Model — so that both AWS and customers know <strong>who is responsible for what</strong>.</p><h3>3. High-Level Division</h3><p>Here’s the most important line you should remember:</p><ul><li><strong>AWS Responsibility → Security OF the Cloud</strong><br> (infrastructure, hardware, software that runs cloud services)</li><li><strong>Customer Responsibility → Security IN the Cloud</strong><br> (data, applications, identity, access control, configurations)</li></ul><p>Think of it like an <strong>airport</strong>:</p><ul><li>The <strong>airport authority</strong> takes care of runways, buildings, and security systems.</li><li>But <strong>you, the passenger</strong>, must carry valid ID, not bring dangerous items, and keep your luggage safe.</li></ul><p>Both sides need to do their part.</p><h3>4. Cloud Service Models and Responsibility</h3><p>Responsibilities also change depending on the <strong>cloud service model</strong> you use:</p><ol><li><strong>IaaS (Infrastructure as a Service)</strong> → e.g., Amazon EC2</li></ol><ul><li>AWS secures hardware, networking, and virtualization.</li><li>You secure the OS, apps, and data.</li></ul><p><strong>2. PaaS (Platform as a Service)</strong> → e.g., AWS Elastic Beanstalk</p><ul><li>AWS manages infrastructure + runtime.</li><li>You just secure your app and data.</li></ul><p><strong>3. SaaS (Software as a Service)</strong> → e.g., Amazon WorkMail</p><ul><li>AWS manages almost everything.</li><li>You only manage your data and users.</li></ul><h3>AWS Responsibilities: Security “OF” the Cloud</h3><h3>1. Big Idea</h3><p>AWS says:<br> 👉 “We take care of <strong>everything that makes the cloud run</strong>. You only focus on what you put <strong>inside</strong> the cloud.”</p><p>So AWS is responsible for <strong>Security OF the Cloud</strong>.</p><p>This includes:</p><ul><li>Physical data centers</li><li>Networking infrastructure</li><li>Hardware &amp; virtualization layer</li><li>Global AWS services availability</li></ul><p>Let’s break this down step by step.</p><h3>2. Physical Security</h3><p>Think about it: AWS has data centers all over the world. These are like <strong>super secure banks</strong>, but instead of gold, they store data.</p><p>AWS responsibilities here:</p><ul><li>Guards at the gate</li><li>Biometric access (fingerprint, retina scan)</li><li>24/7 CCTV monitoring</li><li>Fire suppression systems</li><li>Climate control (servers don’t like heat 🔥)</li></ul><p><strong>Real-life example:</strong><br> You never have to worry about someone breaking into the building where your EC2 instance runs. AWS already guards that.</p><h3>3. Hardware &amp; Infrastructure</h3><p>AWS owns and manages:</p><ul><li>Servers</li><li>Storage devices (disks)</li><li>Networking equipment (switches, routers)</li></ul><p>They make sure:</p><ul><li>Hardware failures are detected and replaced quickly.</li><li>Data is replicated across availability zones (so if one disk dies, your data is still safe).</li></ul><p>👉 Example: If an AWS hard disk fails in their data center, AWS replaces it. You don’t even know it happened.</p><h3>4. Networking</h3><p>AWS provides a <strong>global secure network</strong>.</p><p>They handle:</p><ul><li>Firewalls at the network level</li><li>DDoS protection with AWS Shield</li><li>Secure communication between regions &amp; AZs</li><li>Encryption in transit (TLS)</li></ul><p>👉 Example: When you send data from one AWS region to another, you don’t need to worry about hackers sniffing packets in between. AWS already encrypts and secures the backbone network.</p><h3>5. Virtualization Layer</h3><p>Most AWS services run on <strong>virtual machines</strong>. AWS manages the <strong>hypervisor</strong> that divides physical servers into multiple VMs.</p><p>They make sure:</p><ul><li>One customer’s VM can’t “peek” into another customer’s VM.</li><li>Isolation between accounts is always maintained.</li></ul><p>👉 Example: If your EC2 runs on the same physical server as another company’s EC2, don’t worry. AWS guarantees they cannot see or touch your instance.</p><h3>6. Managed Services</h3><p>For managed services like <strong>S3, RDS, DynamoDB</strong>, AWS takes care of:</p><ul><li>Patching the underlying OS</li><li>Ensuring uptime (99.99% SLA in many cases)</li><li>Scaling infrastructure on demand</li></ul><p>👉 Example: You don’t need to install antivirus or patch the OS inside Amazon S3. AWS already secures it.</p><h3>7. Compliance &amp; Certifications</h3><p>AWS spends millions of dollars getting certifications like:</p><ul><li>ISO 27001</li><li>SOC 1/2/3</li><li>PCI DSS</li><li>HIPAA</li></ul><p>This means if your business needs to follow these rules, AWS already has a strong foundation.</p><p>👉 Example: If you’re building a healthcare app, AWS already meets HIPAA standards at the infrastructure level. You only need to ensure your app complies.</p><h3>8. Availability &amp; Redundancy</h3><p>AWS ensures their cloud is <strong>always available</strong>:</p><ul><li>Multiple data centers in each region (called Availability Zones).</li><li>Backup power, internet, cooling.</li><li>Disaster recovery plans.</li></ul><p>👉 Example: Even if one AZ in Mumbai goes down, AWS automatically shifts load to another AZ in the same region.</p><h3>9. Summary of AWS Responsibilities</h3><ul><li>Data center security</li><li>Physical hardware</li><li>Networking backbone</li><li>Hypervisor/virtualization layer</li><li>Managed service patching</li><li>Global availability</li><li>Compliance certifications</li></ul><p><strong>In short:</strong><br> AWS provides the <strong>secure foundation</strong>. Customers build on top</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65be5ad93453" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ AWS API Gateway — Full Blog (Part 1)]]></title>
            <link>https://aakibkhan1.medium.com/aws-api-gateway-full-blog-part-1-81d1e11efe2c?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/81d1e11efe2c</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-api-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 12:54:22 GMT</pubDate>
            <atom:updated>2025-09-01T12:54:22.826Z</atom:updated>
            <content:encoded><![CDATA[<h3>📝 AWS API Gateway — Full Blog (Part 1)</h3><h3>1. Introduction</h3><p>When you use apps like <strong>Swiggy, Zomato, Ola, Uber, or Paytm</strong>, have you ever thought about how these apps connect to their backend servers?</p><p>For example:</p><ul><li>You open <strong>Zomato</strong> → search for “Pizza”.</li><li>The app shows you a list of restaurants.</li><li>You place an order → payment happens → delivery tracking starts.</li></ul><p>Behind the scenes, all this happens because of something called <strong>APIs</strong>.</p><h3>What is an API?</h3><p><strong>API</strong> stands for <strong>Application Programming Interface</strong>.</p><p>In simple words:</p><ul><li>API is like a <strong>messenger</strong> between two systems.</li><li>It takes your request, tells the server what you need, and brings back the response.</li></ul><p>👉 <strong>Real-life example:</strong><br> Think of a <strong>restaurant waiter</strong>.</p><ul><li>You (the customer) ask for food → that’s the <strong>request</strong>.</li><li>The waiter takes your order to the <strong>kitchen</strong> (server).</li><li>The kitchen prepares the food and gives it back to the waiter.</li><li>The waiter serves it to you → that’s the <strong>response</strong>.</li></ul><p>Here:</p><ul><li>You = Client (like your mobile app)</li><li>Kitchen = Server (where the business logic is running)</li><li>Waiter = API</li></ul><p>This is exactly how apps talk to servers.</p><h3>What is an API Gateway?</h3><p>Now imagine a <strong>big hotel</strong> with 20+ different kitchens — Indian, Chinese, Italian, Dessert, Beverages.<br> If customers directly run to the kitchens, it will create chaos.</p><p>So the hotel keeps <strong>one reception desk (gateway)</strong>.</p><ul><li>You place your order at reception.</li><li>Reception decides which kitchen to send your order to.</li><li>Then it brings back the food.</li></ul><p>This reception desk is like an <strong>API Gateway</strong>.</p><p>👉 <strong>Definition:</strong><br> <strong>API Gateway</strong> is a service that acts as a <strong>front door</strong> for your applications (mobile apps, web apps, etc.) to access data, business logic, or backend services.</p><p>It manages:</p><ul><li>Who can enter (security)</li><li>How many people can enter at a time (rate limiting)</li><li>Where to send requests (routing)</li><li>And keeps logs of everything(cloudwatch)</li></ul><h3>Why AWS API Gateway?</h3><p>There are many API Gateways (Kong, Apigee, etc.), but AWS API Gateway is <strong>fully managed</strong> and deeply integrated with AWS services like <strong>Lambda, DynamoDB, EC2, S3</strong>.</p><p>It is <strong>serverless</strong>, meaning:</p><ul><li>You don’t manage any servers</li><li>You pay only when someone uses your API</li><li>It automatically scales from <strong>1 request per day to millions per second</strong></li></ul><p>That’s why it is very popular for startups, enterprises, and even personal projects.</p><h3>2. Why do we need AWS API Gateway?</h3><p>Let’s take a simple example.</p><p>Imagine you are building an <strong>Online Shopping App</strong>.</p><ul><li>Mobile app → sends requests like <em>Get Product List, Add to Cart, Make Payment</em>.</li><li>Backend → multiple services: product service, order service, payment service.</li></ul><h3>Problem without API Gateway:</h3><ul><li>Your mobile app has to directly talk to each backend service.</li><li>You must manage authentication for each service separately.</li><li>Each service might have a different endpoint.</li><li>You will face issues in scaling, throttling, and monitoring.</li></ul><p>This becomes very complex very fast.</p><h3>Solution with API Gateway:</h3><ul><li>Your mobile app talks only to <strong>one endpoint</strong> (API Gateway).</li><li>API Gateway then routes the request to the correct backend service.</li><li>It manages authentication, throttling, caching, and logging for you.</li></ul><p>👉 Think of it like <strong>Swiggy delivery partner</strong>.</p><ul><li>Customer places an order on Swiggy app.Swiggy assigns a delivery person.</li><li>That delivery person coordinates with restaurant, pickup, and drop.</li><li>Customer only interacts with Swiggy → not directly with the restaurant.</li></ul><p>This is exactly what <strong>API Gateway</strong> does.</p><p>Next part →<strong>Core Concepts of AWS API Gateway</strong> (Endpoints, Methods, Resources, Stages, Integrations, etc.) with real-life examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/0*-CDtTJW-QVMgB2iY.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81d1e11efe2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Canary and Blue-Green Deployments: Advanced Deployment Strategies for Minimal Downtime]]></title>
            <link>https://aakibkhan1.medium.com/canary-and-blue-green-deployments-advanced-deployment-strategies-for-minimal-downtime-fd37fa685666?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd37fa685666</guid>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 11:16:46 GMT</pubDate>
            <atom:updated>2025-02-18T11:16:46.787Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In modern software development, ensuring smooth deployments with minimal downtime is critical. Two popular advanced deployment strategies that achieve this are <strong>Canary Deployments</strong> and <strong>Blue-Green Deployments</strong>. These strategies help reduce risks, enable faster rollbacks, and improve user experience. Additionally, <strong>observability</strong> is crucial for monitoring these rollouts effectively.</p><h3>What is a Canary Deployment?</h3><p>A <strong>Canary Deployment</strong> is a strategy where a new version of an application is gradually released to a small subset of users before rolling it out to everyone. This approach allows teams to monitor performance, identify issues, and mitigate risks before full deployment.</p><h4>How Canary Deployment Works:</h4><ol><li><strong>Release to a Small Group:</strong> Deploy the new version to a small percentage of users.</li><li><strong>Monitor Metrics:</strong> Track performance, errors, and user feedback.</li><li><strong>Gradual Rollout:</strong> If everything looks good, slowly increase traffic to the new version.</li><li><strong>Rollback if Needed:</strong> If issues arise, revert to the previous version immediately.</li></ol><h4>Advantages of Canary Deployment:</h4><ul><li><strong>Risk Mitigation:</strong> Issues affect only a small group of users.</li><li><strong>Faster Rollbacks:</strong> Quick recovery if something goes wrong.</li><li><strong>Performance Insights:</strong> Real-time feedback from actual users.</li></ul><h4>Tools for Canary Deployments:</h4><ul><li>Kubernetes with Argo Rollouts or Flagger.</li><li>Service meshes like Istio for traffic splitting.</li></ul><h3>What is a Blue-Green Deployment?</h3><p>A <strong>Blue-Green Deployment</strong> involves running two identical environments: <strong>Blue</strong> (current version) and <strong>Green</strong> (new version). Traffic is switched from the blue environment to the green one instantly.</p><h4>How Blue-Green Deployment Works:</h4><ol><li><strong>Deploy Green:</strong> Deploy the new version (Green) alongside the current version (Blue).</li><li><strong>Switch Traffic:</strong> Redirect user traffic from Blue to Green.</li><li><strong>Monitor and Validate:</strong> Ensure the Green environment performs well.</li><li><strong>Keep Blue for Rollback:</strong> Retain Blue for immediate fallback if issues arise.</li></ol><h4>Advantages of Blue-Green Deployment:</h4><ul><li><strong>Zero Downtime:</strong> Traffic switches instantly without downtime.</li><li><strong>Instant Rollback:</strong> Return to Blue immediately if needed.</li><li><strong>Seamless User Experience:</strong> Users experience no service interruptions.</li></ul><h4>Tools for Blue-Green Deployments:</h4><ul><li>AWS Elastic Load Balancing (ELB)Kubernetes Services with Load Balancers</li><li>CI/CD tools like GitLab CI/CD or Jenkins</li></ul><h3>Observability in Progressive Rollouts</h3><p><strong>Observability</strong> is essential for monitoring deployments and ensuring their success. It involves collecting and analyzing data from logs, metrics, and traces.</p><h4>Key Components of Observability:</h4><ul><li><strong>Metrics:</strong> Measure system performance (e.g., CPU usage, error rates).</li><li><strong>Logs:</strong> Capture detailed records of events and errors.</li><li><strong>Traces:</strong> Track requests across services for better visibility.</li></ul><h4>Tools for Observability:</h4><ul><li><strong>Prometheus &amp; Grafana:</strong> Collect and visualize metrics.</li><li><strong>Loki &amp; Promtail:</strong> Centralize and analyze logs.</li><li><strong>Jaeger or OpenTelemetry:</strong> Monitor distributed traces.</li></ul><h3>Combining Strategies with Observability</h3><p>In large-scale deployments, teams often combine Canary and Blue-Green strategies with strong observability to enhance reliability. For example:</p><ul><li><strong>Start with a Canary Deployment:</strong> Release gradually and observe performance.</li><li><strong>Switch to Blue-Green for Full Rollout:</strong> Once confident, redirect all traffic.</li><li><strong>Use Observability Tools:</strong> Continuously monitor and quickly respond to issues.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kSRMixsaPGCSmdkS.png" /></figure><p>Canary and Blue-Green deployments are powerful strategies for achieving safe, efficient, and zero-downtime deployments. Combining these approaches with observability ensures successful rollouts, quick issue detection, and fast recovery. Using tools like Kubernetes, Prometheus, and GitLab CI/CD, teams can achieve seamless and reliable software delivery.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd37fa685666" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project 16 →End-to-End Automation with Azure DevOps CI/CD Pipelines +GitOps]]></title>
            <link>https://aakibkhan1.medium.com/project-16-end-to-end-automation-with-azure-devops-ci-cd-pipelines-gitops-8f5728de6f4d?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f5728de6f4d</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Fri, 31 Jan 2025 15:37:20 GMT</pubDate>
            <atom:updated>2025-01-31T15:37:20.338Z</atom:updated>
            <content:encoded><![CDATA[<p>This project is about making it easier to build, test, and launch applications using Azure DevOps. Instead of doing everything manually, it sets up an automated process called a CI/CD pipeline. This pipeline takes care of building your code, testing it to make sure everything works, and then deploying it to the environment you choose, like development, testing, or production</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBtsGey7CrfRd5BxQh8YGg.gif" /></figure><h3>Completion Steps :-</h3><h4>Phase 1 :Continuous Integration on Azure Devops Platform</h4><p>Step 1 : Setup Azure Repos</p><p>Step 2 : Set Azure Container Registeries</p><p>Step 3: Create Azure Pipelines</p><p>Step 4: Setup agent pool</p><p>Step 5: Setup Pipelines for Voting and worker microservices</p><h4>Phase 2 : Continuous Deployment using gitops</h4><p>Step 1: Kubernetes Cluster Creation using Azure Kubernetes Service (AKS)</p><p>Step 2: Setup Azure CLI</p><p>Step 3: Install and configure Argo-CD</p><p>Step 4: Deploy Application on argocd</p><h4>Phase 3: Automating the whole cicd part</h4><p>Step 1: Creating a shell script</p><p>Step 2 : Added a new stage in pipeline</p><h3>Step 1 : Setup Azure Repos</h3><ol><li>Go to your Azure portel and search for devops organization and create a new organization</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*xaCAKvpjBDhp6ow6JsvEcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*upoqluYQ3tj3ejOS_zuqow.png" /></figure><p>2. click on Azure Repos and then click on Import option</p><p>3. Paste the github project repo link</p><pre>https://github.com/Aakibgithuber/Azure-devops-CI-CD-GitOps.git</pre><p>4. Provide the github project repo URL and then click on Import</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlZzQKV79R2T5zKKvQjCfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zysyk0RQ1DT-dkJauDYvsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXyU6DQvmte-efWIn-NBsw.png" /></figure><p>5. It will fetch all the Files and branches from github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*GYtHVgqr07J2RzZ1H7ZTWw.png" /></figure><p>6. Now you have to set main branch as default branch</p><p>7. Select branches from left menu and then click on three dots of main branch where you find a option to set main branch as a default branch</p><p>8. We set main branch as default one beacause the latest code will always have to be in main branch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*In7MgFNqjxrBMPAkOmS3rw.png" /></figure><h3>Step 2 : Set Azure Container Registeries</h3><p><strong>What is Azure Container Registeries →</strong> It is central repositories in azure for storing docker images just like dockerhub</p><ol><li>Go to azure portel and search for container registeries</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*d0Jo7dlWm3dN91wE6WfYAA.png" /></figure><p>2. Create a new container registery</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTruPUCXEUpkhPO_o8Bsgw.png" /></figure><p>3. Keep the setting as it is mentioned in below image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEiZby_0as83zbBI7QwEig.png" /><figcaption>Click on Review and create</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4I2X2BMrbaAzNCFJ4yBmIA.png" /><figcaption>Click on create</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W-FFruIeNJGMeoYGSKGy4Q.png" /></figure><p>4. Your central repository for docker images is ready to use</p><h3>Step 3: Create Azure Pipelines</h3><p>What is Azure Pipelines → It helps you automatically build, test, and deploy your code just like <strong>jenkins </strong>It’s like<strong> </strong>a robot that takes your code, checks if it works correctly, and sends it to where it needs to be (like a website or app store) without you doing it manually every time</p><ol><li>Click on Pipelines Option present in the left menu</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*pM_uV7PC4ZzV14gwpRukNg.png" /><figcaption>click on pipelines</figcaption></figure><p>2. In our case we fetch the code from github and store it in Azure Repos so we have to select Azure repos from options given below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*wYaDgFNH2XoNEaCw69W47g.png" /></figure><p>3. These are the pre templates of your pipeline code in our case we are using docker for building and pushing the image to ACR</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yrT5U7Xzh03hwH_9jzmRQ.png" /><figcaption>click on 2nd option of docker</figcaption></figure><p>4. Select the subscription I only have pay as you go type so i need to chose this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Le7KHSy0C4uUDV9zi4u9Jw.png" /></figure><p>5. Select the container registry we made earliar in the blog</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*IpWdHrf-87M1pr28_bZaqA.png" /><figcaption>change the Image name accordingly</figcaption></figure><p>6. It will provide a pre template of pipeline code now we have to make some changes</p><pre># Docker<br># Build and push an image to Azure Container Registry<br># https://docs.microsoft.com/azure/devops/pipelines/languages/docker</pre><pre>trigger: #This option will only trigger a pipeline when you only make any change in the result folder<br> paths: <br>  include:<br>  - result/*</pre><pre>resources:<br>- repo: self</pre><pre>variables:<br>  # Container registry service connection established during pipeline creation<br>  dockerRegistryServiceConnection: &#39;e05f07b8-d307-47cb-87d1-c75b657fa09b&#39;<br>  imageRepository: &#39;resultapp&#39;<br>  containerRegistry: &#39;microcicd.azurecr.io&#39;<br>  dockerfilePath: &#39;$(Build.SourcesDirectory)/result/Dockerfile&#39; <br>  tag: &#39;$(Build.BuildId)&#39;</pre><pre>pool: <br> name: &#39;azureagent&#39;</pre><pre>stages:<br>- stage: Build<br>  displayName: Build <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;build&#39;<br>        Dockerfile: &#39;result/Dockerfile&#39;<br>        tags: &#39;$(tag)&#39;</pre><pre>- stage: push<br>  displayName: push <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;push&#39;<br>        tags: &#39;$(tag)&#39;</pre><h4>1. Trigger</h4><pre>trigger:<br>  paths:<br>    include:<br>      - result/*</pre><ul><li>This tells Azure Pipelines to only <strong>trigger this pipeline</strong> when you make a change to files in the result folder.<br>For example, if we update result/Dockerfile, the pipeline will run. If you change something outside this folder, it won&#39;t trigger.</li></ul><h4>2. resources</h4><pre>resources:<br>- repo: self</pre><ul><li>This tells the pipeline to use the same repository (self) where this YAML file is stored.</li></ul><h4>3. variables</h4><pre>variables:<br>  dockerRegistryServiceConnection: &#39;e05f07b8-d307-47cb-87d1-c75b657fa09b&#39;<br>  imageRepository: &#39;resultapp&#39;<br>  containerRegistry: &#39;microcicd.azurecr.io&#39;<br>  dockerfilePath: &#39;$(Build.SourcesDirectory)/result/Dockerfile&#39;<br>  tag: &#39;$(Build.BuildId)&#39;</pre><ul><li>These are reusable values (variables) used later in the pipeline:</li></ul><ol><li><strong>dockerRegistryServiceConnection</strong>: Refers to the Azure service connection that allows the pipeline to communicate with the Azure Container Registry (ACR). This is the unique ID of the service connection.</li><li><strong>imageRepository</strong>: The name of the repository in the container registry where the image will be stored. Here, it’s called resultapp.</li><li><strong>containerRegistry</strong>: The URL of our Azure Container Registry (microcicd.azurecr.io).</li><li><strong>dockerfilePath</strong>: The path to the Dockerfile. $(Build.SourcesDirectory) is a predefined variable pointing to the root of the source code.</li><li><strong>tag</strong>: A unique identifier for the Docker image, generated automatically for each pipeline run. $(Build.BuildId) is a unique number provided by Azure Pipelines for each build.</li></ol><h4>4. pool</h4><pre>pool:<br>  name: &#39;azureagent&#39;</pre><ul><li>Specifies the <strong>pool of agents</strong> (virtual machines) to run the pipeline. Here, we’re using the azureagent pool provided by Azure.</li></ul><h4>5. stages</h4><p>This section defines the <strong>pipeline’s main stages</strong>. we have two stages: <strong>Build</strong> and <strong>Push</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*atCLrIDB50Z9JNRiERmteg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*VUPBkmWfDvKcjIoDWQ5pdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*fTEpBGFt3wvzibOmhM3Y1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AO3ko8bCOmW8Sanfvxd2UA.png" /></figure><p>This error occurs because the <strong>agent pool</strong> specified in your pipeline (azureagent) <strong>Does not exist </strong>there<strong> </strong>is no agent pool with the name azureagent in our Azure DevOps organization. so we need to setup agent pool for azureagent</p><h3>Step 4: Setup agent pool</h3><p>An <strong>agent pool</strong> in Azure DevOps is like a group of workers (computers or virtual machines) that perform tasks in our pipeline, such as building, testing, or deploying our code.</p><h4>How It Works:</h4><ul><li>When we run a pipeline, it looks for an available “worker” in the agent pool to carry out the tasks we have defined.</li><li>Each worker is called an <strong>agent</strong>, and it runs one job at a time.</li></ul><h4>Why It’s Useful:</h4><ol><li><strong>Resource Management</strong>: It allows we to manage and organizeyour agents into groups, so we can use them for specific pipelines or projects.</li></ol><h4>Types of Agent Pools:</h4><ol><li><strong>Microsoft-Hosted Agent Pool</strong>:</li></ol><ul><li>Provided by Azure DevOps.</li><li>Includes pre-configured virtual machines (e.g. Windows, Linux, macOS).</li><li>You don’t need to maintain or set up anything just use it.</li></ul><p><strong>2. Self-Hosted Agent Pool</strong>:</p><ul><li>Machines that you set up and maintain (e.g. your own servers or VMs).</li><li>Useful if you need:</li><li>More customization (e.g., special software or configurations).</li><li>To avoid limitations in Microsoft-hosted agents.</li></ul><p><strong>In our Case we are going to use Self-Hosted Agent Pool</strong></p><blockquote>First we need to create Virtual Machine in which our agent is being hosted</blockquote><ol><li>Go to VM section and click on create</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gKCopgRUsz5UqmHu6ygB4g.png" /><figcaption>Set the Configuration as it is mentioned</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-P21iM-rKeUoXmigvRO9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*megaYoYzgZEmXusR6VL6sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUQ1Z3u1QuWx1Dtg5wZfjA.png" /><figcaption>Creating a Virtual Machine for Self hosted agent</figcaption></figure><p>2. Now click on Agent pools option under project setting option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*zgYIiGnitha27cSj14PRFg.png" /></figure><p>3. Click on Add pool</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n_pIPlSy2Sfjcz1P4CzGIw.png" /></figure><p>4. Select self hosted from the options and provide a name to your agent pool and right tick on grant access permission on all pipelines</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*vtFv4W91OJm99kqrgg1BFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NqqGCcQYt98UdtlcF1MJ-g.png" /></figure><p>5. You have provided with certain command to run on your VM that setup your agent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*47nw_xvYdaGn2pNtNMW9Ag.png" /></figure><p>6. Go to your VM and copy the public IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*440TEm40U4r5kYS54PqbpA.png" /><figcaption>copy the public IP</figcaption></figure><p>7. Take ssh of your vm and run the follwing commands</p><p>for ssh you need to run (please ensure that your pem file must be present in that particular location)</p><pre>ssh -i &lt;.pem_file&gt; azureuser@&lt;public_ip&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2tGyLJCVoeKUbSMU1ig4-Q.png" /><figcaption>ssh -i myserver_key.pem azureuser@20.106.200.227</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*oEK-RRIG0TGNkmsaPkIZQQ.png" /><figcaption>copy the Download the agent link as shown above</figcaption></figure><p>8. Now Run the folloiwng commands</p><pre>wget &lt;paste_the_copied_link&gt;<br>apt update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twEc6Qm-35h2j3Mr-V4_XQ.png" /></figure><p>9. Now list the items and run the following command to extract the file</p><pre>tar zxvf vsts-agent-linux-x64-4.248.0.tar.gz</pre><p>This command extracts the contents of the tarball into the current directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-0F2Oe2wsgeXHARZmItIQ.png" /><figcaption>now run /.config.sh</figcaption></figure><p>10. After Extracting you have to run .sh file to setup agent</p><pre>/.config.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qKAjPjCCSgKNfHq7SM6Kvw.png" /></figure><p>11. you have to provide server URL which you can get from the documentation self-hosted linux agents on azure →<a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/linux-agent?view=azure-devops">documentation link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3tTQqW-0MtgLkR7iv1R2w.png" /></figure><p>12. Copy the server url and paste it there(edit the organization part and provide your devops organization name)now it will asked you to provide the personal acess token(PAT) which you need to generate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*U6OR1cxLqef7DZ9gw6nKdA.png" /><figcaption>we have to create a personal access token</figcaption></figure><p>14. On the agents tab click on setting &gt; personal access tokens</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*Ll6CuwDgNqoxBPKL-z9Yyw.png" /></figure><p>15. Provide a name to your token select your organization and also provide full authorization acess to your tokenn</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*lTc8s-TF1Z7KBFHs_LRQAw.png" /><figcaption>click on create</figcaption></figure><p>16. Copy Your token and paste it on terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*9Gy6GiP9H0GaMrxfM2Dt1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qsvlYpYjtMKYIZdExOjJbg.png" /><figcaption>first you need to press enter and then provide your token</figcaption></figure><p>17. Now enter your agent pool name that we created earliar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*1ULGBuUsgF0ML3RPmd-bBQ.png" /><figcaption>type azureagent in name section</figcaption></figure><p>18. As you see your agent is offline to make it available for our use we need to install docker and provide neccessary permission to docker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wbwesKCo-s6AWKSc8s9-4g.png" /></figure><pre>sudo apt install docker.io<br>sudo usermod -aG docker azureuser <br>sudo systemctl restart docker<br>./run.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*OeGwIysMjGQYImgiAal1-g.png" /></figure><p>19. Your agent is now online is ready to use</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1h57EV3XYEWfoGNi5ZJew.png" /></figure><p>20. If you are Going to pipeline section you will see your pipeline will autmatically triggered by the agent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhRaJBSyOKn0gyXRM-2uZQ.png" /><figcaption>click on Build to see the terminal interface</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPDFVtYoamC-PCxeyUEXog.png" /></figure><p>Now everything is setup you all need to make two more pipelines for voting and worker microservices</p><h3>Step 5: Setup Pipelines for Voting and worker microservices</h3><ol><li>go to pipelines section select the code repo as azure repos , chose the pre-template as the docker and select your subscription</li></ol><h4>Pipeline code for Voting Service</h4><pre># Docker<br># Build and push an image to Azure Container Registry<br># https://docs.microsoft.com/azure/devops/pipelines/languages/docker</pre><pre>trigger:<br> paths:<br>  include:<br>  - vote/*</pre><pre>resources:<br>- repo: self</pre><pre>variables:<br>  # Container registry service connection established during pipeline creation<br>  dockerRegistryServiceConnection: &#39;e05f07b8-d307-47cb-87d1-c75b657fa09b&#39;<br>  imageRepository: &#39;votetapp&#39;<br>  containerRegistry: &#39;microcicd.azurecr.io&#39;<br>  dockerfilePath: &#39;$(Build.SourcesDirectory)/vote/Dockerfile&#39;<br>  tag: &#39;$(Build.BuildId)&#39;</pre><pre>pool:<br> name: &#39;azureagent&#39;</pre><pre>stages:<br>- stage: Build<br>  displayName: Build <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;build&#39;<br>        Dockerfile: &#39;vote/Dockerfile&#39;<br>        tags: &#39;$(tag)&#39;</pre><pre>- stage: push<br>  displayName: push <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;push&#39;<br>        tags: &#39;$(tag)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mnu28F6vkEUXL6DMZVjbiA.png" /><figcaption>save and run</figcaption></figure><h4>Pipeline code for Worker Service</h4><pre># Docker<br># Build and push an image to Azure Container Registry<br># https://docs.microsoft.com/azure/devops/pipelines/languages/docker</pre><pre>trigger:<br> paths:<br>  include:<br>  - worker/*</pre><pre>resources:<br>- repo: self</pre><pre>variables:<br>  # Container registry service connection established during pipeline creation<br>  dockerRegistryServiceConnection: &#39;e05f07b8-d307-47cb-87d1-c75b657fa09b&#39;<br>  imageRepository: &#39;workerapp&#39;<br>  containerRegistry: &#39;microcicd.azurecr.io&#39;<br>  dockerfilePath: &#39;$(Build.SourcesDirectory)/worker/Dockerfile&#39;<br>  tag: &#39;$(Build.BuildId)&#39;</pre><pre>pool:<br> name: &#39;azureagent&#39;</pre><pre>stages:<br>- stage: Build<br>  displayName: Build <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;build&#39;<br>        Dockerfile: &#39;worker/Dockerfile&#39;<br>        tags: &#39;$(tag)&#39;</pre><pre>- stage: push<br>  displayName: push <br>  jobs:<br>  - job: Build<br>    displayName: Build the image<br>    steps:<br>    - task: Docker@2<br>      displayName: Build and push an image to container registry<br>      inputs:<br>        containerRegistry: &#39;$(dockerRegistryServiceConnection)&#39;<br>        repository: &#39;$(imageRepository)&#39;<br>        command: &#39;push&#39;<br>        tags: &#39;$(tag)&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CP5j33a5mSKnohy-NSaPOw.png" /><figcaption>save and run</figcaption></figure><p>As of now you have successfully created 3 pipelines and all your pipelines successfully build and push docker images to Azure Container Registeries</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvzEx3ewUHOrtDXmZqY6Ww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OxW5V-gsPuH8IJm19ajOwA.png" /><figcaption>ACR repositories</figcaption></figure><blockquote>Here we completed our Phase 1 that is CI part on Azure Devops Platform Let’s move to CD part</blockquote><h3>Phase 2 : Continuous Deployment</h3><h4>Step 1: Kubernetes Cluster Creation using Azure Kubernetes Service (AKS)</h4><ol><li>Go to Azure portal and search for kubernetes service</li><li>click on create Kubernetes cluster from the dropdown</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Wh3CP5why3DcbxxMLvm3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RKxyoXgRLnSVWOiX66_8Sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UKZA5bGyS7SUpDiRmvloUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vHxEl28TmpjBcOQdlyL0WQ.png" /></figure><p>3. Keep the Everything as it is shown in the image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w14LMtO9843bATnAfqtEJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbXg9SpMshn-5SXMUkFWYQ.png" /></figure><p>4. Click on nodepool to update the no. of instances used in autoscaling</p><p><strong>What is NodePool →</strong>A node pool in Azure Kubernetes Service (AKS) is simply a group of virtual machines (VMs) that act as the workers for your Kubernetes cluster. These VMs are where your applications run. Each node pool contains multiple VMs called <strong>nodes</strong> and each of these nodes has the tools Kubernetes needs to manage and run your applications</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*9m_ytCtMh9FdV1oujUsS8Q.png" /><figcaption>click on create</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2ShZF8N52TUxk1-Hx4D1g.png" /></figure><p>5. your Cluster is now Ready to orchestrate</p><h3>Step 2: Setup Azure CLI</h3><ol><li>Go to your Terminaland Run the Following commands to install azure CLI</li></ol><pre>curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash<br>az --version</pre><p>2. Now for login run —</p><pre>az login</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*2yTRm2ewSEqb3MsO9vRZog.png" /></figure><p>3. It will Redirect you to web broswer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMEC3HSdZtjQDV_CAGpRDg.png" /><figcaption>Copy the code shown in this image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*oWjnXYE0UaNNB7VfreIeaQ.png" /><figcaption>paste your copied code here</figcaption></figure><p>4. click on continue select your account and then go back to your terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*tNDTtfd2WT1VGIjwt5c06A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*iCnfqVT-W9K9t1BizZPZjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*b5YHjw-IKgn2k4mLtd7_hQ.png" /><figcaption>Go back to your terminal</figcaption></figure><p>5. You are now login to access your azure account via CLI</p><pre>az account show</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9lhrXmgnKfWMdwa-NXuvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*Umi8ZqYMDqjRWc7IIxvJkQ.png" /></figure><h3>Step 3: Install and configure Argo-CD</h3><ol><li>On your termninal run the following command</li></ol><pre>az aks get-credentials --name AzureDevops --overwrite-existing --resource-group Demo-RG</pre><p>This command fetches the access credentials for your Azure Kubernetes Service (AKS) cluster, so you can connect to it and manage it using kubectl</p><ul><li><strong>--name AzureDevops</strong>: This specifies the name of your AKS cluster. In this case, the cluster is named AzureDevops.</li><li><strong>--resource-group Demo-RG</strong>: This tells Azure which resource group your cluster is in</li><li><strong>--overwrite-existing</strong>: If your current configuration already has credentials for a cluster with the same name, this option replaces them with the new credentials you’re fetching. This avoids confusion or conflicts if you were previously connected to another cluster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8xv6aIg7OzAZUQkJLX5WA.png" /></figure><p><strong>2. Installation of Kubectl</strong></p><p>Run the following command to install kubectl on your VM</p><pre>sudo apt update<br>sudo apt install curl -y<br>curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl<br>sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl<br>kubectl version --client</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eyKrHqAlNsEX4onkAfdx5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*gDW5jCeBpfQ-ZKosrv73zA.png" /></figure><p>3. Create a namespace for argocd</p><pre>kubectl create namespace argocd</pre><pre>kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</pre><p>4. Above command will downloads the install.yaml file from the Argo CD GitHub repository.</p><ul><li>The file contains a predefined set of instructions to install Argo CD into your Kubernetes cluster.</li><li>Kubernetes will create all the necessary resources (like Deployments, Services, Pods, etc.) required to run Argo CD in the argocd namespace</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xnlQMAkGoUEkEAmTraSW2A.png" /></figure><pre>Kubectl get pods -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*rf85e7mM3jbD-M5Dp7brVA.png" /></figure><p>5. To access the UI of Argocd we need credentials that is stored as secret</p><pre>kubectl get secrets -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FAylH_wnaJVBYekdlJGsbg.png" /></figure><p>6. Open the yaml file for admin secret</p><pre>kubectl edit secrets argocd-initial-admin-secret -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjLP2C5A738WtXQF2H41nQ.png" /></figure><p>7. Copy the password</p><p>8. Initially it is base64 encoded and we need to decode the password</p><pre>#run the following command to encode the secret<br>echo &lt;encoded_password&gt; |base64 --decode</pre><p><strong>Base64 encoding</strong> is a way to convert data (like text, images, or files) into a format that can be safely transmitted or stored as plain text</p><p><strong>Why it’s called “Base64”</strong>: There are 64 characters in the Base64 encoding scheme (A-Z, a-z, 0–9, +, /). These are used to represent the data</p><p>If you want to encode the word <strong>“Cat”</strong>:</p><ol><li>Convert the text into its binary format: Cat becomes 01000011 01100001 01110100.</li><li>Split it into chunks and encode each part using Base64 rules. The result: Q2F0.</li></ol><p>So, the Base64 encoding of <strong>“Cat”</strong> is <strong>Q2F0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmcp888G5_zXUUmxO0Cqnw.png" /></figure><p>9. Copy the decoded password and paste it in notepad</p><pre>kubectl get svc -n argocd</pre><pre># This will display a list of all services in the argocd namespace</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sE1TFus60AG_EMauchSwkQ.png" /></figure><p>10. Checkout service for the argocd-server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MzFjMkfwDaA83vnhdEiDqw.png" /><figcaption>expose argocd-server from clusterip to nodeport</figcaption></figure><p>11. As we see the argocd server expose as ClusterIP we need to change this to NodePort</p><p>If you want to open Argo CD’s UI in your web browser or interact with its API from outside the cluster, ClusterIP won’t work. Switching to NodePort exposes it so you can reach it via &lt;Node IP&gt;:&lt;NodePort&gt;</p><p>For example:</p><ul><li>ClusterIP: Accessible <strong>only inside</strong> Kubernetes (e.g., <a href="http://argocd-server:8080).">http://argocd-server:8080).</a></li><li>NodePort: Accessible <strong>outside</strong> (e.g., http://&lt;NodeIP&gt;:32000).</li></ul><p>Think of <strong>ClusterIP</strong> as a private door that can only be opened from inside your house (the cluster). Changing it to <strong>NodePort</strong> adds a public door that anyone outside your house (the cluster) can use, so you can easily access Argo CD from your browser or tools</p><p>11. Run the Following command to edit the argocd-server manifest</p><pre>kubectl edit svc argocd-server -n argocd</pre><p>12. Look for type and change It to NodePort</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nt5VkMB98cCBxg0Bb26ICw.png" /><figcaption>esc+:wq → to save and exit from file</figcaption></figure><pre>kubectl get svc -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qEvqkP-vs5iX45cmL6rHNA.png" /><figcaption>you need to open the port no. 30645</figcaption></figure><p>13. Go to your azure portal type vmss</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*iRb3PWhwy_NJPLbe_ubQJg.png" /></figure><p>14. click on <strong>agent pool&gt;networking</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHktoycCmVTklHOOHXD9lg.png" /></figure><p>15. Create a New port rule and open the port no. 30645 that is our argocd port</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*fXwrzkJzduivRTtJ1noqsQ.png" /></figure><p>16. Go back to your terminal</p><pre># this command will provide the externalip of node<br>kubectl get nodes -o wide</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ql8-IKcNaYjZniewlbA4nw.png" /></figure><p>17. copy the external ip and go to your browser type <strong>http://&lt;public_ip&gt;:&lt;port_no.&gt;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*fXwrzkJzduivRTtJ1noqsQ.png" /></figure><p>18. Now go back to broswer and proceed to advanced</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkhHah2KKLEVCB3ZX6Z23w.png" /></figure><p>19. username == admin password is what you decoded earliar in the blog</p><h3>Step 4: Deploy Application on argocd</h3><h4>1. Connect With Azure Repos</h4><ol><li>First you need to conned the Azure repo which contain the source code</li><li>click on setting&gt;repositories</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ftb99l3f0w2NbPlqKLkiQ.png" /></figure><p>3. Change the connection method to HTTPS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*Xnh0YCrvNAhOQd6LQzNlBQ.png" /></figure><p>4. For repository url go to azure repos and then click on clone</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*jI_2_I9XmW_43jKPm-3SOA.png" /><figcaption>copy the repo url</figcaption></figure><p>5. Paste in the URL section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*QRye_iUNE3ZTXBsdVEHsSQ.png" /></figure><p>6. As it is a private repo so we need to token that we had generated earliar for connection paste your token here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4AdRboCIdDsSKC_PeIfREw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*GZoN7HWmxow3Xpq7lQHcmA.png" /><figcaption><strong>click on connect repo</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlYtv8fdFhiYWdz51oeCDQ.png" /><figcaption>Your connnection is now successful</figcaption></figure><p>7.<strong> We need to change the Application refresh timout to 10 sec</strong> by default it is 3 min. So we need to edit the config file of argocd and add <strong>the section of application refresh timeout</strong></p><pre>kubectl edit configmap argocd-cm -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdTF1jtqPvdgNvLqiytktQ.png" /></figure><pre>#Restart the argocd server<br>kubectl rollout restart deployment argocd-server -n argocd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yx-KKvTwnbpggDE9-CyheA.png" /></figure><h4>2. Create a new Application</h4><ol><li>Click on New app section on argocd</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*v18KpydlbQUsEmFRAigCpA.png" /></figure><p>2. Keep all the details as it shown in the below images</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KMmFsOki9wW-YKaUMRtuRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItZOcSRlwYQgGdETbPRaJg.png" /><figcaption>Repository URL along with the token</figcaption></figure><p>3. In the path section provide the manifest location. All the manifest is stored in k8s-specification folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DK8FQqAQoV8JjV766h77iQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_7RyTmq45vbhmrl2cJ6Fw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*A0K5cw7uEMH1mtBoAdo0aw.png" /></figure><p>4. Your Application is now deployed on Azure Kubernetes Cluster via argo-cd</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oMtRoeMsacwpjVIIck40fA.png" /></figure><p>5. Go to your terminal check for the pods and services and open the no. in which your services is running</p><pre>kubectl get pods<br>kubectl get svc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_grFWIqTIcFi4cIBgpK_hg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*aJTpnxf_VkL9LlI0cCKZnQ.png" /></figure><p>6. go to yourazure portal and search for <strong>vmss&gt;nodepool</strong> and open the 31000,31001 port that is for vote app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jm1SXjf6_ZGyoSqUrYYOkQ.png" /></figure><p>7. <strong>collect the node external ip</strong> and again fo to your web broswer type <strong>http://&lt;node_ip&gt;:&lt;port_no.&gt;</strong></p><pre>kubectl get nodes -o wide</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gJcRJT7S0M_CGV8C6x67g.png" /><figcaption>copy any of the node ip</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXtAEaaxYTOJgbSUJjRfOA.png" /><figcaption><strong>Voting Microservice</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHu4JLw3XycIP9Xn9zl_vg.png" /><figcaption><strong>Result Microservice</strong></figcaption></figure><blockquote>Here we done Continuous Deployment Part of our Application using GitOps Approach</blockquote><h3>Phase 3: Automating the whole cicd part</h3><h4>Step 1: Creating a shell script</h4><ol><li>Go to Azure repos click on three dots and make a new repository</li><li>folder name==scripts , file name ==updateK8sManifests.sh</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*BKBojN0UCmqZohfBdPeCKw.png" /><figcaption>folder name==scripts , file name ==updateK8sManifests.sh</figcaption></figure><p>3. Paste the Following code in the .sh file</p><pre>#!/bin/bash</pre><pre>set -x</pre><pre># Set the repository URL<br>REPO_URL=&quot;https://&lt;ACCESS-TOKEN&gt;@dev.azure.com/&lt;AZURE-DEVOPS-ORG-NAME&gt;/voting-app/_git/voting-app&quot;</pre><pre># Clone the git repository into the /tmp directory<br>git clone &quot;$REPO_URL&quot; /tmp/temp_repo</pre><pre># Navigate into the cloned repository directory<br>cd /tmp/temp_repo</pre><pre># Make changes to the Kubernetes manifest file(s)<br># For example, let&#39;s say you want to change the image tag in a deployment.yaml file<br>sed -i &quot;s|image:.*|image: &lt;ACR-REGISTRY-NAME&gt;/$2:$3|g&quot; k8s-specifications/$1-deployment.yaml</pre><pre># Add the modified files<br>git add .</pre><pre># Commit the changes<br>git commit -m &quot;Update Kubernetes manifest&quot;</pre><pre># Push the changes back to the repository<br>git push</pre><pre># Cleanup: remove the temporary directory<br>rm -rf /tmp/temp_repo</pre><p>Don’t forget to change the token name , ACR name and your organization name</p><h3>What Does This Script Do?</h3><ol><li><strong>Clones a Git repository from Azure DevOps</strong> into a temporary directory.</li><li><strong>Modifies a Kubernetes deployment YAML file</strong> to update the image tag.</li><li><strong>Commits and pushes the changes</strong> back to the repository.</li><li><strong>Cleans up</strong> by deleting the temporary directory</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFoIgQIucmrAK3ZhJ_pqxQ.png" /></figure><h4>Step 2 : Added a new stage in pipeline</h4><ol><li>Go to Voting pipeline and edit a new stage Update</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erFQ_GiTW6U1ICO4HCXqdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*YGnUiAazfFY0VBa8Im2_Nw.png" /></figure><p><strong>What does this stage do → This stage will run the script that we created earliar</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*LGTBM4x-7KgXJ1otwHIfkQ.png" /></figure><pre># $1=vote $2=repository_name=votetapp $3=latest tag of the image these arguments<br># will used in the script we created or at the line given below</pre><pre>sed -i &quot;s|image:.*|image: &lt;ACR-REGISTRY-NAME&gt;/$2:$3|g&quot; k8s-specifications/$1-deployment.yaml</pre><pre>#THE above line will change the image tag to the lastest one</pre><p>2. when the Update stage is completed the changes will reflect in the vote-deployment.yaml file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PE_BNSZmP0B_PaS6-9ExMA.png" /></figure><p>3. Let’s make a change in app.py that will trigger a new pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*4FIBPqzdXx0gTfFEAWeCIA.png" /><figcaption>Change the option to winter and summer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHPsWlfpV-aSSvPGzHbY3Q.png" /><figcaption>Here new pipeline is triggered</figcaption></figure><p>4. Push Stage will push the image into ACR with the latest tag</p><p>5. Then update stage will run the script that update the image name in the deployment.yaml with the latest tag</p><p>6. Argocd will look for a change in k8s-specifications folder and found a new image as the tag was changed to latest one</p><p>7. As this change in the k8s-specifications folder will envoke the argocd to change application according to new image</p><p>8. But how argocd will fetch these changes from private container registeries for this we need to create secrets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYxPdBfik7vNTmFAnq2RPA.png" /><figcaption>Run the pipeline</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qq_vnV8eenkD_qortGfoA.png" /><figcaption><strong>This is our old tag let’s see if this is changing or not after we run update stage</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kn5ixg1W6A6v_HLXOcVkJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HbrineBXywVnLBQRyuQ7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bX2fC3HyJN5yODC0HFjLpw.png" /><figcaption>image is updated with the new tag</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*Y9HGWzNxaSip3G1El-hwrQ.png" /><figcaption>It is synced but not able to pull image from ACR</figcaption></figure><p>9. For this to resolve we need to create secrets that allow argocd to pull images from private repos</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*Tyh5-1Go3c_ItxKDLEweRw.png" /><figcaption>This is the error we are getting</figcaption></figure><p>10. Go to ACR &gt; Access keys and click on generate and copy the username and password and go back to your terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_W68-SvHq0rwRXzVH7v5w.png" /></figure><p>11. Copy the below command and make the accordingly</p><p>service-principal-id == username of your ACR</p><p>Service-principal-password == Password you copied</p><pre>kubectl create secret docker-registry &lt;secret-name&gt; \<br>  --namespace argocd \<br>  --docker-server=&lt;your-acr-name&gt;.azurecr.io \<br>  --docker-username=&lt;your-acr-username&gt; \<br>  --docker-password=&lt;your-acr-password&gt; \<br>  --docker-email=&lt;your-email&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*t9eAlSOEk1oseWOmsVckbQ.png" /></figure><p>12. Go to your Vote-deployment.yaml and add the follwing line</p><pre>imagePullSecrets:<br>- name: acr-secret</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*z6mQo6DWkgBuYLwNRI9Yzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*i0zagrgtr0bqScDhgD2hPw.png" /></figure><p>13. Now Again go to your vote/app.py to make changes that will triggerd the pipeline again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*RLxyEBZ7_ydMd_-oHEi3Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*h07VWM-q5yJbC7v7ko25Sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nUTnDrqhsIOn5YzvC1yQFQ.png" /><figcaption>Pipeline is triggerd again</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lb8czXnT6_tZWPoXozCp8w.png" /><figcaption>tag is changed to latest</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*f6Q_QcG4JGeqdCzIGOW2Sw.png" /><figcaption>image tag is updated to latest by update stage</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*8CqLpA5TttIUnKGSHCSKHQ.png" /><figcaption>argo-cd envoke as it founds the change in vote- deployment.yaml</figcaption></figure><p><strong>Go to your Web browser and and check for the change</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VnvZ6RoPG-PFuCHMK26SsA.png" /></figure><p>Here is your updated application</p><blockquote>From here we have completed our blog Thanks for reading</blockquote><p><a href="https://www.linkedin.com/in/aakib-khan-29b7aa252/">Follow me on linkedin</a></p><p><a href="http://github.com/aakibgithuber">Follow me on github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f5728de6f4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS security best practices assessments using Prowler]]></title>
            <link>https://aakibkhan1.medium.com/aws-security-best-practices-assessments-using-prowler-f561aed83828?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/f561aed83828</guid>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Thu, 02 Jan 2025 05:17:03 GMT</pubDate>
            <atom:updated>2025-01-02T05:17:03.009Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world securing your cloud infrastructure is not just a priority it is a necessity . As more businesses use AWS to run their applications and store data , it is important to keep these systems safe from hackers and other risks . AWS provides many tools to help with security , but it can be tricky to set everything up correctly. This is where <strong>Prowler</strong> comes in a tool that helps you check if your AWS setup is secure.</p><p>In this blog, we will break down how Prowler works , why AWS security is important , and how you can use this tool to make sure your AWS environment is safe</p><h3>Why Security in AWS is Essential</h3><p>When you use AWS, both you and AWS share responsibility for keeping things secure. AWS is responsible for the security of the cloud , like managing data centers and hardware . But you are responsible for securing everything inside the cloud, like how you manage user access, set up servers , and protect data</p><p>If something is not set up properly in your AWS account like if sensitive data is not protected it could lead to a data theft or other security problems . Regularly checking your setup to make sure it follows best security practices helps prevent these issues.<strong> That is where Prowler can help you to enhance your AWS security</strong></p><h3>What is Prowler</h3><p><strong>Prowler</strong> is a free tool that helps you check your AWS account for security problems . It checks your AWS setup and finds any weak spots that could lead to attacks</p><p>Prowler looks at different parts of your AWS account , such as:</p><ul><li><strong>Networking (VPC) :</strong> Are your network configurations secure, and are access points restricted?</li><li><strong>Virtual machines (EC2) </strong>: Are your servers secure?</li><li><strong>Security Groups :</strong> Are your firewall rules properly configured to limit access ?</li><li><strong>User permissions (IAM) </strong>: Do your users and roles have the right permissions and access ?</li><li><strong>Storage (S3) </strong>: Are your files secure, and who can access them?</li><li><strong>Logging (CloudTrail) </strong>: Is all activity in your AWS account being monitored</li><li><strong>Database (RDS) :</strong> Is your data encrypted and protected from unauthorized access ?</li><li><strong>Backups (EBS/Snapshot) :</strong> Are your backups secure and regularly tested for recovery ?</li><li><strong>Multi-Factor Authentication (MFA) :</strong> Is MFA enabled for all users to add an extra layer of security ?</li></ul><p>It also tells you how to fix any issues if finds .</p><h3>Key Features of Prowler</h3><h4>1. CIS Benchmark Checks</h4><p>The <strong>CIS Benchmark</strong> is a set of rules that explains how to keep an AWS environment secure . Prowler checks if your AWS setup follows these rules , making sure there are no unsafe settings</p><h4>2. Scans large no. of AWS Services</h4><p>AWS has many services (like EC2, S3, and IAM), and each one needs to be configured securely. Prowler scans many of these services to find security issues, such as:</p><ol><li>EC2 instances allowing anyone on the internet to connect.</li><li>S3 buckets that are publicly accessible when they should not be.</li><li>Not having encryption, which keeps sensitive data safe</li></ol><h4>3. Helps in Following the rules and regulations.</h4><p>If your company needs to follow certain security rules (like GDPR or HIPAA), Prowler can help by checking if your AWS environment meets these requirements. For example , it will verify if your data is encrypted or if you are keeping track of all changes and activity in your account.</p><h4>4. Customizable</h4><p>Prowler comes with many built in checks , but you can also create your own checks if you have specific needs . This makes it flexible for companies with unique security requirements.</p><h4>5. Detailed Reports</h4><p>After Prowler runs a scan,<strong> it creates a report showing</strong> all the security issues it found. The report also suggests how to fix these problems. This helps both technical teams and management understand what needs to be done to improve security.</p><h3>How to Install and Setup Prowler</h3><p>The first step in using Prowler is to install it on your computer or system. <strong>Prowler is a command line tool</strong> , which means you will be using a terminal or command prompt to run it</p><p><strong>1.Installation of Prowler :</strong></p><ol><li>Open a terminal on your computer. If you are using Windows, you can use Git Bash or PowerShell. On macOS or Linux, use the default terminal. <strong>In my case I am using ubuntu</strong></li><li>Run the following command in your terminal to download Prowler:</li></ol><pre>git clone https://github.com/prowler-cloud/prowler</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*FpGjk--pHDEkLzWLCImGmQ.png" /></figure><p>3. This command clone the github repository in your local machine</p><p>4. Run the follwing comands to install prowler</p><pre>cd prowler<br>apt install python3-poetry<br>poetry shell<br>poetry install<br>python prowler.py -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*chEhgW-EtZWjKGrt_Irg6g.png" /></figure><p>5. Now Prowler is installed and ready to run.</p><h4>2. Configure Your AWS Credentials</h4><p><strong>To allow Prowler to scan your AWS environment</strong>, it needs permission to access your AWS account. This is done through AWS IAM credentials. Before running Prowler, make sure you have the AWS CLI is installed in your local machine. If you don’t have the aws cli installed then follow the below command to install the aws cli</p><h4>1. Installing aws-cli</h4><pre>sudo su<br>apt update <br>curl &quot;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&quot; -o &quot;awscliv2.zip&quot;<br>sudo apt-get install unzip -y<br>unzip awscliv2.zip<br>sudo ./aws/install<br>aws --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*pFt1N6cveB1V_Ji0sB13Pg.png" /></figure><h4>2. Configure aws</h4><p><strong>1. Create an IAM user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*QTx-ABnr_TpMoIN9.png" /></figure><p><strong>click on iam</strong></p><p><strong>2. click on user →create user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*IHoQV--MacQ0Qux_.png" /></figure><p><strong>3. Give a name to your user and tick on provide user access to management console and then click on I want an IAM user option</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RInLl47V-K8_36FAmSoQQ.png" /></figure><p>5. choose a password for your user<strong> →click next</strong></p><p>6. Attach the policies directly to your iam user → click next</p><p><strong>note →I will provide the administrator accesss for now but we careful while attaching the policies at your workapce</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8yJCWxAf1yM8-zKPr9uWg.png" /></figure><p><strong>review and create user</strong></p><p>7. click on <strong>create user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uO7LapiKP_AhtM8j0HcGA.png" /></figure><p>8. download your password file if it is autogenerated otherwise it is your’s choice</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*rC_L4nOzTFzo-MTXvCFxeQ.png" /></figure><p>9. Now <strong>click on your Prowler IAM user →security credentials</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*34TjY6jkzdEqrUq_.png" /></figure><p>10. scroll down to access keys and create an access keys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Ep-QeLq7cgfllQoD.png" /></figure><p>11.<strong>choose aws cli from the options listed</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVAdrMfpkJ5BfXhx9_F4uA.png" /></figure><p><strong>12.</strong> click next and <strong>download you csv file for username and password</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2CGNdesWA6hepw08c2Yf9A.png" /></figure><p><strong>13.</strong> <strong>go to your terminal and type →aws configure</strong></p><p><strong>14.</strong> Now it is ask to your access key and secret key for this open your csv file and paste the access and secret key and remain everything default</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Uf9vT23iPR0muF1Y.png" /></figure><p><strong>15.</strong> Now you are ready to configure aws from your terminal</p><p>16. <strong>Once your AWS credentials are properly set up, Prowler will be able to scan your AWS environment for security issues.</strong></p><h4>3. Run a Basic Security Scan</h4><p>Now you have Prowler installed and your AWS credentials configured, you can run your first security scan. This basic scan checks your AWS environment against the <strong>CIS AWS Foundations Benchmark </strong>that is a set of security practices.</p><p>To see a prowler dashboard run the following command</p><pre>prowler dashboard</pre><p>To start the basic scan, type the following command into your terminal:</p><pre>prowler aws #if you are working with aws</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6FJep2rhvtm9-iOGFAYcg.png" /><figcaption>output of the above command</figcaption></figure><p>What this command does:</p><ul><li>It runs all the built-in checks for different AWS services like EC2 , S3 , IAM and more.</li><li>Prowler will start listing the results of the scan directly in your terminal. It will show which checks passed and which ones failed .</li></ul><p>For each failed check , Prowler will tell you what the issue is (for exmple “S3 bucket is publicly accessible”) and how to fix it ( Turn off public access).</p><p>To check the no. of services prowler support</p><pre>prowler aws --list-services</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeWgvXrV6HtrDGjboiFSIQ.png" /></figure><h4>4. Focus on Specific Services</h4><p>Sometimes, you might only want to check a particular AWS service instead of running a full scan . For example → you might want to check the security of your S3 storage or your EC2 instances without scanning everything.</p><p>To do this, you can run more focused scans. For example, if you want to check just your S3 storage, use the following command:</p><pre>./prowler -g s3</pre><p>This command only checks S3 buckets and makes sure that they are configured securely . If you want to check EC2 instances you can use :</p><pre>prowler aws --service s3 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKgGvLyFBwbdxTrFfxVAvA.png" /></figure><p>This is helpful when you are trying to fix an issue with a particular service or when you want to regularly monitor specific areas of your setup.</p><h4>5. Generating Detailed Reports</h4><p>After Prowler finishes scanning your AWS environment , you might want to save the results in a report. Prowler allows you to export the results in different formats like HTML , CSV or JSON .</p><p>For example , if you want a clean , easy to read HTML report that you can share with your team , run this command :</p><pre>prowler aws --output prowler_report --output-format html</pre><p>This will run the scan and save the output in prowler_report.html in the current directory.</p><pre>prowler aws — service s3 — output s3_report — output-format html</pre><p>This command will check S3-related configurations and save the report as s3_report.html.</p><p>This command creates an HTML file with all the results of the scan, including which checks passed or failed and recommendations on how to fix issues. You can open this report in a web browser, making it easy to review and share.</p><p>Other formats, such as CSV for use in spreadsheets and JSON , are also available, depending on how you want to work with the data.</p><h3>Best Practices for AWS Security Using Prowler</h3><p>Now that you understand how to use Prowler, let’s explore some best practices to help you get the most out of it . These tips will help you use Prowler helps you maintain the security of your AWS environment continuously, rather than just checking it once.</p><h4>1. Automate Regular Security Scans</h4><p>Cloud security is an ongoing effort, not something you do just once Even if your AWS environment is secure today, changes happen new resources get added, configurations change, and new risks can appear . This is why it is important to <strong>regularly scan your AWS account</strong>.</p><p>You can set up Prowler to run these scans automatically on a regular basis. By doing this, you won’t need to remember to manually run checks every week or month. There are several ways to automate these scans :</p><ul><li><strong>Use AWS Lambda</strong>: You can set up Lambda functions to automatically run Prowler on a schedule, like daily or weekly</li><li><strong>Add to CI/CD pipeline</strong>: If you are using a CI/CD pipeline, integrate Prowler as part of your deployment process. This way, Prowler can check your environment each time you deploy new updates or make changes to your AWS infrastructure.</li></ul><p>By automating scans, you ensure that potential security risks are detected quickly before they become major issues.</p><h4>2. Regularly Review IAM Permissions</h4><p>One of the most important aspects of AWS security is managing <strong>who has access</strong> to your AWS account and what they are allowed to do. AWS Identity and Access Management (IAM) controls this, and it is essential to regularly check that permissions are set correctly .</p><p>Over the time many users may collect permissions that they don’t need anymore, or new users might be given too broad access. This can increase the risk of accidental or malicious actions.</p><p>Prowler helps you regularly review your IAM setup by doing checks for</p><ul><li>Users or roles have too many permissions .</li><li>There are any unused accounts or roles that should be deleted.</li><li><strong>Multi factor authentication (MFA</strong>) is enabled to add an extra layer of security.</li></ul><p>Make it a habit to <strong>audit IAM permissions</strong> and clean up unused or excessive permissions. Always apply the <strong>principle of least privilege</strong>, which means giving users only the access they need and nothing more.</p><h4>3. Implement Encryption Across Services</h4><p>Encryption ensures that your data is protected, even if someone manages to access it. AWS allows you to encrypt data both <strong>at rest</strong> (when it is stored, like in S3 or RDS databases) and <strong>in transit</strong> (when it is being moved, like over the internet).</p><p>Prowler checks if your data is encrypted correctly by doing checks</p><ul><li>Are your S3 buckets encrypted ?</li><li>Are your RDS databases using encryption to protect stored data ?</li><li>Is encryption being used for data in transit, like when it is sent from your website to a database ?</li></ul><p>Make sure encryption is enforced for all sensitive data , and regularly use Prowler to confirm that these settings remain in place.</p><h4>4. Strengthen Security Group Settings</h4><p>AWS <strong>security groups</strong> act like a firewall for your EC2 instances. They control who can access your servers and what kind of traffic is allowed in or out. It is important to keep these settings tight to prevent unauthorized access.</p><p>One common mistake is leaving security groups too open. For example allowing <strong>SSH</strong> from anywhere on the internet is risky. Prowler can help you identify:</p><ul><li>Security groups that are too permissive, such as allowing anyone to connect to your servers.</li><li>Unnecessary open ports that might be exposing your EC2 Instances</li></ul><p>After running a Prowler scan, review any flagged security groups and restrict access to only what is necessary. This will help reduce the chances of an external attack.</p><blockquote>To wrap up :</blockquote><p>Keeping your AWS environment secure is really important today. Using tools like Prowler helps you check and improve your security regularly , so your data stays safe and meets necessary rules. Remember security is not just a one time job it is something you need to do all the time. By following good practices and checking your settings more often, you can protect your cloud systems from risks and keep your business running well.<strong> Stay alert and stay safe!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s1NZvRKZGKXxU4-c.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f561aed83828" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project 15 → Deploying -10 Microservices on Kubernetes cluster via Jenkins CI/CD Pipeline]]></title>
            <link>https://aakibkhan1.medium.com/project-15-deploying-10-microservices-on-kubernetes-cluster-via-jenkins-ci-cd-pipeline-634a2dc6f241?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/634a2dc6f241</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Sun, 22 Dec 2024 15:50:25 GMT</pubDate>
            <atom:updated>2025-01-03T07:40:21.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*LB11iyGQGcDXq86OBoxIVg.gif" /></figure><h3>Project Overview</h3><p>In this project we deploy 10 microservices in kubernetes cluster using jenkins pipeline….first we launch a Base server in which all the task is performed….then we take ssh of that EC2….next we install docker , jenkins , configure java ,eksctl , kubectl etc… moving forward to setup k8s cluster in aws that is EKS and atlast we run a multibranch pipeline that fetch code from github and deploy it on EKS cluster that is all about the project let’s begin</p><h3>Completion steps →</h3><p>Step 1 : Set a Base Instance</p><p>Step 2 : create an IAM user with specific permission</p><p>Step 3: Kubernetes</p><p>Step 4: Install Essential tools</p><p>Step 5: Setup jenkins</p><p>Step 6: create jenkins pipeline</p><h3>Step 1 : Set a Base Instance</h3><ol><li>Go to aws console and launch a instance with given configuration</li></ol><p>a. AMI = ubuntu 24</p><p>b. Type = t2.large</p><p>c. Storage = 30GB</p><p>d. ports to be opened = 22 , 80 ,443 ,8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDRODZGERFFg6IUD9ufJwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XZwRvktXPs-JlApAEaqHCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ddqcjx9zBRDnqTmUPNEzEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*yrrjwNRciCpTXlaqNzFyhA.png" /></figure><p>2. Take a ssh of your ec2 &gt;&gt;click on connect&gt;&gt;ssh client</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWG-sBcIFLMFmX9fUjNaOA.png" /></figure><p>3. copy the command and open your cmd and locate the download folder where your key pair (.pem file) is stored</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OfVou2gZy2rMi0FpCBb70Q.png" /><figcaption>run the above command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*ydnpzE-wnu4ECvml4fwgsg.png" /></figure><h3>Step 2 : create an IAM user with specific permission</h3><ol><li>go to aws console and search for IAM and then click on user&gt;&gt;create user</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iACwK6WzCzTnKuvZfe4zxg.png" /><figcaption>follow as shown above</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8uQR17Meur0q3P_vhgVwg.png" /><figcaption>attach specific policies directly as shown above</figcaption></figure><ul><li>AmazonEC2FullAccess</li><li>AmazonEKSClusterPolicy</li><li>AmazonEKSWorkerNodePolicy</li><li>AWSCloudFormationFullAccess</li><li>IAMFullAccess</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQ5OYiczbsltHAEKPOfEXQ.png" /><figcaption>download username and password</figcaption></figure><p><strong>2. create an Inline policy for eks</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huPpOYpR0iWmBjjoVLiBmA.png" /><figcaption>click on create inline policy&gt;&gt;json and enter the following script</figcaption></figure><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;eks:*&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvpIeMqZGVbv54CeSDlqiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8O3ZuBrGeuCelbuSuYusg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TxMrgfSWK-NLTCNv5p6FJA.png" /></figure><p><strong>3. After this create a access keys and secret keys to work with awscli in base ec2</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gjORP2dN6tlcGnSZNLJWKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ARBIOy47UTO_L3DTZexbA.png" /></figure><p>4. Download your secret and acess keys that we need to use later in the project</p><h3>Step 3: Kubernetes</h3><ol><li>go to your ec2 and run</li></ol><pre>aws configure</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*Qq7k2kOblrO5ggzMUMQIEg.png" /><figcaption>open .csv file to provide access keys and secret keys</figcaption></figure><p>2. Now you are log into aws via cli with limited permission provided in earliar steps</p><p>3. Create an Eks cluster using the following command</p><pre>eksctl create cluster --name=EKS-1 --region=ap-south-1 --zones=ap-south-1a,ap-south-1b --without-nodegroup</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOii940K5E-z9vozDpGGbA.png" /></figure><p>4. <strong>Associate OIDC Provider →</strong>An <strong>OIDC provider</strong> (OpenID Connect provider) is like an <strong>identity verification service</strong> for applications. It ensures that people or systems accessing your application or cloud resources are who they claim to be.</p><p>Imagine you want to enter a secure building. At the entrance:</p><ol><li>You show your <strong>ID card</strong> to prove your identity.</li><li>The security guard checks your ID against a trusted database.</li></ol><p>In this case:</p><ul><li>Your <strong>ID card</strong> is the identity token.</li><li>The <strong>OIDC provider</strong> is the trusted system (the database) that confirms your ID is valid.</li></ul><pre>eksctl utils associate-iam-oidc-provider --region ap-south-1 --cluster EKS-1 --approve</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6Ye53hAWBSX88rf4EmSbg.png" /></figure><p>5. <strong>Create Node Group</strong>:</p><pre>eksctl create nodegroup --cluster=EKS-1 --region=ap-south-1 --name=node2 --node-type=t3.medium --nodes=3 --nodes-min=2 --nodes-max=4 --node-volume-size=20 --ssh-access --ssh-public-key=DevOps --managed --asg-access --external-dns-access --full-ecr-access --appmesh-access --alb-ingress-access</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2j8CWrH7hZ6jUfY23yH04A.png" /></figure><p><strong>6. update kubeconfig</strong> →This command aws eks update-kubeconfig is used to configure your local Kubernetes kubectl command-line tool to interact with an Amazon EKS (Elastic Kubernetes Service) cluster.</p><pre>aws eks update-kubeconfig --region ap-south-1 --name EKS-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yikyXiSriTbQ5kkK-WdBBg.png" /><figcaption>cluster created by aws-cli</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaVFIi16mN1LBcr7yIVzvw.png" /><figcaption>Node created by cluster</figcaption></figure><p><strong>a. Create a namesapce:</strong></p><p>A <strong>namespace</strong> in Kubernetes is like a <strong>folder</strong> for organizing resources. It helps you group and manage Kubernetes objects (like pods, services, or secrets) that belong to the same team, project, or environment.</p><pre>kubectl create namespace webapps<br>kubectl get namespaces</pre><p><strong>b. Creating Service Account:</strong></p><p>A <strong>Service Account</strong> in Kubernetes is like a <strong>special user for applications</strong> running in your cluster. It allows pods (your running applications) to interact with the Kubernetes API or other systems securely.</p><pre>vim svc-acc.yaml</pre><pre>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br>  name: jenkins<br>  namespace: webapps</pre><pre>kubectl apply -f svc-acc.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*-ySsu3gTk6KlDHLp_jeoUA.png" /></figure><h4><strong>c. Create role :</strong></h4><p><strong>It is </strong>used to define a <strong>Role</strong> or <strong>RoleBinding</strong> for an application in your cluster. It specifies what actions the application (or a service account used by the application) is allowed to perform on specific resources within a namespace.</p><ul><li>A Role in Kubernetes grants <strong>permissions within a single namespace</strong>.</li><li>It specifies what actions (like get, list, create, delete) are allowed on certain resources (like Pods, Services, ConfigMaps).</li></ul><pre>vim app-role.yaml</pre><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: Role<br>metadata:<br>  name: app-role<br>  namespace: webapps<br>rules:<br>  - apiGroups:<br>        - &quot;&quot;<br>        - apps<br>        - autoscaling<br>        - batch<br>        - extensions<br>        - policy<br>        - rbac.authorization.k8s.io<br>    resources:<br>      - pods<br>      - componentstatuses<br>      - configmaps<br>      - daemonsets<br>      - deployments<br>      - events<br>      - endpoints<br>      - horizontalpodautoscalers<br>      - ingress<br>      - jobs<br>      - limitranges<br>      - namespaces<br>      - nodes<br>      - pods<br>      - persistentvolumes<br>      - persistentvolumeclaims<br>      - resourcequotas<br>      - replicasets<br>      - replicationcontrollers<br>      - serviceaccounts<br>      - services<br>    verbs: [&quot;get&quot;, &quot;list&quot;, &quot;watch&quot;, &quot;create&quot;, &quot;update&quot;, &quot;patch&quot;, &quot;delete&quot;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*lzb2gi18iKEU70pElGwB0w.png" /></figure><h4>d. Bind the role to service account:</h4><ul><li>A RoleBinding <strong>binds a Role</strong> to a user, group, or service account, allowing them to use the permissions defined in the Role.</li></ul><pre>vim role-bind.yaml</pre><pre>apiVersion: rbac.authorization.k8s.io/v1<br>kind: RoleBinding<br>metadata:<br>  name: app-rolebinding<br>  namespace: webapps <br>roleRef:<br>  apiGroup: rbac.authorization.k8s.io<br>  kind: Role<br>  name: app-role <br>subjects:<br>- namespace: webapps <br>  kind: ServiceAccount<br>  name: jenkins </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*ISlscYtZgJQtzfBDh9neuw.png" /></figure><h4><strong>e. Create a token</strong> by utilizing a service account in the desired namespace</h4><p>A <strong>secret token</strong> in Kubernetes is used to allow a pod or application to securely prove its identity and access resources it has permission for. It’s like a <strong>password</strong> or <strong>keycard</strong> for your application.</p><pre>vim secret.yaml</pre><pre>apiVersion: v1<br>kind: Secret<br>type: kubernetes.io/service-account-token<br>metadata:<br>  name: mysecretname<br>  annotations:<br>    kubernetes.io/service-account.name: jenkins</pre><pre>kubectl apply -f secret.yaml -n webapps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*bKso7Hx7XdWBNdb2p06mDw.png" /></figure><p>Now run →</p><pre>kubectl describe secret mysecretname -n webapps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J22tHqpFxqIPGFDqwIPgIw.png" /></figure><p>copy the token and paste it to your notepad for future refrence</p><h3>Step 4: Install Essential tools</h3><p>back to EC2 and run the following commands first</p><pre>sudo su<br>apt update</pre><ol><li><strong>Now make a shell script file to install the docker , jenkins , awscli etc….</strong></li></ol><pre>vim install.sh</pre><pre><br>#!/bin/bash<br>sudo apt update -y<br>wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc<br>echo &quot;deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= &#39;/^VERSION_CODENAME/{print$2}&#39; /etc/os-release) main&quot; | tee /etc/apt/sources.list.d/adoptium.list<br>sudo apt update -y<br>sudo apt install temurin-17-jdk -y<br>/usr/bin/java --version<br><br>#install jenkins<br>curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc &gt; /dev/null<br>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<br>sudo apt-get update -y<br>sudo apt-get install jenkins -y<br>sudo systemctl start jenkins<br>sudo systemctl status jenkins<br><br>#install docker<br>sudo apt-get update<br>sudo apt-get install docker.io -y<br>sudo usermod -aG docker ubuntu<br>sudo usermod -aG docker jenkins<br>newgrp docker<br>sudo chmod 777 /var/run/docker.sock<br>sudo systemctl restart jenkins<br><br><br># Install AWS CLI <br>curl &quot;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&quot; -o &quot;awscliv2.zip&quot;<br>sudo apt-get install unzip -y<br>unzip awscliv2.zip<br>sudo ./aws/install<br><br><br># Install kubectl<br>sudo apt update<br>sudo apt install curl -y<br>curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl<br>sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl<br>kubectl version --client<br><br># Install eksctl<br>curl --silent --location &quot;https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz&quot; | tar xz -C /tmp<br>sudo mv /tmp/eksctl /usr/local/bin<br>eksctl version</pre><p>2. Above script will install jenkins , docker ,kubectl ,eksctl etc….. tools</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3F8sFGRDIF7SU2ZqUhADlg.png" /><figcaption>press →esc+:wq for exit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*QLx63nAX_h-v5VtIgtXA8w.png" /><figcaption>run the above command to execute the script</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxDxOmVv6Bt4bYBpFQT6jw.png" /></figure><h3>Step 5: Setup jenkins</h3><ol><li>Go to your browser and type&gt;&gt; public_ip:8080 (to access jenkins console)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*yKJQN5dwhUVyUQds.png" /></figure><p><strong>2.</strong> for this go to your ec2 and connect it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*1nolWmV2BzW0yCAC.png" /></figure><p>3. run the below commands</p><pre>sudo su<br>cat /var/lib/jenkins/secrets/initialAdminPassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XnvXlYtDmbsvVLXL.png" /></figure><p><strong>output is your password and paste it to your jenkins</strong></p><p><strong>4. Install the suggested plugins</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*r_VBCJIUXtpyhGTc.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*gR1A0U9UcxLJPesR.png" /></figure><p><strong>5. Setup your jenkins user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*LjZdMqAyN6o3Wuar.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*eOgIh-ClZye67c4I.png" /></figure><p>Welcome to jenkins dashboard</p><h4>a. Install Plugins listed below</h4><ol><li>docker (all plugins)</li><li>kubernetes (all plugins)</li><li>Multibranch scan webhook trigger</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Euu-P8yL4KVVFF2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rqn9P_31upkJGzY5.png" /></figure><h4>b. Setup docker credentials</h4><ol><li>go to your jenkins →manage jenkins →credentials →global →add credentials</li><li>provide your username and password of your dockerhub</li><li>id==docker</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*nH0xpAiiCKaDmoDS.png" /></figure><h4>c. setup git credentials →<a href="https://aakibkhan1.medium.com/git-error-remote-support-for-password-authentication-was-removed-on-august-13-2021-6f2415e581a2">click on me to see how to generate token in github</a></h4><ol><li>Now copy that token from github and</li><li>go to your jenkins →manage jenkins →credentials →global →add credentials</li><li>provide your username and password of your github</li><li>id==github</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*sCb_UQO-lq9nd43Y.png" /><figcaption>click on create</figcaption></figure><h4><strong>d. set k8s token</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J22tHqpFxqIPGFDqwIPgIw.png" /><figcaption>remember the token we generated above</figcaption></figure><ol><li>go to credentials section chose secret text in kind section and paste your token in secret id==k8-token and then click on create</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QeAC_fVj2CeZtI6XidXIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVbf3JV7_rb4cd4IrkMy7g.png" /><figcaption>all the credentials are setup let’s move to pipeline script</figcaption></figure><h3>Step 6: create jenkins pipeline</h3><ol><li>click on New item and chose multibranch pipeline</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fimZHoKSMaE4rbyUvafAqg.png" /><figcaption>click ok</figcaption></figure><p>2. Now chose git from add source option and paste the project repo url there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HI5ydXt__mxy2M9_UdkTCw.png" /><figcaption>chose git credentials from dropdown that we setup in above steps</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5X9AIaWeCCgUOE1pfcVcA.png" /></figure><p>3. Now we need to setup webhook in github to trigger the pipeline</p><p>4. go to your project repo in github and click on setting&gt;&gt;webhooks&gt;&gt;Add a webhook</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCU8zLEKFfD0dVVzXdHOxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfbTAEm98sPJufRAUBR2nQ.png" /><figcaption>in Url section type → <a href="http://13.232.74.177:8080/multibranch-webhook-trigger/invoke?token=microservice">http://public_ip:8080/multibranch-webhook-trigger/invoke?token=microservice</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwaVV1m1DtyrGQxSHY4UWg.png" /><figcaption>your webhook is ready and now the pipeline will automatically triggers whenever we make a change in the project repo</figcaption></figure><p>5. go back to your jenkins pipeline dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2lZ8PW5BcuqyPk4mRZcHdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kb-XMQg_DAIaXzjoaqkXTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7EqZb2Jyt93Kl2BMs-MYg.png" /><figcaption>go to your ec2 and run kubectl get svc -n webapps</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ek53ImQsooHu-sQmhsdE3g.png" /><figcaption>copy the Load-balancer url and paste it on browser !!! make sure using http not https</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-9j6YL_WoQUmnCIUEHRnQ.png" /></figure><p>Here is website having 10 microservice running in</p><p>Usual Error in Jenkins Pipeline →make sure to change api server endpoint in jenkins file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*E_Gzi-X8ZnoYDeUyaJ1GMg.png" /><figcaption>copy this endpoint and replace in jenkinsfile</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRrGOaegAJoD4JzyUUls4Q.png" /><figcaption>paste your endpoint here</figcaption></figure><p>Now this project is completed here !!!</p><p><a href="https://www.linkedin.com/in/aakib-khan-29b7aa252/">follow me on linkedin</a></p><p><a href="http://github.com/aakibgithuber">follow me on github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=634a2dc6f241" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 8 Essential Tools for Software Architecture Diagrams]]></title>
            <link>https://aakibkhan1.medium.com/top-8-essential-tools-for-software-architecture-diagrams-417cabdc566a?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/417cabdc566a</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloudairy]]></category>
            <category><![CDATA[draw-io]]></category>
            <category><![CDATA[diagrams]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 15:39:20 GMT</pubDate>
            <atom:updated>2024-09-17T15:39:20.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7P8W-rC6VKG7YjeYkNXjLg.png" /></figure><p>When you are devleoping a software you have different parts of the system databases, servers, API and they all need to talk to each other . That is where software architecture diagrams come in handy . These diagrams give you a visual breakdown of how everything fits together , making it easier to plan , build , and explain your software .</p><p>For any job , having the right tools makes all the difference . Here is a eight great tools that can help you create clear and useful software architecture diagrams</p><h3>1. Cloudairy Cloudchart</h3><p><a href="https://cloudairy.com/"><strong>Cloudairy</strong></a><strong> Cloudchart </strong>is a cloud focused diagram tool designed to help you easily map out cloud infrastructures . Whether you are working with AWS , Azure and Google Cloud , it has everything you need to create clear and detailed architecture diagrams specific to cloud environments</p><p><strong>Features of Cloudairy Cloudchart :</strong></p><ul><li><strong>Cloud Service Icons : </strong>Provides icons and shapes for cloud services like AWS , Azure , and Google Cloud and many more .</li><li><strong>Drag and Drop Editor </strong>: Quickly build diagrams by dragging shapes into place .</li><li><strong>Templates </strong>: 500+ cloud/DevOps/flowchart templates that help you start your diagram quickly</li><li><strong>Real Time Collaboration </strong>: Multiple users can work on the same diagram at once .</li><li><strong>Export Features</strong> : Easily export your diagrams in various formats, including animated SVG, GIF, PNG and more allowing you to share or embed them anywhere while keeping the quality intact.</li><li><strong>Easy Sharing </strong>: Share diagrams with others through links or integrate with other tools for easy access .</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>You will love how Cloudairy Cloudchart makes it easy to show cloud systems clearly , with special icons for cloud services</li><li>Drag and drop editor for quick creation of cloud system diagrams</li><li>It is super easy to use , so you can build diagrams quickly without needing to learn anything complicated</li><li>It is great for teamwork because everyone can work on the diagram together at the same time</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*I2S_56bAguEWHy6DEuc6eg.gif" /><figcaption>Animated Diagram from <a href="https://chart.cloudairy.com/templates/2fb0655b-df88-4cc3-b2a9-4a7d18f7f426"><strong>Cloudchart</strong></a></figcaption></figure><p>If your software architecture is built on cloud infrastructure , Cloudairy Cloudchart is the perfect tool for creating precise , easy to read diagrams</p><h3>2. Lucidchart</h3><p>Lucidchart is one of the easiest tools to use when it comes to making diagrams . It is all online so you don’t need to install anything , and it works great for teams . You can drag and drop shapes , create flowcharts , and even work with your team in real time</p><p><strong>Features of Lucidchart </strong>:</p><ul><li><strong>Drag and Drop Editor </strong>: Easily add and arrange shapes and lines by dragging and dropping them</li><li><strong>Real Time Collaboration </strong>: Work on diagrams with your team at the same time and see changes as they happen</li><li><strong>Pre-Made Templates </strong>: Use ready made templates to save time and get started quickly</li><li><strong>Integration </strong>: Connects with other tools like Google Workspace and Slack for smoother workflows</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>Super easy to use , even if you have never made a diagram before</li><li>You and your team can edit diagrams together</li><li>Has ready made templates , so you don’t have to start from scratch</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ntOyVLfI5uVA9f6N.png" /><figcaption><strong>Diagram from Lucidchart</strong></figcaption></figure><h3>3. Draw.io (Diagrams.net)</h3><p>Draw.io is a free , no frills tool that is perfect for simple diagramming needs . It is web-based , so you don’t have to download anything . Even though it is simple , it gets the job done for a lot of developers .</p><p><strong>Features of Draw.io </strong>:</p><ul><li><strong>Free to Use </strong>: No cost to use the tool just go to the website and start creating</li><li><strong>Cloud Storage Integration </strong>: Save your diagrams directly to Google Drive , OneDrive or Dropbox</li><li><strong>Offline Mode </strong>: You can work on your diagrams without an internet connection if you download the app .</li><li><strong>Export Options </strong>: Save your diagrams in various formats like PNG , PDF , or SVG for easy sharing</li></ul><p><strong>Why you will like it</strong>:</p><ul><li>It is free for use</li><li>Works with Google Drive , OneDrive , and other cloud services .</li><li>No account needed just open the website and start creating .</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cF1EoJEflVhQKOio.png" /><figcaption><strong>Diagram from draw.io</strong></figcaption></figure><h3>4. Gliffy</h3><p>Gliffy is another web based tool that is easy to pick up and use . Like Lucidchart , it is drag and drop , but it also integrates with project management tools like Jira and Confluence , which is handy for teams working in Agile environments</p><p><strong>Features of Gliffy </strong>:</p><ul><li><strong>User Friendly Interface </strong>: Simple drag and drop design makes it easy to create diagrams</li><li><strong>Variety of Templates </strong>: Use built-in templates for different types of diagrams like flowcharts and UML diagrams</li><li><strong>Jira and Confluence Integration </strong>: Works well with Jira and Confluence, useful for teams in Agile environments .</li><li><strong>Real Time Collaboration</strong>: Collaborate with others in real time to update and refine diagrams together .</li></ul><p><strong>Why you will like it</strong>:</p><ul><li>Simple, clean interface easy to use .</li><li>Great for UML diagrams , flowcharts , and wireframes .</li><li>Works well with Jira and Confluence for teams using Agile .</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/0*VvRZiS4aKlnL6Z_Q.png" /><figcaption><strong>Gliffy Interface</strong></figcaption></figure><h3>5. Excalidraw</h3><p>Excalidraw is an online tool that provides a simple , sketchy style for creating diagrams and drawings .</p><p><strong>Features of Excalidraw </strong>:</p><ul><li><strong>Hand Drawn Style </strong>: Create diagrams that look like they are drawn by hand , giving a more casual and approachable feel</li><li><strong>Real Time Collaboration </strong>: Work on diagrams with others in real time and see changes instantly .</li><li><strong>Easy to Use Interface </strong>: Simple and intuitive , making it quick to pick up and start drawing .</li><li><strong>Export Options </strong>: Save your diagrams in formats like PNG or SVG for easy sharing and embedding</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>You will enjoy creating diagrams with a hand drawn look , giving your designs a more personal and relaxed feel .</li><li>It is really easy to use , so you can quickly start drawing without spending time learning complex tools</li><li>You can collaborate with others in real time , which is perfect for team projects where everyone can work together at once</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*1_1vI_xJ4-pyWj3i" /><figcaption><strong>Diagram from Excalidraw</strong></figcaption></figure><h3>6. C4 Model</h3><p>The C4 Model is not a tool but a method . It helps you create diagrams that show your system at different levels big picture views down to the code . You can use it with tools like Structurizr to make the diagrams more structured .</p><p><strong>Features of C4 Model </strong>:</p><ul><li><strong>Structured Approach </strong>: Helps you create diagrams at different levels of detail ( system , container , component , and code )</li><li><strong>Clarity </strong>: Provides a clear way to break down and understand complex systems .</li><li><strong>Consistent </strong>: Keeps your diagrams organized and consistent across different levels .</li><li><strong>Tool Integration </strong>: Use with tools like Structurizr to automate and manage your diagrams .</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>Focuses on breaking down your system into simple , understandable parts</li><li>Great for visualizing complex systems step by step</li><li>Works with Structurizr to automate the diagram making process</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PDN1RXokVbKT2Tkz.jpg" /><figcaption>C4 Model for software architecture</figcaption></figure><h3>7. PlantUML</h3><p>PlantUML is a different kind of tool . Instead of dragging shapes around , you write code to describe your diagram , and PlantUML turns that into an image . It is great for developers who are more comfortable writing than designing .</p><p><strong>Features of Plant UML </strong>:</p><ul><li><strong>Text Based Diagramming </strong>: Write text code to describe your diagram , and PlantUML generates the visual for you</li><li><strong>Support for Many Diagram Types </strong>: Create UML diagrams , sequence diagrams , and more using code</li><li><strong>IDE Integration </strong>: Works with popular development environments like IntelliJ and Visual Studio Code</li><li><strong>Automated Updates </strong>: Easily update diagrams by changing the code , which is useful for keeping documentation in sync</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>You can write simple text to generate complex diagrams</li><li>Works with many IDEs like IntelliJ and Visual Studio Code</li><li>Perfect for automating diagram creation from code</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zG4TcsC6pSXYYMOH.png" /><figcaption><strong>Example of Plant UML Diagram</strong></figcaption></figure><h3>8. Miro</h3><p>Miro is a versatile online whiteboard tool that is excellent for brainstorming and visualizing ideas . It is great for creating collaborative diagrams and allows for a more free form approach to diagramming.</p><p><strong>Features of Miro </strong>:</p><ul><li><strong>Interactive Whiteboard </strong>: Provides a flexible canvas where you can freely arrange shapes , text , and sticky notes</li><li><strong>Collaboration </strong>: Work with your team in real time , adding comments and feedback directly on the board .</li><li><strong>Templates </strong>: It offers a variety of templates for different types of diagrams</li><li><strong>Integration </strong>: Connects with tools like Slack , Google Drive and Microsoft Teams for easy sharing and collaboration</li></ul><p><strong>Why you will like it </strong>:</p><ul><li>Ideal for collaborative and idea mapping</li><li>Flexible and allows you to create diagrams , flowcharts , and even mind maps</li><li>Supports real time collaboration with your team</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z5AgbfT1J5VIQYMz.png" /></figure><p>All of these tools have something different to offer , so it really comes down to what works best for you</p><p><a href="https://cloudairy.com/"><strong>Cloudairy</strong></a><strong> Cloudchart</strong> is perfect for anyone dealing with Cloud architecture, flowchart, mindmap, devops and more , thanks to its handy templates and cloud specific icons</p><p><strong>Lucidchart</strong> is great if you areworking with a team and need real time collaboration .</p><p>If you are after something free and flexible , <strong>Draw.io</strong> is a solid choice</p><p>For simplicity and easy integration with other tools , <strong>Gliffy</strong> is a good option.</p><p><strong>Excalidraw</strong> gives you that sketchy , casual style , which can be easy to use .</p><p>If you prefer a structured way of breaking down complex systems , the <strong>C4 Model</strong> will be really helpful</p><p><strong>Miro</strong> is awesome for working together , while <strong>PlantUML</strong> is perfect if you prefer creating diagrams with code</p><p>Whatever your need , there is a tool here to help you design your system in the way that suits you best</p><h4>What are you waiting for just go and design your diagrams !!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=417cabdc566a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project 14 →Deployment of Three-tier web application with Docker-compose]]></title>
            <link>https://aakibkhan1.medium.com/deployment-of-three-tier-web-application-with-docker-compose-7a5f6fc3f274?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a5f6fc3f274</guid>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 10:13:47 GMT</pubDate>
            <atom:updated>2024-09-16T05:24:48.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1h5jUi_Wwb4YRbX8IaM8RA.gif" /></figure><h3>Topics covered in this blog</h3><ol><li>Introduction about the project</li><li>Three-Tier Web Application Architecture</li><li>Deployment Flowchart</li><li>DevOps Pipeline to Deploy Applications in Development, QA, and Production</li></ol><h4><strong>Phase 1 : Testing Locally</strong></h4><blockquote><strong>Step 1 : setup a Base EC2</strong></blockquote><blockquote><strong>Step 2 : IAM Role for EC2</strong></blockquote><blockquote><strong>Step 3 : Clone the github Repository</strong></blockquote><blockquote><strong>Step 4 : Setup Docker and docker compose</strong></blockquote><blockquote><strong>Step 5 : Deploy Locally using docker-compose</strong></blockquote><h4><strong>Phase 2 : Setup CI/CD Pipeline</strong></h4><blockquote><strong>Step 1→ Setup Sonarqube</strong></blockquote><blockquote><strong>Step 2 →Setup jenkins</strong></blockquote><blockquote><strong>Step 3 → Install Plugins</strong></blockquote><blockquote><strong>Step 4 → Setup Credentials</strong></blockquote><blockquote><strong>Step 5 → Setup Tools and configure global setting</strong></blockquote><blockquote><strong>Step 6 → Pipeline script</strong></blockquote><h4><strong>Phase 3 : Setup Multiple Pipeline for Quality Assuarance and for Production</strong></h4><ul><li>Pipeline for Development</li><li>Pipeline for Quality assurance</li><li>Pipeline for Production</li></ul><h3>1. Introduction</h3><p>In today’s world, many websites and applications we use every day, like online stores, social media platforms, or banking apps, are built using something called a <strong>three-tier architecture</strong>. This design pattern helps developers organize their code and make sure the application works smoothly, securely, and efficiently.</p><p>The three tiers (or layers) in this architecture are:</p><ol><li><strong>Presentation Layer (Frontend)</strong> — This is what users see and interact with, like the buttons, images, and forms on a website.</li><li><strong>Logic Layer (Backend)</strong> — This handles the “behind the scenes” work, like processing user data, running calculations, or managing tasks.</li><li><strong>Data Layer (Database)</strong> — This stores and retrieves all the important information, like user profiles, product details, or transaction history.</li></ol><p>Each of these layers works together to make sure the website or application runs well. The three-tier architecture is very popular because it keeps things organized, makes applications easier to update, and helps handle large numbers of users without slowing down.</p><p>In this blog, we’ll take a detailed look at how these layers work, how the application is deployed step-by-step, and how developers use tools like DevOps pipelines to automate the process of building and updating the application in different environments such as <strong>Development (Dev)</strong>, <strong>Quality Assurance (QA)</strong>, and <strong>Production (Prod)</strong>.</p><p>we are going to deploy this three-tier application with <strong>docker compose</strong></p><p><strong>Docker Compose is a tool that makes it easier to manage multi-container Docker applications.</strong></p><p>Think of Docker as a way to package your app into a “container,” which includes everything it needs to run, like code, libraries, and system tools. But many apps need more than one container to work. For example, a web app might need one container for the web server and another for the database.</p><p>Docker Compose lets you define and run these multiple containers with a simple text file called docker-compose.yml. In this file, you list all the containers your app needs and how they should interact. Then, with one command, Docker Compose will start everything up, making sure all the containers work together as intended.</p><p>In short, Docker Compose is like an organizer for your Docker containers, making it easy to manage and run complex apps with just a few commands</p><h3>2. Three-Tier Web Application Architecture</h3><p>Web applications today, whether it’s an online shopping platform or a social media site, are often built using a <strong>three-tier architecture</strong>. This design is popular because it splits the application into three distinct parts, making it easier to manage and maintain. Each part has a specific job to do, and they all work together to give users a smooth experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgSz0OyB85ZXEf-OrUHh7w.gif" /><figcaption>Designed with <strong>cloudairy cloudchart</strong></figcaption></figure><p>Let’s break down these three parts:</p><h4>1) Presentation Layer (The Frontend)</h4><p>Think of this as the face of your application. It’s what users see and interact with when they visit your website. This layer includes all the visual stuff — buttons, images, forms, menus, and text.</p><p>For example, if you’re on an shopping website, the homepage, the search bar, the product listings, and the “Add to Cart” button are all part of this <strong>presentation layer</strong>. When you click on a product to view more details, you’re interacting with this layer.</p><p><strong>Technologies used Here </strong>:</p><ul><li><strong>HTML</strong> (for the structure of web pages)</li><li><strong>CSS</strong> (to make things look nice and styled)</li><li><strong>JavaScript</strong> (to make the website interactive, like responding when you click buttons)</li></ul><h4>2) Logic Layer (The Backend)</h4><p>This is where the magic happens. The logic layer handles all the heavy lifting. When you, the user, click a button or submit a form on the frontend, this middle layer processes the request, does the calculations, and makes decisions based on what you want to do.</p><p>Let’s say you’re shopping online and you add something to your cart. The backend checks whether the item is available, updates your cart, and calculates the total. It doesn’t just store or display the information — it <strong>works</strong> with it.</p><p>The logic layer is like the “brain” of the application. It processes what the user does on the frontend and interacts with the database to get or save data. Once it processes everything, it sends the final result back to the frontend for the user to see.</p><p><strong>Technologies used here</strong>:</p><ul><li>Programming languages like <strong>Python</strong>, <strong>Java</strong>, <strong>Node.js</strong>, or <strong>Ruby</strong>.</li><li>Frameworks such as <strong>Django</strong> (for Python) or <strong>Spring</strong> (for Java).</li><li><strong>APIs</strong> (Application Programming Interfaces), which let the frontend and backend talk to each other.</li></ul><h4>3) Data Layer (The Database)</h4><p>The data layer is where all the important information is stored. This could be anything from user profiles, order histories, or product details. The database holds onto this data and sends it back to the logic layer whenever it’s needed.</p><p>For example, when you log in to your account on a website, the backend checks the data layer for your username and password. If it finds a match, it lets you log in. If not, it shows an error message.</p><p>The data layer stores, updates, and retrieves data as the backend requests it. When you submit a form or need to see certain information (like product availability), the backend checks with the database to get the info and then processes it.</p><p><strong>Technologies used here </strong>:</p><ul><li><strong>SQL databases</strong> like <strong>MySQL</strong> or <strong>PostgreSQL</strong>.</li><li><strong>NoSQL databases</strong> like <strong>MongoDB</strong> (which is great for unstructured data).</li><li><strong>Cloud databases</strong> like <strong>AWS RDS</strong> or <strong>Google Cloud SQL</strong> for managing large-scale applications.</li></ul><h4>How Do These Layers Interact With Each Other</h4><p>Let’s walk through a real-world example. Imagine you’re on a website, looking to buy a new pair of shoes:</p><ol><li>You search for “sneakers” in the search bar (this is happening on the <strong>frontend</strong>).</li><li>The search request is sent to the <strong>backend</strong>, where the logic layer processes it. The backend knows it needs to look in the database for sneakers.</li><li>The <strong>database</strong> (data layer) is queried, and it sends back a list of all the sneakers available in the store.</li><li>The backend receives this data, processes it, and sends the result back to the <strong>frontend</strong>, which displays all the sneakers on your screen.</li></ol><p>Each layer has its own job, but they rely on each other to keep the application running smoothly. This separation of responsibilities makes the system more organized and scalable. If you need to change the design, you only modify the frontend. If you need to update how the system handles data, you focus on the backend or database.</p><p>If you ever <strong>wonder how websites like Amazon or Netflix handle millions of users at the same time</strong>, it’s thanks to architectures like this one!</p><h3>3. Deployment Flowchart for a Three-Tier Web Application</h3><ol><li><strong>Coding Part</strong></li></ol><ul><li><strong>Frontend code </strong>: Developers design and build the part of the app you see and interact with.</li><li><strong>Backend code</strong>: Developers write the code that handles data processing and logic.</li></ul><p>2. <strong>Code Management</strong></p><ul><li>Written code is managed by source code management tools like git Think of it as a shared workspace where everyone’s changes are recorded.</li><li>When after your code is ready you have to push it in a central repository like github</li></ul><p>3. <strong>CI/CD Pipeine</strong></p><ul><li>You can use any CI/CD tool like jenkins , circle ci etc. for me it is jenkins</li><li>Jenkins is the CI/CD tool which automate the whole Software Development Lifecycle Process</li><li>It Fetches code from github , tests it and deployed on docker container</li></ul><p><strong>4. Containerization</strong></p><ul><li>The app is packed into <strong>containers</strong> (using Docker), making it easy to run consistently across different environments.</li></ul><p><strong>5. Set Up Different Environments</strong></p><ul><li><strong>Development (Dev)</strong>: Where the initial testing happens.</li><li><strong>Quality Assurance (QA)</strong>: Where more detailed testing and bug fixes are done.</li><li><strong>Production (Prod)</strong>: The live version of the app where real users interact with it.</li></ul><p><strong>6. Deploy to Dev Environment</strong></p><ul><li>The new code is first deployed to the <strong>Dev environment</strong>. Here, developers check if everything works as expected.</li></ul><p><strong>7. Testing in QA Environment</strong></p><ul><li>Next, the code moves to <strong>QA</strong>. Testers perform more rigorous testing to ensure there are no bugs or performance issues.</li></ul><p><strong>8 . Get Approval for Production</strong></p><ul><li>Once QA testing is complete and the code is stable, it’s reviewed for final approval before going live.</li></ul><p><strong>9. Deploy to Production</strong></p><ul><li>The code is deployed to the <strong>Production environment</strong>. This is where users can see and use the updated app.</li></ul><p><strong>10. Repeat and Improve</strong></p><ul><li>The process starts again with new code updates, improving the app based on user feedback and performance data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jc7YkjiEK2aZ_XZtXzZtQ.gif" /><figcaption>Designed with <strong>cloudairy cloudchart</strong></figcaption></figure><h3>4. DevOps Pipeline to Deploy Applications in Development, QA, and Production :</h3><h4>Phase 1 : Testing Locally</h4><p><strong>Step 1 : setup a Base EC2</strong></p><p><strong>Step 2 : IAM Role for EC2</strong></p><p><strong>Step 3 : Clone the github Repository</strong></p><p><strong>Step 4 : Setup Docker and docker compose</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MRt4oSRXUBrgMMhSeJjezA.gif" /><figcaption>Designed with <strong>cloudairy cloudchart</strong></figcaption></figure><p><strong>Step 5 : Deploy Locally using docker-compose</strong></p><h4>Step 1 → setup a Base EC2</h4><ol><li>go to aws console and launch a instance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8UKYNuQvq0mcUW0w.png" /></figure><p>2. Choose ubuntu from the list and create a new key pair →my key and open ports <strong>http and https</strong></p><p>and then click on launch instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JTaKtqqxrUyzY9M9.png" /></figure><p>3. click on EC2 →security →click on security groups→edit the inbound rules to open the following port no.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tog82PFQMJBqJus8UkeX4g.png" /></figure><h3>Step 2 : IAM Role for EC2</h3><p><strong>Why we need IAM role for EC2 →</strong> It is used by your ec2 instance to create EKS cluster and manage s3 bucket by applying this IAM role it gives the authenticity to your ec2 to do changes in aws account</p><h4>1. creating IAM role</h4><ol><li>on the search bar type IAM</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EK4BAkzZHjSwEXll.png" /></figure><p>2. click on Roles on the left side</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*u7xCBprAC0kc5Gvw.png" /></figure><p>3. click on create role and choose EC2 from the dropdown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*5c_fX0GomrXxSMRv.png" /></figure><p>4. click on next</p><p>5. choose <strong>administrator access</strong> on permission sections</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2PTfrxDmT2LVhyX9.png" /></figure><p>6. click on next and give a name to your role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JXtKhbti-c0KrYxJ.png" /></figure><p>7. click on <strong>create role option </strong>and your IAM role is created</p><h4>2. Attach IAM role with your EC2</h4><ol><li>go to EC2 section</li><li>click on actions → security → modify IAM role option</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*oLSBqdpQhHTQNPur.png" /></figure><p>3. choose the role from dropdown and click on update IAM role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*dBlf5Ue-izEjCmLR.png" /></figure><p>Now go back to your EC2 and connect with your EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ntbiMrYh3mGuBRFa.png" /></figure><p>Run the following command</p><pre>sudo su<br>apt update -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKv0dz6FGU45e6zg2-mRtw.png" /></figure><h4>Step 3 →Clone the github Repository</h4><p>On your EC2 Instance clone the github repo for the source code</p><pre>git clone https://github.com/Aakibgithuber/wanderlust-3-tier-project.git<br>ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*IvjwwDkHcJVyt7EBwNN4Ug.png" /></figure><h4>Step 4 → Setup docker and docker compose</h4><p>There is a file called <strong>script.sh run that file using below command to setup docker and docker compose</strong></p><pre>bash script.sh # it will install all the necessary things</pre><h4>Step 5 →Deploy with docker compose</h4><ol><li>you just need to run a single command to up all the containers the frontend , the backend , the database containers and connect all of them</li></ol><pre>docker-compose up -d</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3pqPlYWlfbGZkcKDKZp0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbPduYb7RBhyTUAXKoE9JA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-SJG6hyuhLPUR2g6bmOlg.png" /><figcaption>Here is your 3 container is running</figcaption></figure><p>Copy public ip and paste to your web broswer</p><ol><li>public_ip:5173</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WaklOb9Ut0A3gLYdHgU5kQ.png" /></figure><p>As you see featured section is not accessible to do that we have to run a following commands</p><pre>docker ps #give containers name </pre><p>Copy mongo container name and run</p><pre>docker exec -it &lt;container_name&gt; mongoimport --db wanderlust --collection posts --file ./data/sample_posts.json --jsonArray</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9Z7Eaa3XFBOPQDxSnZYQQ.png" /></figure><p>In output it gives 10 documents imported successfully</p><p>Now again if you hit the url it will give the whole website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSW24uXgfUdqivAcvYJizw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jE4rW7B_ix7wM6VOL6u49Q.png" /><figcaption>Here is your complete website let’s create a post</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wBR8Bk3AJqo5Ba21sTTS_w.png" /><figcaption>Here is your what is devops</figcaption></figure><blockquote>Note: If you getting error in loading backend and in featured post then you need to update the current ip address of your machine in /backend/ .env.sample and in /frontend/.env.sample files</blockquote><h3>Phase 2 : The Pipeline</h3><p><strong>Step 1→ Setup Sonarqube</strong></p><p><strong>Step 2 →Setup jenkins</strong></p><p><strong>Step 3 → Install Plugins</strong></p><p><strong>Step 4 → Setup Credentials</strong></p><p><strong>Step 5 → Setup Tools and configure global setting</strong></p><p><strong>Step 6 → Pipeline script</strong></p><h4>1.Sonarqube →</h4><p>copy the public ip of your machine</p><ol><li><strong>go to your browser and type →&lt;publicip&gt;:9000</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*Sbcg0wZq3kVsAcde5vx54w.png" /></figure><p>sonarqube window open</p><p><strong>2.</strong> iniatially username and password is admin</p><p><strong>3.</strong> update your password</p><p><strong>4. </strong>welcome window of Sonarqube</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6C9xra033aiv88XfzGtsaA.png" /></figure><h3>2. Jenkins →</h3><ol><li><strong>on browser type →&lt;public_ip&gt;:8080 for password</strong></li></ol><p><strong>2.</strong> for this go to your ec2 and connect it</p><p>3. run the below commands</p><pre>sudo su<br>cat /var/lib/jenkins/secrets/initialAdminPassword</pre><p><strong>output is your password and paste it to your jenkins</strong></p><p><strong>4. Install the suggested plugins</strong></p><p><strong>5. Setup your jenkins user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*AcWJ-WMB5xSQGcvH.png" /></figure><p>Welcome to jenkins dashboard</p><h4>Step 3 → Install Plugins listed below</h4><ol><li>Eclipse Temurin Installer (Install without restart)</li><li>SonarQube Scanner (Install without restart)</li><li>docker compose build step</li><li>NodeJs Plugin (Install Without restart)</li><li><strong>owasp →</strong>The OWASP Plugin in Jenkins is like a “security assistant” that helps you find and fix security issues in your software. It uses the knowledge and guidelines from the Open Web Application Security Project (OWASP) to scan your web applications and provide suggestions on how to make them more secure. It’s a tool to ensure that your web applications are protected against common security threats and vulnerabilities.</li><li>Prometheus metrics →to moniter jenkins on grafana dashboard</li><li>Download all the docker realated plugins</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KM0hPjgJG3El9bop.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XKMSoF0BmuNNdnxr.png" /></figure><h4>Step 4 →add credentials of Sonarqube and Docker</h4><p>1st we genrate a token for sonarqube to use in jenkins credentials as secret text</p><h4>a. setup sonarqube credentials</h4><ol><li>go to <a href="http://publicip:9000/">http://publicip:9000</a></li><li>now enter your username and password</li><li>click on security →users →token →generate token</li><li>token_name==jenkins</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_D23eyyo7D_MpFKN.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*aQ8s6p6-2xmHgSHl.png" /></figure><p><strong>4. copy the token and go to your jenkins →manage jenkins →credentials →global →add credentials</strong></p><p><strong>5. select secret text from dropdown</strong></p><p><strong>6. secret text ==your token , id =jenkins →click on create</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wn1jVzpHoACtLzjy.png" /></figure><h3>b. setup projects in sonarqube for jenkins</h3><ol><li>go to your sonarqube server</li><li>click on projects</li><li>in the name field type gpt</li><li>click on set up</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*_iMQ2Oam3JWPnpNC.png" /></figure><p>click on setup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/0*6Pd3h2GTnRpIBMFz.png" /></figure><p>click on above option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/0*qxk_s6fK1Hw-OlOL.png" /></figure><p>click on generate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*o5bjUCoAEN6z0y4I.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iuzvorcR-62jmWv2.png" /></figure><p>click on continue ….</p><p><strong>Sonarqube project for jenkins is setup now</strong></p><p>c. setup sonarqube</p><h4>d. Setup docker credentials</h4><ol><li>go to your jenkins →manage jenkins →credentials →global →add credentials</li><li>provide your username and password of your dockerhub</li><li>id==docker</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*45P5p4ztdeWIyKlG.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*9ffKOR8mjZGLIi4a.png" /></figure><p>credentials for both are setup</p><h4>Step 5 →Now we are going to setup tools for jenkins</h4><p><strong>go to manage jenkins → tools</strong></p><h4>a. add jdk</h4><ol><li>click on add jdk and select installer adoptium.net</li><li>choose jdk 17.0.8.1+1version and in name section enter jdk 17</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fgjHwsV5AviJ6OfD.png" /></figure><h4>b. add node js</h4><ol><li>click on add nodejs</li><li>enter node16 in name section</li><li>choose version nodejs 16.2.0</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wvYlMD8pzHm8P-z-.png" /></figure><h4>c. add docker →</h4><ol><li>click on add docker</li><li>name==docker</li><li>add installer ==download from docker.com</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rLP8T2PN4DpeikHF.png" /></figure><h4>d. add sonarqube →</h4><ol><li>add sonar scanner</li><li>name ==sonar-scanner</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*p61kat5QAu_raMpn.png" /></figure><h4>e. add owasp dependency check →</h4><p>Adding the Dependency-Check plugin in the “Tools” section of Jenkins allows you to perform automated security checks on the dependencies used by your application</p><ol><li>add dependency check</li><li>name == DP-Check</li><li>from add installer select install from github.com</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*nOILkOEf84fxfAHH.png" /></figure><h4>Configure global setting for sonarube and setup webhooks</h4><ol><li><strong>go to manage jenkins →Configure global setting →add sonarqube servers</strong></li><li>n<strong>ame ==sonar-server</strong></li><li><strong>server_url==http://public_ip:9000</strong></li><li><strong>server authentication token == jenkins →it is created in sonarqube security configurations</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*b5-fpEspLL6tOxw2.png" /></figure><h3>5. let’s run the Pipeline →</h3><ol><li><strong>go to new item →select pipeline</strong> →in the name section type <strong>gpt-pipeline</strong></li><li>scroll down to the <strong>pipeline script </strong>and copy paste the following code</li></ol><pre>pipeline{<br>    agent any<br>    tools{<br>        jdk &#39;jdk17&#39;<br>        nodejs &#39;node16&#39;<br>    }<br>    environment {<br>        SCANNER_HOME=tool &#39;sonar-scanner&#39;<br>    }<br>    stages {<br>        stage(&#39;Checkout from Git&#39;){<br>            steps{<br>                git branch: &#39;main&#39;, url: &#39;https://github.com/Aakibgithuber/wanderlust-3-tier-project.git&#39;<br>            }<br>        }<br>        stage(&#39;Install Dependencies&#39;) {<br>            steps {<br>                sh &quot;npm install&quot;<br>            }<br>        }<br>        stage(&quot;Sonarqube Analysis &quot;){<br>            steps{<br>                withSonarQubeEnv(&#39;sonar-server&#39;) {<br>                    sh &#39;&#39;&#39; $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=docker-compose \<br>                    -Dsonar.projectKey=docker-compose &#39;&#39;&#39;<br>                }<br>            }<br>        }<br>        stage(&quot;quality gate&quot;){<br>           steps {<br>                script {<br>                    waitForQualityGate abortPipeline: false, credentialsId: &#39;Sonar-token&#39;<br>                }<br>            }<br>        }<br>        stage(&#39;OWASP FS SCAN&#39;) {<br>            steps {<br>                dependencyCheck additionalArguments: &#39;--scan ./ --disableYarnAudit --disableNodeAudit&#39;, odcInstallation: &#39;DP-Check&#39;<br>                dependencyCheckPublisher pattern: &#39;**/dependency-check-report.xml&#39;<br>            }<br>        }<br>        stage(&#39;TRIVY FS SCAN&#39;) {<br>            steps {<br>                sh &quot;trivy fs . &gt; trivyfs.json&quot;<br>            }<br>        }<br>          // Docker Compose Build Stage with Timeout<br>        stage(&#39;Docker-compose Build&#39;) {<br>            steps {<br>                script {<br>                    timeout(time: 1, unit: &#39;MINUTES&#39;) { // Timeout set to 1 minute<br>                        sh &#39;docker-compose up -d&#39;<br>                    }<br>                }<br>            }<br>        }<br><br>        stage(&#39;Docker-compose Push&#39;) {<br>            steps {<br>                script {<br>                    withDockerRegistry(credentialsId: &#39;docker&#39;, toolName: &#39;docker&#39;) {<br>                        // Tag and push backend and frontend images<br>                        sh &quot;docker tag devpipeline-backend aakibkhan1212/devpipeline-backend:latest&quot;<br>                        sh &quot;docker tag devpipeline-frontend aakibkhan1212/devpipeline-frontend:latest&quot;<br>                        <br>                        sh &quot;docker push aakibkhan1212/devpipeline-backend:latest&quot;<br>                        sh &quot;docker push aakibkhan1212/devpipeline-frontend:latest&quot;<br>                    }<br>                }<br>            }<br>        }<br>        stage(&quot;TRIVY&quot;){<br>            steps{<br>                sh &quot;trivy image aakibkhan1212/devpipeline-backend &gt; trivy.json&quot;<br>                sh &quot;trivy image aakibkhan1212/devpipeline-frontend &gt; trivy.json&quot;<br>            }<br>        }<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0nd5Wt0y4sbzFzGFOriTg.gif" /><figcaption>Designed with <strong>cloudairy cloudchrt</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFRYcWdNWgjgaan9vzrPqw.png" /><figcaption>Here is a success message for the pipeline</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7WGFL7FmGd-0vnxr.png" /></figure><h4>your application is successfully deployed checkout the dockerhub and to acess your application go to your browser and type</h4><p>“public_ip:5173”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jE4rW7B_ix7wM6VOL6u49Q.png" /><figcaption>Here is your website deployed by jenkins pipeline</figcaption></figure><h4>Phase 3 : Setup Multiple Pipeline for Quality Assuarance and for Production</h4><blockquote>Why we need to Deploy it Multiple Times</blockquote><p>We deploy the application in three different stages — Development, Quality Assurance (QA), and Production — to ensure the application works correctly at every step and to minimize the chances of errors in the final product. Here’s why each stage is important:</p><h4>1. Development (Dev)</h4><p>In the <strong>Development</strong> stage, the application is tested by developers. This is where new features are added, bugs are fixed, and code changes are made. It’s like a “testing ground” where developers can try out new things without worrying about breaking anything important.</p><ul><li><strong>Purpose</strong>: To develop and test new features in a safe environment.</li><li><strong>Why it’s needed</strong>: It helps catch issues early before the code moves to the next stage.</li></ul><h4>2. Quality Assurance (QA)</h4><p>In the <strong>QA</strong> stage, testers check if everything works as expected. They test the application in a controlled environment, trying to find bugs, issues, or performance problems. This stage simulates a real-world scenario but is still separate from the actual users.</p><ul><li><strong>Purpose</strong>: To test the stability, performance, and functionality of the application.</li><li><strong>Why it’s needed</strong>: It helps ensure the application is ready for users by catching any issues that were missed in the development stage.</li></ul><h4>3. Production (Prod)</h4><p>The <strong>Production</strong> stage is where the application goes live for actual users. This is the final environment where the real customers or users interact with the application. It’s crucial that only well-tested, stable code reaches this stage, so users don’t experience issues.</p><ul><li><strong>Purpose</strong>: To serve the final, stable version of the application to users.</li><li><strong>Why it’s needed</strong>: This ensures that only high-quality, reliable code is deployed, providing a smooth experience for users.</li></ul><h4><strong>Pipeline for Development</strong></h4><p>In the <strong>Development pipeline</strong>, the goal is to test new features or bug fixes in a safe environment where developers can make changes without impacting the live application. It’s all about fast feedback to help developers iterate quickly.</p><p><strong>Steps:</strong></p><ul><li><strong>Checkout Code:</strong> Pull the latest code from the repository so developers have the most up-to-date version.</li><li><strong>Build Docker Images:</strong> Create Docker images for each service (frontend, backend, and database) to package the application in a standardized way.</li><li><strong>Run Unit Tests:</strong> These tests focus on checking small, individual parts of the application (like functions or modules) to make sure they work as expected.</li><li><strong>Push Docker Images (Optional):</strong> You can choose to push the images to a Docker registry, but it’s optional at this stage since the images are usually local.</li><li><strong>Deploy to Development:</strong> The application is deployed in the Development environment where developers can interact with it to see if their changes worked.</li><li><strong>Basic Integration Tests:</strong> Optionally, run tests to ensure different parts of the application (like frontend and backend) work together correctly.</li><li><strong>Trigger the QA Pipeline:</strong> Once the development work is complete and basic tests pass, the pipeline automatically triggers the QA process for further testing.</li></ul><pre>pipeline {<br>    agent any<br><br>    stages {<br>        stage(&#39;Checkout Code&#39;) {<br>            steps {<br>                git &#39;https://github.com/Aakibgithuber/docker-compose-project.git&#39;<br>            }<br>        }<br><br>        stage(&#39;Build Docker Images&#39;) {<br>            steps {<br>                sh &#39;docker-compose build&#39;<br>            }<br>        }<br><br>        stage(&#39;Run Unit Tests&#39;) {<br>            steps {<br>                sh &#39;docker-compose run backend pytest&#39;<br>            }<br>        }<br><br>        stage(&#39;Deploy to Development&#39;) {<br>            steps {<br>                sh &#39;docker-compose up -d&#39;<br>            }<br>        }<br>    }<br><br>    post {<br>        success {<br>            echo &quot;Development deployment successful, triggering QA pipeline in 10 seconds...&quot;<br>            sleep 10<br>            build job: &#39;QA_Pipeline&#39;<br>        }<br>        failure {<br>            echo &quot;Development deployment failed.&quot;<br>        }<br>    }<br>}</pre><h4><strong>2. Pipeline for Quality Assurance</strong></h4><p>In the <strong>QA pipeline</strong>, the focus shifts from development to testing the entire application thoroughly. QA teams simulate real-world conditions to ensure the application works as expected for users. The QA environment is closer to what the production environment will be, so this is where more advanced tests are run.</p><p><strong>Steps:</strong></p><ul><li><strong>Pull Docker Images:</strong> The pipeline pulls the Docker images that were built and tested in the Development pipeline, ensuring that the exact same version of the application is being tested in QA.</li><li><strong>Deploy to QA:</strong> The application is deployed in the QA environment so that testers can interact with it and run their tests.</li><li><strong>Run Functional Tests:</strong> These tests check that the application functions correctly from a user’s perspective. They make sure all features work as expected.</li><li><strong>Run End-to-End Tests:</strong> These tests simulate real user scenarios, verifying that all parts of the application (frontend, backend, and database) work seamlessly together.</li><li><strong>Run Performance Tests:</strong> Performance or load testing checks how well the application handles heavy traffic and stress. This ensures the application can scale and perform well under real-world conditions.</li><li><strong>Manual QA Approval:</strong> Once the QA team is satisfied with the tests, there’s a manual approval step to ensure human oversight before the application moves to production.</li><li><strong>Trigger the Production Pipeline:</strong> If all tests pass and QA approves, the pipeline automatically triggers the Production deployment process</li></ul><pre>pipeline {<br>    agent any<br><br>    stages {<br>        stage(&#39;Pull Docker Images&#39;) {<br>            steps {<br>                sh &#39;docker-compose pull&#39;<br>            }<br>        }<br><br>        stage(&#39;Deploy to QA&#39;) {<br>            steps {<br>                sh &#39;docker-compose up -d&#39;<br>            }<br>        }<br><br>        stage(&#39;Run Functional Tests&#39;) {<br>            steps {<br>                sh &#39;docker-compose run frontend npm run test&#39;<br>            }<br>        }<br><br>        stage(&#39;Run End-to-End Tests&#39;) {<br>            steps {<br>                sh &#39;docker-compose run backend behave tests/&#39;<br>            }<br>        }<br><br>        stage(&#39;Run Performance Tests&#39;) {<br>            steps {<br>                sh &#39;docker-compose run backend stress --cpu 8 --timeout 10&#39;<br>            }<br>        }<br>    }<br><br>    post {<br>        success {<br>            echo &quot;QA testing successful, triggering Production pipeline in 10 seconds...&quot;<br>            sleep 10<br>            build job: &#39;Production_Pipeline&#39;<br>        }<br>        failure {<br>            echo &quot;QA testing failed.&quot;<br>        }<br>    }<br>}</pre><h4>3. Pipeline for Production</h4><p>The <strong>Production pipeline</strong> is where the final version of the application is deployed for real users. This environment must be stable and reliable, so the pipeline focuses on smooth deployment and post-deployment checks to ensure everything runs as expected.</p><p><strong>Steps:</strong></p><ul><li><strong>Pull Docker Images:</strong> The Production pipeline pulls the same Docker images that were built and tested in Development and QA, ensuring consistency.</li><li><strong>Approval Step:</strong> A manual approval step is typically included here to ensure that nothing is deployed to production without explicit authorization. This step adds an extra layer of protection.</li><li><strong>Deploy to Production:</strong> The final version of the application is deployed to the production environment, where real users will interact with it.</li><li><strong>Post-Deployment Smoke Tests:</strong> After the deployment, simple smoke tests are run to verify that the application is up and running correctly. This ensures that the deployment didn’t break anything critical.</li><li><strong>Monitoring &amp; Alerts:</strong> In production, it’s important to have monitoring systems and alerts set up to keep track of the application’s performance and notify the team if anything goes wrong.</li><li><strong>Notify Team:</strong> Once the production deployment is successful, notifications (via Slack, email, etc.) are sent to the team, confirming that the application is live and stable</li></ul><pre>pipeline {<br>    agent any<br><br>    stages {<br>        stage(&#39;Pull Docker Images&#39;) {<br>            steps {<br>                sh &#39;docker-compose pull&#39;<br>            }<br>        }<br><br>        stage(&#39;Manual Approval&#39;) {<br>            steps {<br>                input message: &#39;Approve deployment to production?&#39;<br>            }<br>        }<br><br>        stage(&#39;Deploy to Production&#39;) {<br>            steps {<br>                sh &#39;docker-compose up -d&#39;<br>            }<br>        }<br><br>        stage(&#39;Run Smoke Tests&#39;) {<br>            steps {<br>                sh &#39;curl http://your-production-url&#39;<br>            }<br>        }<br><br>        stage(&#39;Post-Deployment Notifications&#39;) {<br>            steps {<br>                echo &quot;Deployment to production was successful!&quot;<br>                // Here you can add additional steps for notifications like Slack or email<br>            }<br>        }<br>    }<br><br>    post {<br>        success {<br>            echo &quot;Production deployment successful.&quot;<br>        }<br>        failure {<br>            echo &quot;Production deployment failed.&quot;<br>        }<br>    }<br>}</pre><p><strong>Here we completed Our blog if you like it do clap , follow and share the blog</strong></p><p><a href="http://github.com/aakibgithuber">Follow me on github</a></p><p><a href="https://www.linkedin.com/in/aakib-khan-29b7aa252/">Follow me on Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a5f6fc3f274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project 13 →Deployment of Youtube Clone on Kubernetes cluster with Slack integration]]></title>
            <link>https://aakibkhan1.medium.com/deployment-of-youtube-clone-on-kubernetes-cluster-with-slack-integration-bfe621d89b42?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfe621d89b42</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Tue, 03 Sep 2024 04:34:50 GMT</pubDate>
            <atom:updated>2024-09-16T05:18:09.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*167JTilkOdoASlC5MdTkXA.gif" /></figure><p>The above animation Diagram is designed with <a href="https://cloudairy.com/"><strong>Cloudairy Cloudchart </strong></a>that is powerful architectural design tool</p><p>It provides you the innovative features to enhance your design process such as</p><ol><li>✅𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈 𝐌𝐚𝐠𝐢𝐜: Bring your ideas to life with our AI-powered flowchart generator.</li><li>✅𝐒𝐡𝐚𝐩𝐞 𝐘𝐨𝐮𝐫 𝐖𝐨𝐫𝐥𝐝: Choose from an extensive library of BPMN, dataflow, enterprise, flowchart, and geometric shapes.</li><li>✅𝐕𝐢𝐬𝐮𝐚𝐥𝐢𝐳𝐞 𝐢𝐧 𝟑𝐃: Bring your cloud infrastructure to life with our 3D icons for AWS, Azure, GCP, and Kubernetes.</li><li>✅𝐄𝐧𝐫𝐢𝐜𝐡 𝐘𝐨𝐮𝐫 𝐃𝐞𝐬𝐢𝐠𝐧𝐬: Search and import images, icons, and GIFs directly into your diagrams.</li><li>✅200+Templates: Accelerate your design with 200+ pre-built cloud architecture templates.</li></ol><p><a href="https://cloudairy.com/"><strong>Cloudairy Cloudchart</strong> </a>link →<a href="https://cloudairy.com/">https://cloudairy.com</a></p><p>Today we are going to deploy youtube clone . In this project we also integrate slack notification for jenkins . This is one of the resume ready project with each and every steps Do follow the project guys</p><h3>Completion steps →</h3><p>Step 1: Set a base EC2 on AWS</p><p>Step 2 : IAM Role for EC2</p><p>Step 3 : Configure EC2</p><p>Step 4 : Setup jenkins pipeline</p><p>Step 5 : ci-cd pipeline to build and push the image to docker hub</p><p>Step 6 : Integrate Slack notification for pipeline</p><p>Step 7 : Kuberntes Cluster creation using terraform</p><p>Step 8→ Creation of deployment for EKS</p><p>Step 9→ Destroy all the Insrastructure</p><h3>Step 1 : Set a base EC2 on AWS</h3><ol><li>go to aws console and launch a instance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tafrh22QpMB4PV8gGQ4L9Q.png" /></figure><p>2. Choose ubuntu from the list and create a new key pair →my key and open ports <strong>http and https</strong></p><p>and then click on launch instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmI7yIKTcvchC3rJR6pDgw.png" /></figure><h3>Step 2 : IAM Role for EC2</h3><p><strong>Why we need IAM role for EC2 →</strong> It is used by your ec2 instance to create EKS cluster and manage s3 bucket by applying this IAM role it gives the authenticity to your ec2 to do changes in aws account</p><h3>1. creating IAM role</h3><ol><li>on the search bar type IAM</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Tq-Vnp-otD4TwLht.png" /></figure><p>2. click on Roles on the left side</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*NLJEpWCmXDHoSjPe.png" /></figure><p>3. click on create role and choose EC2 from the dropdown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*7LdcIVlbNNIXdNPt.png" /></figure><p>4. click on next</p><p>5. choose <strong>administrator access</strong> on permission sections</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*B3r9yqG_urM_Zcb_.png" /></figure><p>6. click on next and give a name to your role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FwNLTLUW6emcrqcQEJS_iQ.png" /></figure><p>7. click on <strong>create role option </strong>and your IAM role is created</p><h3>2. Attach IAM role with your EC2</h3><ol><li>go to EC2 section</li><li>click on actions → security → modify IAM role option</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8fcymORexxKTKZ_s.png" /></figure><p>3. choose the role from dropdown and click on update IAM role</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*HR_jUen8HpmT2sQmLgdfOw.png" /></figure><h3>why we need IAM Role →</h3><p>Imagine you have a robot (EC2 instance) that does tasks for you in a big factory (AWS environment). Now, this robot needs to access different rooms (AWS services like S3, DynamoDB, etc.) to perform its tasks.</p><p>Here’s where IAM (Identity and Access Management) comes in:</p><ol><li><strong>Robot Needs a Key to Enter Rooms:</strong> The IAM Role is like giving your robot a special key. This key allows the robot to enter specific rooms (access certain AWS services). Without this key, the robot can’t get in.</li><li><strong>Different Keys for Different Robots: </strong>Each robot (EC2 instance) can have its own key (IAM Role) with specific permissions. So, one robot may have a key to enter the storage room (access S3), while another robot has a key to enter the database room (access DynamoDB).</li><li><strong>No Need for Hardcoding Passwords: </strong>Using IAM Roles means you don’t have to hardcode passwords (access credentials) into the robot. It’s like not writing down passwords on the robot itself. The robot just uses its key when needed.</li><li><strong>Easily Change Permissions:</strong> If you want to change what a robot can do, you just change the permissions on its key (IAM Role). No need to reprogram the robot or give it a new password; just update the permissions on its key.</li><li><strong>Secure and Controlled Access: </strong>IAM Roles help keep things secure. You can control exactly what each robot is allowed to do. This way, if one robot is compromised or needs a different role, you can easily adjust its permissions without affecting others.</li></ol><p>Now go back to your EC2 and connect with your EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cT7W8hjQN6YHyUG90ap4EA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1twS1CI9z2bnOulij_OiA.png" /></figure><h3>Step 3 : Configure EC2</h3><p>you have to install git , docker , jenkins , kubectl etc for docker container and kubernetes deployment</p><ol><li>run the following commands</li></ol><pre>apt update <br>vim run.sh</pre><p>2. Enter the following commands to your .sh file</p><pre>#!/bin/bash<br>sudo apt update -y<br>wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc<br>echo &quot;deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= &#39;/^VERSION_CODENAME/{print$2}&#39; /etc/os-release) main&quot; | tee /etc/apt/sources.list.d/adoptium.list<br>sudo apt update -y<br>sudo apt install temurin-17-jdk -y<br>/usr/bin/java --version<br><br>#install jenkins<br>curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc &gt; /dev/null<br>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<br>sudo apt-get update -y<br>sudo apt-get install jenkins -y<br>sudo systemctl start jenkins<br>sudo systemctl status jenkins<br><br>#install docker<br>sudo apt-get update<br>sudo apt-get install docker.io -y<br>sudo usermod -aG docker ubuntu<br>sudo usermod -aG docker jenkins<br>newgrp docker<br>sudo chmod 777 /var/run/docker.sock<br>sudo systemctl restart jenkins<br><br># install trivy<br>sudo apt-get install wget apt-transport-https gnupg lsb-release -y<br>wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg &gt; /dev/null<br>echo &quot;deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main&quot; | sudo tee -a /etc/apt/sources.list.d/trivy.list<br>sudo apt-get update<br>sudo apt-get install trivy -y<br><br><br># Install Terraform<br>sudo apt install wget -y<br>wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | sudo tee /etc/apt/sources.list.d/hashicorp.list<br>sudo apt update &amp;&amp; sudo apt install terraform<br><br># Install kubectl<br>sudo apt update<br>sudo apt install curl -y<br>curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl<br>sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl<br>kubectl version --client</pre><p>3. run the .sh file by command bash run.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*me6dd1rI-TS7KiNh9MOxsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_DkmzO7VDmAdY6SYaIxwjw.png" /></figure><h3>Step 4 : Setup jenkins pipeline</h3><p>From the above step everything is installed all we need to setup jenkins ci-cd pipeline</p><ol><li>copy the public ip of your ec2 and paste it <strong>on browser type →&lt;public_ip&gt;:8080</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Q-8oGnNZSNE6ZNFj.png" /></figure><p><strong>2.</strong> for this go to your ec2 and connect it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*-Cm3rildxtUnPlvo.png" /></figure><p>3. run the below commands</p><pre>sudo su<br>cat /var/lib/jenkins/secrets/initialAdminPassword</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*l3V4Bg0j7_sCm4Im.png" /></figure><p><strong>output is your password and paste it to your jenkins</strong></p><p><strong>4. Install the suggested plugins</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VnFBpQk7FhEn4sOj.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JVPAJwaTFJs3fiMC.png" /></figure><p><strong>5. Setup your jenkins user</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*55qYV8XXoyKzXWQU.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*lWAn5dvedpbXuoIE.png" /></figure><p>Welcome to jenkins dashboard</p><h3>Step 5 : ci-cd pipeline to build and push the image to docker hub</h3><h3>1. Install Plugins listed below</h3><ol><li>Terrform</li><li>slack notification</li><li>Global Slack Notifier</li><li>Eclipse Temurin Installer (Install without restart)</li><li>NodeJs Plugin (Install Without restart)</li><li>Parameterized Trigger (to trigger another pipeline if one completed)</li><li>Download all the docker realated plugins</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*AV3tGku84fxMhf77.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JOQ_ntF2cdErhNpt.png" /></figure><p><strong>Note → if jenkins is not running on the given website then go to your ec2 security groups and open the 8080 port no.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-uDxafALA0oGJ6TPmb_4g.png" /><figcaption>also open port 3000 for the docker container</figcaption></figure><h3>A. Setup docker credentials</h3><ol><li>go to your jenkins →manage jenkins →credentials →global →add credentials</li><li>provide your username and password of your dockerhub</li><li>id==docker</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zwpGbS1ReAKhRpDZ.png" /></figure><h3>B. Setup tools for jenkins</h3><p><strong>go to manage jenkins → tools</strong></p><h3>a. add jdk</h3><ol><li>click on add jdk and select installer adoptium.net</li><li>choose jdk 17.0.8.1+1version and in name section enter jdk 17</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*aFZbYrUMc34KvVgn.png" /></figure><h3>b. add node js</h3><ol><li>click on add nodejs</li><li>enter node16 in name section</li><li>choose version nodejs 16.2.0</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*0AU_Wmy8MgBRPonH.png" /></figure><h3>c. add docker →</h3><ol><li>click on add docker</li><li>name==docker</li><li>add installer ==download from docker.com</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*LxMUsr3dqUZuk4lY.png" /></figure><h3>d. terraform</h3><ol><li>go to manage jenkins →tools →search for terraform</li><li>add terraform</li><li>provide the name in the name field and untick the install automatically option and give the path <strong>/usr/bin/</strong></li><li>As terraform is installed in this section it takes it from there</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*CztKx52CggFnWoKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*RP_KcSynV5ZGY0mP.png" /></figure><p><strong>5. click on apply and save</strong></p><h3>C. The Pipeline Script</h3><ol><li><strong>go to new item →select pipeline</strong> →in the name section type Youtube Pipeline 1</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h3gBzRZIodl1CsQIw3r9Og.png" /></figure><p>2. scroll down to the pipeline script and copy paste the following code</p><pre>pipeline{<br>    agent any<br>    tools{<br>        jdk &#39;jdk17&#39;<br>        nodejs &#39;node16&#39;<br>    }<br>    stages {<br>        stage(&#39;clean workspace&#39;){<br>            steps{<br>                cleanWs()<br>            }<br>        }<br>        stage(&#39;Checkout from Git&#39;){<br>            steps{<br>                git branch: &#39;main&#39;, url: &#39;https://github.com/Aakibgithuber/deployment-of-youtube.git&#39;<br>            }<br>        }<br>        stage(&#39;Install Dependencies&#39;) {<br>            steps {<br>                sh &quot;npm install&quot;<br>            }<br>        }<br>        stage(&quot;Docker Build &amp; Push&quot;){<br>            steps{<br>                script{<br>                   withDockerRegistry(credentialsId: &#39;docker&#39;, toolName: &#39;docker&#39;){   <br>                       sh &quot;docker build -t youtube-clone .&quot;<br>                       sh &quot;docker tag youtube-clone aakibkhan1212/youtube-clone:latest &quot;<br>                       sh &quot;docker push aakibkhan1212/youtube-clone:latest &quot;<br>                       sh &quot;docker &quot;<br>                    }<br>                }<br>            }<br>        }<br>        stage(&#39;Deploy to container&#39;){<br>            steps{<br>                sh &#39;docker run -d --name youtube-clone -p 3000:3000 aakibkhan1212/youtube-clone:latest&#39;<br>            }<br>        }<br>    }<br>}</pre><p><strong>If you want to add owasp and sonarqube then you could make changes by following the previous project blog</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*655a9AODmWz_Nps9VNqXxQ.png" /><figcaption>click on build</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRT1InnchwCMP3r7hQr4DQ.png" /></figure><h4>your application is successfully deployed checkout the dockerhub and to acess your application go to your browser and type</h4><p><a href="http://52.66.70.247:3000/"><strong>http://your_public_ip:3000</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5zoCSvqQv2mUf_ltwIMyOQ.png" /></figure><p><strong>Here is your application</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4KiVyHQlnGRRqCnOdKyXQ.png" /><figcaption><strong>Image from dockerhub that is pushed by jenkins pipeline</strong></figcaption></figure><h3>Step 6 : Integrate Slack notification for pipeline</h3><ol><li>go to slack.com and make a account</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*KhYHr-Ypa2ZKfjuYN8DBAA.png" /></figure><p>2. choose any of the option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*QKND0NgG5tcLHOEO44A8TA.png" /></figure><p>3. Create a Workspace</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*tNn-2MqUijzd4oUOYRDE5w.png" /></figure><p>4. click on next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-1QX83XYQRnlFs64UNOMUw.png" /><figcaption>Welcome window of slack</figcaption></figure><p>5. Create a new channel</p><p>6. Now you have to browse Slack app directory and search for jenkins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zWCaGkZEQuAukE-CUt0Ag.png" /></figure><p>7. click on add to slack and choose a channel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ee6KwkfPE968q7OoPXbGlQ.png" /><figcaption>click on add jenkins CI Integration</figcaption></figure><p>8. It will generate token for the jenkins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLAqbmopVCBaIho0k0LTzw.png" /></figure><p>9. Now you have to go to Jenkins →manage jenkins →global and scroll down to Slack Notifications</p><p>10. On credentials add the token in the secret text dropdown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0wJTbdzRLezimk5cbe-lw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfG0Bdfo1T09Tc4PxEg-3g.png" /></figure><p>11. Click on Test Connection and you will see Success blink on</p><p>12. Now again go to your youtube Pipeline and click on configure then add the following code to the pipeline script</p><pre>pipeline {<br>    agent any<br>    tools {<br>        jdk &#39;jdk17&#39;<br>        nodejs &#39;node16&#39;<br>    }<br>    stages {<br>        stage(&#39;Clean Workspace&#39;) {<br>            steps {<br>                cleanWs()<br>            }<br>        }<br>        stage(&#39;Checkout from Git&#39;) {<br>            steps {<br>                git branch: &#39;main&#39;, url: &#39;https://github.com/Aakibgithuber/deployment-of-youtube.git&#39;<br>            }<br>        }<br>        stage(&#39;Install Dependencies&#39;) {<br>            steps {<br>                sh &quot;npm install&quot;<br>            }<br>        }<br>        stage(&#39;Docker Build &amp; Push&#39;) {<br>            steps {<br>                script {<br>                    withDockerRegistry(credentialsId: &#39;docker&#39;, toolName: &#39;docker&#39;) {<br>                        sh &quot;docker build -t youtube-clone .&quot;<br>                        sh &quot;docker tag youtube-clone aakibkhan1212/youtube-clone:latest&quot;<br>                        sh &quot;docker push aakibkhan1212/youtube-clone:latest&quot;<br>                    }<br>                }<br>            }<br>        }<br>        stage(&#39;Deploy to Container&#39;) {<br>            steps {<br>                sh &#39;docker run -d --name youtube-clone -p 3000:3000 aakibkhan1212/youtube-clone:latest&#39;<br>            }<br>        }<br>    }<br>    post {<br>        success {<br>            slackSend(channel: &#39;#all-the-cloud-hub&#39;, color: &#39;good&#39;, message: &quot;Job &#39;${env.JOB_NAME} [${env.BUILD_NUMBER}]&#39; (${env.BUILD_URL}) was successful.&quot;)<br>        }<br>        failure {<br>            slackSend(channel: &#39;#all-the-cloud-hub&#39;, color: &#39;danger&#39;, message: &quot;Job &#39;${env.JOB_NAME} [${env.BUILD_NUMBER}]&#39; (${env.BUILD_URL}) failed.&quot;)<br>        }<br>        always {<br>            echo &#39;Build finished, check Slack for notifications.&#39;<br>        }<br>    }<br>}</pre><p>13. Now again build the Pipeline and check for the slack notifications</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*-M4FJEj8pKq-LcYbROXTqw.png" /></figure><p>14. It shows success on slack for the pipeline that we created on jenkins</p><h3>Step 7 : Kuberntes Cluster creation using terraform</h3><ol><li>clone the github repo by →</li></ol><p>a. mkdir super_mario</p><p>b. cd super_mario</p><p><strong>c. git clone </strong><a href="https://github.com/Aakibgithuber/deployment-of-youtube.git">https://github.com/Aakibgithuber/deployment-of-youtube.git</a></p><p>d. cd deployment-of-youtube/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*AFToLu8vYZdLYGwdZBsVWw.png" /></figure><p><strong>e. cd EKS-TF</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*bx4uP_BRnUyHbibc.png" /></figure><p>f. edit the backend.tf file by → <strong>vim backend.tf</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*H0vAj9XRHbrMS1yX.png" /></figure><p><strong>Note →make sure to provide your bucket and region name in this file otherwise it doesn’t work and IAM role is also associated with your ec2 which helps ec2 to use other services such S3 bucket</strong></p><p><strong>NOW RUN →</strong></p><ol><li><strong>terraform init</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*a3ZdE7pp8Gm5BgWD.png" /></figure><p>When we run terraform init, it sets up your working area, downloads necessary plugins, and makes sure everything is in place so that you can start using Terraform to create, update, or manage your infrastructure. It’s like getting all the tools and materials ready before you start building something amazing with your computer.</p><p><strong>2. terraform validate</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*h9FxsKn4lwOKxo4Q.png" /></figure><p>Terraform validate reviews our code to catch any syntax errors or mistake and gives an output <strong>success </strong>if everything is no error in the file</p><p><strong>3. terraform plan</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*UWDCCZitXUws3leg.png" /></figure><p><strong>Terraform plan</strong> is used to see what changes will be made to your infrastructure. By using this command we could review and confirm that everything looks good before giving the final approval to build or modify our application infrasructure It is like the blueprint of the construction project before actually creating or changing anything with Terraform</p><p><strong>4. terraform apply</strong></p><pre>terraform apply --auto-approve</pre><p>Running terraform apply --auto-approve is like telling computer, &quot;Go ahead and build everything exactly as planned without asking me for confirmation each time.&quot; It&#39;s a way to automate the deployment of your infrastructure without needing our constant input. When we execute this command, Terraform reads our code, figures out what needs to be created or changed, and then goes ahead with the construction, skipping the usual step where it checks with you for approval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iv7gTMkFDt3zXxjv.png" /></figure><p><strong>It takes your 5 to 10 min for completion</strong></p><p>5. Below command is used to update the configuration of EKS</p><pre>aws eks update-kubeconfig --name EKS_CLOUD --region us-east-1</pre><p>The command aws eks update-kubeconfig --name EKS_CLOUD --region us-east-1 is like telling our computer, &quot;Hey, I&#39;m using Amazon EKS (Elastic Kubernetes Service) in the &#39;us-east-1&#39; region, and I want to connect to it. you could use your desired location</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zffMbtaSM5RFKMXK.png" /></figure><h3>Step 8→ Creation of deployment for EKS</h3><ol><li>change the directory where deployment and service files are stored use the command → <strong>cd ..</strong></li><li>create the deployment</li></ol><pre>kubectl apply -f deployment.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*I5Q_8tCOlQ2jPH0U6aNFFg.png" /></figure><p>deployment.yaml file is like a set of instructions that tells a computer system, &quot;Hey, here&#39;s how you should run and manage a particular application &quot; . It provides the necessary information for a computer system to deploy and manage a specific software application. It includes details like what the application is, how many copies of it should run, and other settings that help the system understand how to keep the application up and running smoothly.</p><p>3. Service file is included in the deployment file</p><p>service.yaml file is like a set of rules that helps computers find and talk to each other within a software application. It&#39;s like a directory that says, &quot;Hey, this is how you can reach different parts of our application.&quot; It specifies how different parts of your application communicate and how other services or users can connect to them.</p><p>4. run → kubectl get all</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*9RzuB-7EcG6Rs1I6.png" /></figure><p>copy the load balancer ingress and paste it on browser and your application is running there</p><p><strong>don’t forget to destory everything that’s saves of aws bill and you aws account too</strong></p><h3>Load Balancer Ingress →</h3><p>It is a mechanism that helps distribute incoming internet traffic among multiple servers or services, ensuring efficient and reliable delivery of requests.</p><p>It’s like having a receptionist at a busy office building entrance who guides visitors to different floors or departments, preventing overcrowding at any one location. In the digital world, a Load Balancer Ingress helps maintain a smooth user experience, improves application performance, and ensures that no single server becomes overwhelmed with too much traffic.</p><h3>Step 9→ Destroy all the Insrastructure</h3><p>1 . Below commands delete or destroy your cluster</p><pre>cd EKS-TF<br>terraform destroy --auto-approve</pre><p><strong>after 3 -5 mins all things are destroyed</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*PHcVCfj5em-1rMpP.png" /></figure><p>3. Now go to your EC2 and terminate your Instance</p><p>Here we completed another project don’t forget to create a good animation diagram for this project using <a href="https://cloudairy.com/"><strong>cloudairy cloudchart</strong></a></p><p><strong>Cloudairy cloudchart website link →</strong><a href="https://cloudairy.com/"><strong>https://cloudairy.com</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfe621d89b42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Good Software Architecture Diagrams]]></title>
            <link>https://aakibkhan1.medium.com/how-to-create-good-software-architecture-diagrams-06bc900dcb96?source=rss-21bf1599fd67------2</link>
            <guid isPermaLink="false">https://medium.com/p/06bc900dcb96</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Aakib]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 08:32:44 GMT</pubDate>
            <atom:updated>2024-08-30T11:46:25.500Z</atom:updated>
            <content:encoded><![CDATA[<p>Software architecture diagrams are important tools for anyone involved in building software. They help us understand how different parts of a system work together. But sometimes, these diagrams can be confusing or too complicated, making it hard to get the main point.</p><p>Over the years, I’ve seen a lot of different architecture diagrams. Some were very detailed, while others were more basic. However, many of them had a problem — they didn’t clearly show what was most important about the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*CLScYcUh-anmqDtC.png" /></figure><h3>Common Problems with Software Diagrams</h3><p>When I first started working in software development, I was exposed to a wide range of architecture diagrams. Some were overly complex, while others were too simplistic. Many diagrams suffered from common problems that made them difficult to understand. For example:</p><ol><li><strong>Mixing Levels of Detail</strong>:One big issue is when a diagram tries to show too much at once. For example, a diagram might start by showing the overall system but then suddenly dive into the small details. This can be confusing because it mixes different levels of detail. It’s important to keep things consistent so the diagram is easy to follow.</li><li><strong>Inconsistent Use of Colors and Sizes</strong>:Another problem is using too many colors or sizes to represent different things. While colors can help highlight important parts, they can also make the diagram harder to read if not used carefully. Similarly, using different sizes for boxes or elements to show importance can be misleading, especially as the system changes over time.</li><li><strong>Overly Complex Diagrams</strong>:Some diagrams try to include every possible detail about the system, making them overwhelming to look at. When a diagram is too complex, it becomes difficult to extract the most important information. Instead of clarifying the architecture, it can actually make it harder to understand.</li></ol><p>I’ve made these mistakes too. I’ve used various tools like Whiteboard, MS Paint, Photoshop, draw.io , canva to create diagrams. No matter which tool you use, it’s easy to get caught up in making things look perfect instead of focusing on what really matters — clearly communicating the system’s structure.</p><h3>Finding a Better Way</h3><p>So, after making these mistakes , I found a better way to create clear and useful software architecture diagrams. This better way is called the <strong>C4 model.</strong></p><p>while using the C4 model approach you also need a right tool for your architecture diagrams one of the best tool for creating these diagrams is <a href="https://cloudairy.com/cloudchart"><strong>cloudairy cloudchart</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RatjSd4J9hXMIXH6m4LBeA.png" /><figcaption>visit → chart.cloudairy.com/signup</figcaption></figure><h3>Using Cloudairy Cloudchart for Diagrams</h3><p>While the C4 model helps organize your diagrams, you also need the right tools to create and update them. One of the best tools for this is <a href="https://cloudairy.com/cloudchart"><strong>Cloudairy Cloudchart.</strong></a></p><h3>How to Use Cloudairy Cloudchart for C4 Diagrams</h3><p>Here’s how you can use <a href="https://cloudairy.com/cloudchart"><strong>Cloudairy Cloudchart</strong></a> to create diagrams using the C4 model:</p><ol><li><strong>Start with a Template</strong>: <strong>Cloudairy Cloudchart</strong> offers templates for different types of diagrams. Choose a template that matches the type of diagram you want to create.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0a9Wr-utq8WKMVb4am2jww.png" /></figure><p><strong>2. Add Elements</strong>: Use <strong>Cloudairy Cloudchart</strong> drag-and-drop tools to add the elements you need, like users, systems, and relationships for a context diagram, or containers for a container diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZvBqJls9OGoDG_OUCJBqw.png" /></figure><p><strong>3. Customize Your Diagram</strong>: You can customize your diagram’s colors, labels, and shapes to make it clear and visually appealing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*Jyzw6lLPkAgz4ovb4fujGg.png" /></figure><p><strong>4. Collaborate in Real-Time</strong>: Invite your team to work on the diagram with you. You can leave comments, suggest changes, and make sure everyone is on the same page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*MtOeZlHvq1kjCme8702tbg.png" /></figure><p><strong>5. Share Your Diagram</strong>: Once your diagram is ready, you can easily share it by embedding it in documents, presentations, or project management tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHXSoWbvSyYCcC512xouLw.png" /></figure><h3>Why Use Cloudairy Cloudchart ?</h3><p>Cloudairy Cloudchart is an online tool that makes it easy to create software architecture diagrams. Some of the features of <a href="https://chart.cloudairy.com/signup"><strong>Cloudairy Cloudchart</strong></a> :</p><ol><li><strong>Easy to Use</strong>: I<strong>t</strong> has a simple drag-and-drop interface, so you can create diagrams quickly without spending a lot of time learning how to use the tool.</li><li><strong>Collaboration Features</strong>: It lets multiple people work on a diagram at the same time. This is great for teams that need to brainstorm, design, and update their architecture together, especially if team members are in different locations.</li><li><strong>Templates and Shapes</strong>: It has lots of templates and shapes to help you create different types of diagrams, including those needed for the C4 model.</li><li><strong>Access from Anywhere</strong>: Since it is cloud-based, you can access your diagrams from anywhere, on any device. This is especially useful for remote teams.</li><li><strong>Version Control</strong>: It tracks changes to your diagrams, so you can see how they’ve evolved over time and go back to earlier versions if needed.</li><li>𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐯𝐞 𝐀𝐈 𝐌𝐚𝐠𝐢𝐜: Bring your ideas to life with our AI-powered flowchart generator</li><li>𝐕𝐢𝐬𝐮𝐚𝐥𝐢𝐳𝐞 𝐢𝐧 𝟑𝐃: Bring your cloud infrastructure to life with our 3D icons for AWS, Azure, GCP, and Kubernetes</li><li>𝐕𝐞𝐫𝐬𝐚𝐭𝐢𝐥𝐞 𝐒𝐭𝐢𝐜𝐤𝐲 𝐍𝐨𝐭𝐞𝐬: Brainstorm, plan, and collaborate effortlessly with various sticky notes</li><li>𝐄𝐧𝐫𝐢𝐜𝐡 𝐘𝐨𝐮𝐫 𝐃𝐞𝐬𝐢𝐠𝐧𝐬: Search and import images, icons, and GIFs directly into your diagrams</li><li>𝐂𝐮𝐬𝐭𝐨𝐦𝐢𝐳𝐞 𝐄𝐯𝐞𝐫𝐲𝐭𝐡𝐢𝐧𝐠: Make Cloudchart truly yours with custom colours, icons, and backgrounds</li><li><strong>200+Templates</strong>: Accelerate your design with 200+ pre-built cloud architecture templates</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ufgm6HeZyUAzITxYqDpbxQ.png" /><figcaption>welcome window of cloudairy</figcaption></figure><h3>What is the C4 Model?</h3><p>The C4 model is a method for creating software diagrams that break down a system into different levels of detail. This helps people understand the system from different perspectives without getting overwhelmed.</p><p>Here’s a simple explanation of the C4 model:</p><ol><li><strong>Context Diagrams (Level 1):</strong> These diagrams show the system as a whole and how it interacts with users and other systems. This is the big picture, helping everyone, even non-technical people, understand the system’s main purpose. <strong>Example</strong>: Imagine you’re working on an online banking system. A context diagram would show the banking system itself, the customers who use it, and other systems it interacts with, such as an email service or a mainframe banking system. This gives everyone a clear understanding of the system’s overall structure and its external connections.</li><li><strong>Container Diagrams (Level 2):</strong> These diagrams zoom in a bit and show the main parts of the system, like web applications, databases, or services. This level helps technical people see how the system is structured. <strong>Example</strong>: In the online banking system, a container diagram might show the web application that customers use, the database that stores account information, and a payment service that handles transactions. This helps the team see how the system is organized and how the different parts fit together</li><li><strong>Component Diagrams (Level 3):</strong> These diagrams break down each part of the system into smaller pieces, showing how these pieces work together. This level is useful for developers who need to understand how different parts of the system are connected. <strong>Example</strong>: Within the web application container of the online banking system, a component diagram might show different modules such as login, account management, and transaction processing. This helps developers understand the internal structure of the web application and how the components interact.</li><li><strong>Code Diagrams (Level 4):</strong> These are the most detailed diagrams, showing the actual code structure or design. These diagrams are for developers who need to see how the code is organized. <strong>Example</strong>: A code diagram might show the classes and methods used in the transaction processing module of the online banking system. This helps developers see how the code is organized and how it supports the overall architecture.</li></ol><p>The C4 model uses simple elements like boxes and lines to represent different parts of the system. It encourages clear labeling and a simple layout, making the diagrams easy to understand and collaborate on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LbImwYjhgs282BnI.png" /></figure><h3>The C4 approach</h3><p>C4 supports the idea of evolutionary architecture — where the architecture can change and grow as needed. The C4 model allows you to start with a simple diagram and add more details as the system evolves. This makes it perfect for teams that work in an agile way, where things are always changing.</p><p>For example, imagine you’re working on an online banking system. A Level 1 context diagram would show the whole system, including how it connects with users and other systems like email or mainframe systems. This gives everyone a clear understanding of the system’s overall structure.</p><p>At Level 2, you would create a container diagram that shows the main parts of the system, like the web application, database, and payment service. This helps the team see how the system is put together.</p><p>At Level 3, you would create a component diagram that breaks down each main part into smaller pieces, such as the different modules of the web application. This helps developers understand how everything fits together.</p><p>Finally, at Level 4, you would create code diagrams that show the details of the code, such as classes or database tables. This level helps developers see how the code is organized and how it supports the system.</p><h3>Using PlantUML for Diagrams</h3><p>While the C4 model helps you create clear diagrams, updating them as the system changes can still take a lot of time. This is where <strong>PlantUML</strong> comes in handy.</p><p>PlantUML is a tool that lets you create diagrams using plain text. Instead of using a drawing program, you can write your diagrams as code. This has several advantages:</p><ol><li><strong>Version Control:</strong> Because PlantUML diagrams are just text, you can save them in version control systems like GIT. This makes it easy to track changes and collaborate with others.</li><li><strong>Collaboration:</strong> PlantUML’s text format makes it easy to share and edit diagrams with your team. You can review and update diagrams directly in the code.</li><li><strong>Automation:</strong> You can automate the process of creating and updating diagrams by integrating PlantUML with your development pipeline. For example, you could set up a Jenkins job to generate the latest diagrams every time the code changes.</li><li><strong>Integration:</strong> PlantUML works well with popular coding tools like Visual Studio Code and IntelliJ IDEA, so you can create and update diagrams without leaving your coding environment.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*eFKH7csSkUnz0cXO.png" /></figure><p>Here’s an example of how you might use PlantUML to create a Level 1 System Context diagram for an online banking system:</p><pre><a href="http://twitter.com/startuml">@startuml</a><br>!include C4_Context.puml</pre><pre>LAYOUT_WITH_LEGEND()</pre><pre>title System Context diagram for E-commerce Platform</pre><pre>Person(customer, &quot;Online Shopper&quot;, &quot;A customer who buys products through the e-commerce platform.&quot;)<br>Person(admin, &quot;System Administrator&quot;, &quot;Manages the platform and ensures its smooth operation.&quot;)<br>System(ecommerce_system, &quot;E-commerce Platform&quot;, &quot;Allows customers to browse products, place orders, and make payments.&quot;)</pre><pre>System_Ext(payment_gateway, &quot;Payment Gateway&quot;, &quot;Processes online payments for orders.&quot;)<br>System_Ext(warehouse_system, &quot;Warehouse Management System&quot;, &quot;Manages inventory and shipping.&quot;)</pre><pre>Rel(customer, ecommerce_system, &quot;Browses and purchases products&quot;)<br>Rel(admin, ecommerce_system, &quot;Administers and monitors the platform&quot;)<br>Rel(ecommerce_system, payment_gateway, &quot;Processes payments&quot;)<br>Rel(ecommerce_system, warehouse_system, &quot;Sends order and shipping details&quot;)<br><a href="http://twitter.com/enduml">@enduml</a></pre><p>In this example, the diagram represents an E-commerce Platform and its interactions with an online shopper, a system administrator, a payment gateway, and a warehouse management system. It shows the relationships between the different entities involved in the system</p><h3>Other Diagrams and Tools</h3><p>PlantUML also lets you create other types of diagrams, like System Landscape Diagrams, Dynamic Diagrams, and Deployment Diagrams. These additional diagrams can help you understand more complex parts of the system.</p><p>There are also plugins for tools like Visual Studio Code and IntelliJ IDEA that let you create and view diagrams right in your coding environment. If you prefer, you can even set up a local PlantUML server using Docker:</p><pre>docker run -d -p 8080:8080 plantuml/plantuml-server:tomcat</pre><p>This gives you more control and ensures that your diagrams aren’t dependent on external services.</p><h3>Challenges with PlantUML</h3><p>While PlantUML is a great tool, it does have some challenges. For example, positioning elements like arrows and boxes can be tricky, especially in complex diagrams. Unlike graphical tools where you can drag and drop, with PlantUML, you have to adjust the layout using code, which can take time.</p><p>Another drawback is that PlantUML requires a server component to generate diagrams, which might not be as convenient as some other tools that work directly in the browser. However, the benefits of version control, collaboration, and automation often outweigh these challenges.</p><p>Software architecture diagrams are powerful tools for understanding and communicating how a system works. But to be effective, these diagrams need to be clear, consistent, and easy to update. The C4 model provides a simple yet powerful way to create diagrams that meet these goals.</p><p>By using tools like PlantUML, you can make it easier to create, update, and share your diagrams, ensuring they stay useful as your system evolves. With the right approach and tools, you can create diagrams that help your team understand the system better and work more effectively.</p><p>So, may your diagrams be clear, easy to understand, and always up-to-date. With the <a href="https://chart.cloudairy.com/signup"><strong>cloudairy cloudchart</strong></a> and PlantUML, you’ll have everything you need to create great software architecture diagrams.</p><p><strong>cloudairy cloudchart sign up link</strong> → <a href="https://chart.cloudairy.com/signup">https://chart.cloudairy.com/signup</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06bc900dcb96" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>