<?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 Nitish Kumar on Medium]]></title>
        <description><![CDATA[Stories by Nitish Kumar on Medium]]></description>
        <link>https://medium.com/@nitishgangwar?source=rss-fcddb73b48e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*13zGt9-dIfD-wlEkkV4-wQ.jpeg</url>
            <title>Stories by Nitish Kumar on Medium</title>
            <link>https://medium.com/@nitishgangwar?source=rss-fcddb73b48e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:00:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nitishgangwar/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[The Basics of LLM Mesh: The Future of Scalable AI Systems]]></title>
            <link>https://medium.com/@nitishgangwar/the-basics-of-llm-mesh-the-future-of-scalable-ai-systems-b8ce3b67b08d?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ce3b67b08d</guid>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Sun, 24 May 2026 21:59:14 GMT</pubDate>
            <atom:updated>2026-05-24T22:10:47.721Z</atom:updated>
            <content:encoded><![CDATA[<h4>What if your AI systems could think together instead of working alone? Welcome to the world of LLM Mesh — a powerful approach that’s quietly reshaping how modern AI applications are built.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*LoKmJMWljeQzTywB9f10_w@2x.jpeg" /></figure><h4>What is an LLM Mesh?</h4><p>An LLM Mesh (Large Language Model Mesh) is an architecture where multiple AI models collaborate, communicate, and specialize to solve complex problems — rather than relying on a single monolithic model.<br>Think of it like this:</p><p>❌ Traditional AI = One “super” brain doing everything<br>✅ LLM Mesh = A team of specialized experts working together</p><p>Instead of pushing one model to its limits, you orchestrate multiple models, each optimized for specific tasks like reasoning, summarization, code generation, or retrieval.</p><h4>Why LLM Mesh Matters</h4><p>As AI applications scale, relying on a single LLM becomes inefficient and expensive. LLM Mesh solves several real-world problems:<br>1. Efficiency &amp; Cost Optimization<br>Different models have different costs.<br>Why use GPT-4-level compute for simple tasks like formatting text?<br>👉 With LLM Mesh:</p><p>Use lightweight models for simple tasks<br>Reserve powerful models for complex reasoning</p><p>2. Specialization Wins<br>No single model is best at everything.<br>An LLM Mesh lets you:</p><p>Use one model for coding<br>Another for search &amp; retrieval<br>A third for domain-specific knowledge</p><p>👉 Result: Better accuracy and performance</p><p>3. Fault Tolerance &amp; Resilience<br>If one model fails, your system doesn’t collapse.</p><p>Failover to another model<br>Retry with a fallback strategy<br>Maintain uptime for production systems</p><p>4. Vendor Flexibility<br>Avoid vendor lock-in by integrating:</p><p>OpenAI<br>Anthropic<br>Google Gemini<br>Open-source models (Llama, Mistral)</p><p>👉 You’re no longer tied to one provider.</p><h4>Core Components of an LLM Mesh</h4><p>To understand how this works, let’s break down the building blocks:<br><strong>1. Orchestrator</strong><br>The “brain” of the mesh.</p><p>Routes tasks between models<br>Decides which model should handle what<br>Manages workflows</p><p>Popular tools:</p><p>LangGraph<br>Semantic Kernel<br>Custom orchestration layers</p><p><strong>2. Model Pool</strong><br>A collection of different LLMs with varied capabilities.<br>Example:</p><p>TaskModelChatGPT-4 / ClaudeCodeCode LlamaEmbeddingsOpenAI / CohereCheap tasksGPT-3.5 / Mistral</p><p><strong>3. Memory &amp; Context Layer</strong><br>Keeps track of:</p><p>Conversations<br>Previous outputs<br>Relevant documents</p><p>Often powered by:</p><p>Vector databases (Pinecone, Weaviate)<br>Redis / caching layers</p><p><strong>4. Routing Logic</strong><br>Decides:</p><p>“Which model should handle this request?”</p><p>Routing can be:</p><p>Rule-based<br>AI-driven (meta-models deciding the path)</p><p><strong>5. Observability &amp; Feedback Loop</strong><br>To improve performance:</p><p>Track latency &amp; cost<br>Monitor hallucinations<br>Collect user feedback</p><h4>How LLM Mesh Works (Simple Flow)</h4><p>User asks a question<br>Orchestrator analyzes intent<br>Routes request to the best model(s)<br>Models may collaborate (chain-of-thought)<br>Output is aggregated and returned</p><p>👉 Think of it like microservices — but for AI.</p><h4>LLM Mesh Architecture Diagram</h4><p>Below is a simplified architecture of how an LLM Mesh system operates in production:</p><p>User Layer → Initiates request<br>Orchestrator → Routes tasks intelligently<br>Model Pool → Specialized LLMs (chat, code, embeddings, etc.)<br>Memory Layer → Stores context (short-term + long-term)</p><h4>Real-World Use Cases</h4><p>💻 1. DevOps Automation</p><p>One model analyzes logs<br>Another generates fixes<br>A third validates changes</p><p>🛒 2. E-Commerce Assistants</p><p>Search model → product retrieval<br>Chat model → customer interaction<br>Recommendation model → upsell</p><p>🧪 3. Enterprise Knowledge Assistants</p><p>Retrieval + summarization + reasoning<br>Multi-model orchestration improves accuracy</p><p>⚖️ LLM Mesh vs Single Model</p><p>FeatureSingle LLMLLM MeshScalabilityLimitedHighCostExpensiveOptimizedFlexibilityLowHighReliabilitySingle point of failureResilientPerformanceGeneralizedSpecialized</p><p>⚠️ Challenges to Consider<br>LLM Mesh isn’t perfect. Here’s what you need to watch out for:</p><p>Complexity → More moving parts to manage<br>Latency → Multiple model calls can slow things down<br>Orchestration overhead → Requires smart design<br>Debugging difficulty → Harder to trace errors</p><p>👉 But with the right architecture, benefits outweigh these challenges.</p><p>🔮 The Future of AI is Mesh-Based<br>We’re moving toward a world where:</p><p>AI systems behave like distributed intelligence networks<br>Models collaborate instead of compete<br>Systems become adaptive, cost-aware, and context-aware</p><p>LLM Mesh is not just a trend — <br>👉 It’s the foundation for next-gen AI architectures.</p><h4>Final Thoughts<br>If you’re building AI applications today, here’s the takeaway:</h4><p>Stop thinking in terms of one model solving everything.<br>Start thinking in terms of systems of models working together.</p><p>That shift — from monolithic AI to LLM Mesh is what will separate scalable platforms from experimental prototypes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ce3b67b08d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Using .env in Production
A Better Way to Manage Secrets in AWS, Azure, and GCP]]></title>
            <link>https://medium.com/@nitishgangwar/stop-using-env-in-production-a-better-way-to-manage-secrets-in-aws-azure-and-gcp-95731c0c2943?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/95731c0c2943</guid>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[secure-coding]]></category>
            <category><![CDATA[secret-management-tools]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Fri, 22 May 2026 03:13:22 GMT</pubDate>
            <atom:updated>2026-05-22T03:13:22.798Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn why .env files are risky in production and how to securely manage secrets using cloud-native solutions.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ECd5T3hW8Vg4BViHbJo6g.png" /></figure><p>Let’s be honest — most of us have used .env files in our projects. They’re simple, easy to set up, and they just work. Especially during development, they feel like the perfect solution.</p><p>But here’s the catch.</p><p>What works great locally doesn’t always belong in production.</p><p>If you’re still relying on .env files in a production environment, you might be exposing your system to risks you don’t fully see yet.</p><h3>So, what’s the problem with .env?</h3><p>At first glance, nothing seems wrong. You store your API keys, database passwords, and tokens in one place, load them into your application, and move on.</p><p>But production environments are a completely different game.</p><p>Your .env file suddenly becomes one of the most sensitive assets in your system—and unfortunately, also one of the easiest to mishandle.</p><p>Think about it.</p><p>It can accidentally get committed to a Git repository. It might end up baked into a Docker image. Sometimes it even leaks through logs or backups.</p><p>And once a secret is exposed, containing it isn’t easy. Rotating credentials, updating services, and restoring trust — it all becomes stressful and time-consuming.</p><h3>It gets harder as you scale</h3><p>Maybe it’s manageable when you have one application.But what happens when you have ten? Or fifty?</p><p>Now you’re juggling .env files across services, environments, and deployments. Updating a single secret suddenly means touching multiple systems, redeploying apps, and hoping nothing breaks.</p><p>This is where things start to fall apart:</p><p>You lose visibility into who has access to what.<br>You can’t track when a secret was used or changed.<br>You end up relying on manual processes that are prone to error.</p><p>And secret rotation? That becomes a headache nobody wants to deal with — so it often gets delayed.</p><h3>The real issue: no control, no visibility</h3><p>The biggest limitation of .env files isn’t just security—it’s the lack of control.</p><p>There’s no built-in access management.<br>No audit logs.<br>No enforcement of least privilege.</p><p>In modern systems, especially in regulated environments, this simply doesn’t cut it.</p><h3>So what’s the better way?</h3><p>Instead of storing secrets in files, modern systems rely on <strong>managed secret services provided by cloud platforms</strong>.</p><p>The idea is simple but powerful:</p><blockquote>Don’t store secrets inside your app — <strong>let your app securely fetch them when needed</strong>.</blockquote><p>This shift changes everything. Now your secrets live in a centralized, secure service. Access is controlled using identity (not hardcoded credentials), and every interaction can be monitored and audited.</p><h3>What this looks like in practice</h3><p>If you’re on AWS, you’d typically use <strong>AWS Secrets Manager</strong>. In Azure, it’s <strong>Azure Key Vault</strong>. And in Google Cloud, you have <strong>Secret Manager</strong>.</p><p>The tooling changes slightly between platforms, but the concept stays consistent.</p><p>Instead of passing secrets through files, your application authenticates using its identity — like an IAM role, managed identity, or service account — and retrieves secrets securely at runtime.</p><p>No plaintext storage. No duplication. No guesswork.</p><h3>Why this approach is better</h3><p>Once you move to managed secrets, a lot of problems disappear almost immediately.</p><ul><li>You get centralized storage, so everything is in one place.</li><li>You can define exactly who or what can access each secret.</li><li>You get audit logs, which means you can see every access attempt.</li></ul><p>And most importantly, you can rotate secrets without breaking your system.</p><p>It’s not just safer — it’s also easier to operate at scale.</p><h3>Where .env still makes sense</h3><p>Now, this doesn’t mean .env files are bad altogether.</p><p>They’re still perfect for <strong>local development</strong>.</p><p>They keep things simple when you’re building and testing. No need to over-engineer at that stage.</p><p>But production? That’s where the rules change.</p><h3>The takeaway</h3><p>Using .env files in production might seem harmless at first, especially if things are working fine today.</p><p>But as your system grows, the risks grow with it. Modern cloud platforms already give you everything you need to manage secrets securely, without the downsides of static files.</p><p>So the shift is really about mindset:</p><p><strong><em>Move away from storing secrets in files and start accessing them dynamically, using identity.</em></strong></p><p>It’s a small change in approach — but a huge step forward in building secure, production-ready systems.</p><p>If you’ve made this shift already, you know how much smoother things become. If not, it might be the simplest upgrade you can make to your system this week.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95731c0c2943" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Waiting on Builds: Using UV, JFrog, and GitHub Actions for Lightning-Fast CI/CD]]></title>
            <link>https://medium.com/@nitishgangwar/stop-waiting-on-builds-using-uv-jfrog-and-github-actions-for-lightning-fast-ci-cd-ec20610393b5?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec20610393b5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[build-optimization]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[uv]]></category>
            <category><![CDATA[ci-cd-devops]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 04:42:48 GMT</pubDate>
            <atom:updated>2026-01-31T04:42:48.681Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical DevOps story about faster builds, safer releases, and happier developers</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*lZSEAKiR9Ll1BryzCmAXqA@2x.jpeg" /></figure><h3>Why I Had to Fix My Builds</h3><p>If you work with Python microservices, you probably know this pain: every small change triggers a Docker build that takes forever. Meanwhile, I stared at a progress bar and lost context on the problem I was actually solving.</p><p>In my case, I had multiple Python-based services — APIs, workers, schedulers — with 100+ dependencies each. A typical CI run meant 8–10 minutes just to get through pip install. I couldn&#39;t ignore the numbers anymore.</p><h3>The Daily Reality</h3><p>A normal morning used to look like this:</p><pre>8:00 AM  - Write code<br>8:05 AM  - Push to branch<br>8:15 AM  - Build completes ⏰ (10 minutes)<br>8:16 AM  - Test, find bug<br>8:20 AM  - Fix bug, push<br>8:30 AM  - Build completes ⏰ (10 minutes)<br>8:31 AM  - Finally ready to retest</pre><p>That’s 20+ minutes lost for a single iteration on a single service.</p><p>Now add:<br>3–5 iterations per day<br>20 working days per month<br>I was burning hours per month just waiting for containers to build.<br>And this was only half of the problem.</p><h3>The Hidden Cost: Risky Production Deployments</h3><p>Slow builds were painful, but unsafe deployments were scarier.I had a mix of:</p><ul><li>Manual scripts for production deploys</li><li>Occasional work directly on the main branch</li><li>“Quick fixes” that bypassed proper review and testing</li></ul><p>The nightmare scenario went like this:</p><ol><li>I made a quick patch directly on main.</li><li>I ran a familiar deployment script by habit.</li><li>There were no meaningful guardrails.</li><li>Untested code went straight to production.</li></ol><p>I saw:</p><ul><li>2–3 accidental production deployments per month</li><li>1–2 version mismatches across environments</li><li>Regular “works on my machine” incidents due to inconsistent dependencies</li></ul><p>I wanted something better: fast feedback loops for development, plus guardrails strong enough that “oops, I deployed to prod” would effectively disappear.</p><p>So I designed a solution around four non-negotiable goals:</p><ol><li><strong>Speed</strong> — Sub-minute builds for most changes</li><li><strong>Safety</strong> — Practically impossible to accidentally ship to production</li><li><strong>Consistency</strong> — Identical artifacts across environments</li><li><strong>Automation</strong> — Minimal manual steps, clear workflows</li></ol><h3>The Core Idea: Packages First, Images Second</h3><p>The turning point was changing how I thought about deployment.Instead of building everything directly inside Docker with pip install -r requirements.txt on every run, I moved to a model where:</p><ol><li>Python services are built as versioned wheel packages.</li><li>Those packages are published to a private repository in a structured way.</li><li>Docker images consume those pre-built artifacts using a fast package manager.</li><li>CI/CD becomes a predictable, repeatable pipeline built around those artifacts.</li></ol><p>To make that work in practice, I combined three key components:</p><ol><li><strong>UV</strong> — a Rust-based Python package manager that’s dramatically faster than pip.</li><li><strong>JFrog Artifactory</strong> — my private package hub and source of truth for Python artifacts.</li><li><strong>A 4-layer production safeguard system</strong> — hard-coded checks that refuse unsafe deployments.</li></ol><p>The rest was “just” engineering.</p><h3>UV: Making Python Dependencies Stop Hurting</h3><p>Let’s start with the obvious bottleneck: dependency installation.</p><p>A typical Dockerfile in my old world looked like this:</p><pre>FROM python:3.10<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt  # 5–8 minutes for 100+ packages<br>COPY . /app<br>WORKDIR /app<br>CMD [&quot;python&quot;, &quot;main.py&quot;]</pre><p>With bigger dependency graphs, pip install easily took 5–10 minutes per build.</p><p>Switching to <a href="https://github.com/astral-sh/uv">UV</a>, a Rust-based package manager for Python, changed that immediately:</p><pre># pip: 5–8 minutes<br>pip install -r requirements.txt<br># UV: 30–60 seconds<br>uv pip install -r requirements.txt</pre><p>UV brought:</p><ul><li>Parallel downloads</li><li>Efficient dependency resolution</li><li>Better use of caching</li></ul><p>That alone cut install times from minutes to seconds for typical services. But the real payoff came when I combined it with pre-built wheels stored in a private repository.</p><h3>JFrog as the Single Source of Truth for Artifacts</h3><p>Next, I introduced a private package repository using JFrog Artifactory. The idea was simple:</p><ul><li>Every service is built into a wheel once per version.</li><li>That wheel is uploaded to a predictable path based on environment and version.</li><li>All builds and deployments pull from that repository instead of live-resolving dependencies from PyPI.</li></ul><p>A typical upload path looked like:</p><ul><li>dev/my-service/v1.2.3-feature-branch/dist/</li><li>staging/my-service/v1.2.3/dist/</li><li>prod/my-service/v1.2.3/dist/</li></ul><p>This gave me:</p><ul><li>Consistent artifacts in dev, staging, and production</li><li>Isolation of environments via logical paths</li><li>The ability to rebuild containers without hitting external registries</li><li>A complete history of what I shipped and where</li></ul><p>The last piece of the puzzle was to stop doing heavy work inside the Docker build itself. Instead, I let Docker consume pre-built artifacts in a predictable way.</p><h3>The Build Manager: One Script to Orchestrate Everything</h3><p>To make this maintainable, I wrapped the core logic in a Python “build manager” script. Its responsibilities:</p><ul><li>Infer the version from Git tags</li><li>Detect the environment from the current branch</li><li>Enforce production safeguards</li><li>Build wheel packages</li><li>Publish them to JFrog using a structured path</li></ul><p>Here’s a simplified version of the core class:</p><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;Build Manager - Handles versioning, building, and publishing&quot;&quot;&quot;<br>import subprocess<br>import sys<br>from pathlib import Path<br>class BuildManager:<br>    def get_git_version(self) -&gt; str:<br>        &quot;&quot;&quot;Get version from Git tags&quot;&quot;&quot;<br>        subprocess.run([&quot;git&quot;, &quot;fetch&quot;, &quot;--tags&quot;, &quot;--force&quot;])<br>        result = subprocess.run(<br>            [&quot;git&quot;, &quot;tag&quot;, &quot;--sort=-version:refname&quot;],<br>            capture_output=True, text=True<br>        )<br>        tags = [t for t in result.stdout.split(&#39;\n&#39;) if t.startswith(&#39;v&#39;)]<br>        return tags[0].lstrip(&#39;v&#39;) if tags else &quot;0.1.0&quot;<br>    def get_branch_name(self) -&gt; str:<br>        result = subprocess.run(<br>            [&quot;git&quot;, &quot;rev-parse&quot;, &quot;--abbrev-ref&quot;, &quot;HEAD&quot;],<br>            capture_output=True, text=True<br>        )<br>        return result.stdout.strip()<br>    def detect_environment(self) -&gt; str:<br>        &quot;&quot;&quot;Auto-detect environment from branch&quot;&quot;&quot;<br>        branch = self.get_branch_name()<br>        if branch in (&quot;main&quot;, &quot;master&quot;, &quot;production&quot;):<br>            return &quot;prod&quot;<br>        if branch in (&quot;staging&quot;, &quot;qa&quot;, &quot;uat&quot;):<br>            return &quot;staging&quot;<br>        return &quot;dev&quot;<br>    def validate_production_publish(self):<br>        &quot;&quot;&quot;4-layer safeguard validation&quot;&quot;&quot;<br>        branch = self.get_branch_name()<br>        # 1) Branch check<br>        if branch not in (&quot;main&quot;, &quot;master&quot;, &quot;production&quot;):<br>            return False, &quot;Not on production branch&quot;<br>        # 2) Clean working directory<br>        status = subprocess.run(<br>            [&quot;git&quot;, &quot;status&quot;, &quot;--porcelain&quot;],<br>            capture_output=True, text=True<br>        )<br>        if status.stdout.strip():<br>            return False, &quot;Uncommitted changes found&quot;<br>        # 3) Remote sync (not behind, not ahead)<br>        subprocess.run([&quot;git&quot;, &quot;fetch&quot;, &quot;origin&quot;, branch])<br>        behind = subprocess.run(<br>            [&quot;git&quot;, &quot;rev-list&quot;, &quot;--count&quot;, f&quot;HEAD..origin/{branch}&quot;],<br>            capture_output=True, text=True<br>        ).stdout.strip()<br>        ahead = subprocess.run(<br>            [&quot;git&quot;, &quot;rev-list&quot;, &quot;--count&quot;, f&quot;origin/{branch}..HEAD&quot;],<br>            capture_output=True, text=True<br>        ).stdout.strip()<br>        if behind != &quot;0&quot;:<br>            return False, f&quot;Behind remote by {behind} commits&quot;<br>        if ahead != &quot;0&quot;:<br>            return False, f&quot;Ahead of remote by {ahead} unpushed commits&quot;<br>        # 4) Tagged commit<br>        try:<br>            subprocess.run(<br>                [&quot;git&quot;, &quot;describe&quot;, &quot;--exact-match&quot;, &quot;HEAD&quot;],<br>                check=True, capture_output=True<br>            )<br>        except subprocess.CalledProcessError:<br>            return False, &quot;Current commit not tagged&quot;<br>        return True, &quot;All checks passed&quot;<br>    def publish(self, service_name: str):<br>        &quot;&quot;&quot;Main publish workflow&quot;&quot;&quot;<br>        env = self.detect_environment()<br>        version = self.get_git_version()<br>        print(f&quot;Publishing {service_name} v{version} to {env}&quot;)<br>        if env == &quot;prod&quot;:<br>            is_safe, msg = self.validate_production_publish()<br>            if not is_safe:<br>                print(f&quot;❌ BLOCKED: {msg}&quot;)<br>                sys.exit(1)<br>            print(&quot;⏰ Production publish in 5 seconds... (Ctrl+C to cancel)&quot;)<br>            import time; time.sleep(5)<br>        self.build_package(service_name)<br>        self.upload_to_jfrog(service_name, version, env)<br>        print(&quot;✅ Published successfully&quot;)</pre><p>This script gave me a <strong>single interface</strong> for all build and publish tasks. I didn’t need to remember arcane commands; I just ran:</p><pre>python build_manager.py publish --service my-api</pre><p>Behind the scenes, the script:</p><ul><li>Confirmed the branch and environment</li><li>Enforced clean working trees and up-to-date branches</li><li>Required a Git tag for production publishes</li><li>Built the package and uploaded it to the correct path in JFrog</li></ul><h3>Dockerfiles That Respect Caching (and My Time)</h3><p>With wheel artifacts ready to go, I refactored my Dockerfiles to take full advantage of caching and UV.</p><p>Here’s the basic pattern I used:</p><pre>FROM python:3.11-slim<br># Install UV once<br>RUN pip install --no-cache-dir uv<br># Build-time configuration<br>ARG JFROG_USER<br>ARG JFROG_TOKEN<br>ARG JFROG_ENV=dev<br>ARG PACKAGE_VERSION<br>ARG SERVICE_NAME<br># Fallback requirements<br>COPY requirements.txt /tmp/requirements.txt<br># Prefer installing from JFrog; fallback to requirements.txt<br>RUN if [ -n &quot;$JFROG_USER&quot; ] &amp;&amp; [ -n &quot;$PACKAGE_VERSION&quot; ]; then \<br>      echo &quot;📦 Installing from JFrog: ${SERVICE_NAME} v${PACKAGE_VERSION}&quot;; \<br>      JFROG_URL=&quot;https://${JFROG_USER}:${JFROG_TOKEN}@artifactory.example.com&quot;; \<br>      BASE_VERSION=$(echo &quot;${PACKAGE_VERSION}&quot; | sed &#39;s/-.*//&#39;); \<br>      uv pip install --system \<br>        --find-links &quot;${JFROG_URL}/python/${JFROG_ENV}/${SERVICE_NAME}/v${PACKAGE_VERSION}/dist/&quot; \<br>        ${SERVICE_NAME}==${BASE_VERSION} || \<br>      uv pip install --system -r /tmp/requirements.txt; \<br>    else \<br>      echo &quot;⚠️  No JFROG credentials, using requirements.txt&quot;; \<br>      uv pip install --system -r /tmp/requirements.txt; \<br>    fi<br>COPY . /app<br>WORKDIR /app<br>CMD [&quot;python&quot;, &quot;-m&quot;, &quot;uvicorn&quot;, &quot;main:app&quot;, &quot;--host&quot;, &quot;0.0.0.0&quot;]</pre><p>This gave me:</p><ul><li>Fast installs via UV</li><li>Immediate reuse of cached layers when only app code changed</li><li>Graceful fallback to requirements.txt if JFrog was unavailable</li><li>A consistent way to build images across environments</li></ul><p>For services with heavier logic or more dependencies, I used a multi-stage Dockerfile pattern to keep runtime images lean while still benefiting from fast installs in a separate stage.</p><h3>GitHub Actions: Let CI/CD Make the Decisions</h3><p>To glue everything together, I used GitHub Actions as the CI/CD backbone. The workflow had three main responsibilities:</p><ol><li>Detect environment and version from the Git context.</li><li>Build and publish Python packages to JFrog.</li><li>Build Docker images using those packages and push them to the container registry.</li></ol><p>Here’s a condensed version of the workflow, you can update the workflow as per your needs:</p><pre>name: Build and Deploy<br><br>on:<br>  release:<br>    types: [published]  # Production via releases only<br>  push:<br>    branches: [&#39;**&#39;, &#39;!main&#39;]  # Dev/staging on every push<br><br>jobs:<br>  build-and-publish:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 0<br>      <br>      - name: Set up Python<br>        uses: actions/setup-python@v4<br>        with:<br>          python-version: &#39;3.11&#39;<br>      <br>      - name: Install dependencies<br>        run: |<br>          pip install uv build<br>      <br>      - name: Authenticate JFrog<br>        uses: company/artifactory-login@v1<br>        with:<br>          url: ${{ secrets.JFROG_URL }}<br>          username: ${{ secrets.JFROG_USER }}<br>          password: ${{ secrets.JFROG_TOKEN }}<br>      <br>      - name: Build and publish to JFrog<br>        env:<br>          JFROG_URL: ${{ secrets.JFROG_URL }}<br>          JFROG_USER: ${{ secrets.JFROG_USER }}<br>          JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }}<br>        run: |<br>          # Use build_manager.py to build and publish<br>          python build_manager.py publish --service my-api<br>          python build_manager.py publish --service my-worker<br>          python build_manager.py publish --service my-scheduler<br>      <br>      - name: Get version for Docker build<br>        id: version<br>        run: |<br>          VERSION=$(git tag --sort=-version:refname | head -n1 | sed &#39;s/^v//&#39;)<br>          echo &quot;version=${VERSION:-0.1.0}&quot; &gt;&gt; $GITHUB_OUTPUT<br>      <br>      - name: Build Docker images<br>        run: |<br>          # Detect environment for JFrog path<br>          BRANCH=&quot;${{ github.ref_name }}&quot;<br>          if [[ &quot;$BRANCH&quot; =~ ^(main|master)$ ]]; then<br>            JFROG_ENV=&quot;prod&quot;<br>          elif [[ &quot;$BRANCH&quot; =~ ^(staging|qa)$ ]]; then<br>            JFROG_ENV=&quot;staging&quot;<br>          else<br>            JFROG_ENV=&quot;dev&quot;<br>          fi<br>          <br>          # Build all service containers<br>          for service in my-api my-worker my-scheduler; do<br>            docker build \<br>              --build-arg JFROG_USER=${{ secrets.JFROG_USER }} \<br>              --build-arg JFROG_TOKEN=${{ secrets.JFROG_TOKEN }} \<br>              --build-arg JFROG_ENV=${JFROG_ENV} \<br>              --build-arg PACKAGE_VERSION=${{ steps.version.outputs.version }} \<br>              --build-arg SERVICE_NAME=${service} \<br>              -t ${service}:${{ steps.version.outputs.version }} \<br>              -f containers/${service}/Dockerfile \<br>              .<br>          done</pre><p>A few design choices here:</p><ul><li><strong>Production only via GitHub Releases</strong>: Nobody can “just push to main” to deploy.</li><li><strong>Branches drive environment detection</strong>: main/master → prod, staging → staging, everything else → dev.</li><li><strong>Version from Git tags</strong>: Keeps versioning explicit and auditable.</li></ul><p>For multi-service or monorepo setups, I extended the workflow with a matrix strategy to build and publish multiple packages in parallel.</p><h3>Results: What Changed in Practice</h3><h3>Build and Pipeline Performance</h3><p>Here’s what I measured after rolling out UV, JFrog, and the new pipeline:</p><pre>| Metric                        | Before (pip + naive Docker) | After (UV + JFrog + caching)  |<br>|-------------------------------|-----------------------------|-------------------------------|<br>| Single Docker build           | 8–10 minutes                | 45–60 seconds                 |<br>| Full pipeline (3 services)    | ~10 minutes                 | 60–90 seconds                 |<br>| Average iteration cycle       | ~10 minutes                 | &lt;1 minute                     |<br>| Cache hit rate (dependencies) | ~30%                        | ~90–95%                       |</pre><p>The difference in day-to-day development was dramatic:</p><ul><li><strong>Before:</strong><br> Push → Wait 10 min → Find bug → Fix → Wait 10 min<br> Total ~20 minutes per iteration</li><li><strong>After:</strong><br> Push → Wait 1 min → Find bug → Fix → Wait 1 min<br> Total ~2 minutes per iteration</li></ul><p>Even a conservative 10–15 minutes saved per day added up to significant regained time.</p><h3>Safety and Reliability</h3><p>Few months after implementing the safeguards:</p><ul><li>Accidental production deployments: <strong>0</strong></li><li>Version mismatches across environments: <strong>0</strong></li><li>“Works on my machine” incidents: <strong>0</strong></li></ul><p>The 4-layer production check — branch, clean working tree, remote sync, tagged commit — proved to be enough friction to prevent human mistakes without slowing legitimate releases.</p><h3>Lessons Learned (So You Don’t Have to Repeat My Mistakes)</h3><h3>1. Always Implement a Fallback Path</h3><p>Private registries do go down. Credentials do expire. To avoid blocking builds completely, I always include a fallback to requirements.txt:</p><pre>RUN if uv pip install --system --find-links &quot;${JFROG_URL}&quot; my-package; then \<br>      echo &quot;✅ Installed from JFrog&quot;; \<br>    else \<br>      echo &quot;⚠️  Fallback to requirements.txt&quot;; \<br>      uv pip install --system -r requirements.txt; \<br>    fi</pre><p>This keeps builds resilient while still preferring the fast, cached path.</p><h3>2. Stick to PEP 440 for Versions</h3><p>My versioning scheme matters, especially for Python wheels and tooling.</p><p>Examples that work well:</p><pre>1.2.3           # Production<br>1.2.3-dev       # Development pre-release<br>1.2.3-rc1       # Release candidate</pre><p>Things to avoid:</p><pre>1.2.3+feature   # &#39;+&#39; causes issues with wheel filenames<br>v1.2.3          # Keep the &#39;v&#39; prefix for Git tags only</pre><p>Keeping versions clean and standards-compliant makes everything downstream much simpler.</p><h3>3. Test Your “Break Glass” Path</h3><p>If I added emergency overrides (for example, an environment variable that can bypass some checks in a real incident), I made sure to test them regularly:</p><pre>FORCE_PROD_PUBLISH=true python build_manager.py publish --service my-api</pre><p>Log these cases, and make sure they still require conscious human confirmation. They should feel heavyweight, not like a shortcut.</p><h3>4. Document the Workflow Like You’re Onboarding Yourself</h3><p>A solution is only as good as how easily others can use it. I wrote a simple developer-facing guide that covered:</p><pre>## Deploying to Production<br>1. Merge all changes to main<br>2. Create a GitHub Release with tag v1.2.3<br>3. GitHub Actions automatically deploys<br>**Never manually deploy to production!**</pre><p>The goal was to make the “happy path” obvious and easy, so I didn’t feel the need to improvise.</p><h3>If You Want to Try This Yourself</h3><p>If you’re dealing with slow Python builds and fragile deployments, here’s how I’d recommend starting:</p><ol><li><strong>Pick one service</strong> as your pilot.</li><li><strong>Introduce UV</strong> in the Dockerfile to speed up dependency installation.</li><li><strong>Add a private package repository</strong> (JFrog or similar) to store wheels.</li><li><strong>Build a small “build manager” script</strong> to standardize versioning and publishing.</li><li><strong>Wire it into CI/CD</strong> with GitHub Actions or your tool of choice.</li><li><strong>Add safeguards for production</strong> before you roll this out widely.</li></ol><p>You don’t have to adopt everything at once. Even just switching pip to UV and reorganizing your Docker layers can shave minutes off each build.</p><p>But if you go all the way — packages first, images second, strong safeguards, and clear automation — you’ll likely end up where I did:</p><ul><li><strong>10x faster builds</strong></li><li><strong>Zero accidental production deployments</strong> over months</li><li><strong>Happier development</strong> where I spend my time coding instead of watching logs scroll by</li></ul><p>That, to me, is what DevOps is really about: making the right way the easy way, and making painful things fade into the background.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec20610393b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Submodules: The Honest Guide I Wish I Had]]></title>
            <link>https://medium.com/@nitishgangwar/git-submodules-the-honest-guide-i-wish-i-had-4995fff74035?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4995fff74035</guid>
            <category><![CDATA[code-reusability]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Thu, 30 Oct 2025 17:25:36 GMT</pubDate>
            <atom:updated>2025-10-30T17:47:37.546Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical guide to embedding repositories without losing your mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*-l4hn5D8-QuJGlPHjPsnYQ@2x.jpeg" /></figure><p>If you’ve ever copied a shared library into multiple repos, you’ve probably thought, “There has to be a better way.” Git submodules are that way — most of the time. They let you embed one Git repo inside another while keeping each repo’s history clean and independent. But submodules come with sharp edges. This guide gives you the happy path, the pitfalls, and the real-world workflows that actually stick.</p><h3>What a submodule really is</h3><p>A submodule is just a pointer from your main repo (the “superproject”) to a specific commit in another repo. That means:</p><ul><li>It’s versioned like any other dependency.</li><li>It is intentionally “pinned” to a commit, not auto-updated.</li><li>You must update the pointer when you want new code.</li></ul><p>Under the hood, a submodule entry lives in two places:</p><ul><li>The .gitmodules file (tracked) for metadata like path, URL, and optionally a branch.</li><li>Your superproject’s index, where the submodule appears as a special “gitlink” pointing to a commit SHA.</li></ul><h3>When submodules shine</h3><ul><li>You need strict version pinning across repos.</li><li>The dependency has its own lifecycle, access controls, or contributors.</li><li>You want to keep histories separate (clean blame, clean releases).</li><li>You’re embedding infra or shared code without merging histories.</li></ul><p>Common examples:</p><ul><li>Shared SDKs or internal libraries.</li><li>IAC modules (e.g., Terraform modules) shared across services.</li><li>Reusable workflows or templates shared across teams.</li></ul><h3>When they don’t</h3><ul><li>You want “always latest” from the dependency.</li><li>New contributors aren’t comfortable with Git’s deeper features.</li><li>Your CI/CD can’t easily authenticate to private submodules.</li><li>You need seamless refactoring across boundaries.</li></ul><p>If those fit you, consider Git subtree or a monorepo (see comparison below).</p><h3>Add a submodule the right way</h3><pre># From the superproject root<br>git submodule add https://github.com/org/libA external/libA<br>git commit -m &quot;Add libA as a submodule&quot;</pre><p>This creates or updates .gitmodules and checks out the dependency at a specific commit.</p><p>Optional: Track a branch for convenience, but remember you still commit pointer updates.</p><pre>git submodule set-branch --branch main external/libA<br>git commit -am &quot;Track libA main branch in .gitmodules&quot;</pre><p>.gitmodules example:</p><pre>[submodule &quot;external/libA&quot;]<br>    path = external/libA<br>    url = git@github.com:org/libA.git<br>    branch = main</pre><h3>Clone, init, and update without surprises</h3><pre># One-shot clone with submodules<br>git clone --recurse-submodules git@github.com:org/app.git<br># If you forgot --recurse-submodules<br>git submodule update --init --recursive</pre><p>Quality-of-life settings:</p><pre># Make common commands recurse into submodules by default<br>git config --global submodule.recurse true<br># Better diffs for submodules<br>git config --global diff.submodule log</pre><h3>Update flows you’ll actually use</h3><ul><li>Pin to a specific tag:</li></ul><pre>cd external/libA<br>git fetch --tags<br>git checkout v1.4.2<br>cd -<br>git add external/libA<br>git commit -m &quot;Pin libA to v1.4.2&quot;</pre><ul><li>Move to latest of tracked branch:</li></ul><pre>git submodule update --remote external/libA<br>git add external/libA<br>git commit -m &quot;Bump libA to latest main&quot;</pre><ul><li>Make changes inside the submodule and bump the pointer:</li></ul><pre>cd external/libA<br>git switch -c fix/edge-case<br># ...edit, commit, push the submodule repo...<br>git push -u origin fix/edge-case<br># merge PR in submodule repo to main, then:<br>git checkout main &amp;&amp; git pull<br>cd -<br>git add external/libA<br>git commit -m &quot;Update libA pointer after upstream merge&quot;</pre><h3>CI/CD gotchas and fixes</h3><ul><li>Private submodules need credentials in CI.</li><li>Use SSH with a deploy key that has read access to the submodule repo.</li><li>Or use a machine user/token with least privileges.</li><li>Preload known_hosts or use StrictHostKeyChecking=no for ephemeral runners (prefer the secure route: known_hosts).</li><li>GitHub Actions:</li></ul><pre># .github/workflows/build.yml<br>steps:<br>  - uses: actions/checkout@v4<br>    with:<br>      submodules: recursive<br>      fetch-depth: 0<br>  - name: Verify submodules<br>    run: git submodule status</pre><ul><li>GitLab CI:</li></ul><pre># .gitlab-ci.yml<br>variables:<br>  GIT_SUBMODULE_STRATEGY: recursive<br>build:<br>  script:<br>    - git submodule status</pre><ul><li>Jenkins (Declarative):</li></ul><pre>pipeline {<br>  stages {<br>    stage(&#39;Checkout&#39;) {<br>      steps {<br>        checkout([$class: &#39;GitSCM&#39;,<br>          userRemoteConfigs: [[url: &#39;git@github.com:org/app.git&#39;, credentialsId: &#39;ssh-key&#39;]],<br>          branches: [[name: &#39;*/main&#39;]],<br>          extensions: [<br>            [$class: &#39;SubmoduleOption&#39;, recursiveSubmodules: true, trackingSubmodules: false]<br>          ]<br>        ])<br>      }<br>    }<br>  }<br>}</pre><h3>Common errors and fast fixes</h3><ul><li>Detached HEAD inside the submodule:</li><li>That’s normal after init. Create a branch before committing:</li></ul><pre>cd external/libA<br>git switch -c feature/x</pre><ul><li>“Submodule appears modified” after pull:</li><li>You changed the pointer locally. Either commit it or reset:</li></ul><pre>git submodule update --init --recursive<br>git checkout -- external/libA</pre><ul><li>Wrong URL after migrating repos/mirrors:</li><li>Sync URLs from .gitmodules to .git/config:</li></ul><pre>git submodule sync --recursive<br>git submodule update --init --recursive</pre><ul><li>Merge conflicts in .gitmodules:</li><li>Resolve like any text file, ensure URL, path, and branch agree, then run sync.</li><li>CI fails to fetch submodules:</li><li>Check that CI credentials can read the submodule repo.</li><li>Avoid shallow clones when submodules need tags or history: fetch-depth: 0.</li></ul><h3>Remove a submodule cleanly</h3><pre>git rm -f external/libA<br>rm -rf .git/modules/external/libA<br>git config -f .gitmodules --remove-section submodule.external/libA<br>git add .gitmodules<br>git commit -m &quot;Remove libA submodule&quot;</pre><h3>Advanced moves you may need</h3><ul><li>Run a command in all submodules:</li></ul><pre>git submodule foreach &#39;git status&#39;</pre><ul><li>Move submodule storage into the superproject (if it got detached):</li></ul><pre>git submodule absorbgitdirs --all</pre><ul><li>Override submodule URL (e.g., corporate mirror) without touching .gitmodules:</li></ul><pre>git config submodule.external/libA.url git@corp.git/mirror/libA.git</pre><ul><li>Make “git diff” show logs of submodule changes (super helpful in PRs):</li></ul><pre>git config --global diff.submodule log<br>git diff --submodule=log</pre><h3><strong>Submodule vs subtree vs monorepo</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LtBuFjvfHGnxgurQYV2lUQ.png" /></figure><h3>Practical patterns that age well</h3><ul><li>Treat submodules like external dependencies:</li><li>Pin to tags for releases.</li><li>Bump intentionally via PRs with changelogs.</li><li>Keep submodule paths stable (e.g., external/libA).</li><li>Prefer SSH URLs for private submodules in CI.</li><li>Document the two-step clone in your README:</li></ul><pre>git clone --recurse-submodules git@github.com:org/app.git<br>git submodule update --init --recursive</pre><ul><li>For teams: enable global recursion and submodule diff logs in onboarding docs.</li></ul><h3>A quick cheat sheet</h3><pre># Add<br>git submodule add &lt;url&gt; &lt;path&gt;<br># Clone<br>git clone --recurse-submodules &lt;repo&gt;<br># Init/Update<br>git submodule update --init --recursive<br>git submodule update --remote &lt;path&gt;<br># Track a branch<br>git submodule set-branch --branch main &lt;path&gt;<br># Show status / diff<br>git submodule status<br>git diff --submodule<br># Remove<br>git rm -f &lt;path&gt;<br>rm -rf .git/modules/&lt;path&gt;<br>git config -f .gitmodules --remove-section submodule.&lt;name&gt;</pre><p>If you want independent repos with tight control over versions — and your team can handle a little extra Git ceremony — submodules are a solid, battle-tested choice. Use them deliberately, automate the boring parts, and write down the workflow once so no one has to relearn it under pressure.</p><p>At the end of the day, Git submodules aren’t magic — but they do save you a ton of headaches if you learn their quirks and set up your workflow right. If you treat them like intentional dependencies and help your team get comfortable with the commands, you’ll spend less time fighting merge chaos and more time building cool stuff. Give submodules a shot, document what works for you, and don’t be afraid to tweak your approach as your projects grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4995fff74035" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scalable Self-Hosted GitHub Actions Runners on AWS ECS: Step-by-Step Deployment Guide]]></title>
            <link>https://medium.com/@nitishgangwar/scalable-self-hosted-github-actions-runners-on-aws-ecs-step-by-step-deployment-guide-c673f2f09bd3?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c673f2f09bd3</guid>
            <category><![CDATA[self-hosted-runner]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Sat, 11 Oct 2025 19:25:52 GMT</pubDate>
            <atom:updated>2025-10-11T19:25:52.765Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to deploy cost-effective, multi-repository GitHub runners using containers and Infrastructure as Code</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dHUZjdZAvxD7u31YTzpZqA.png" /></figure><h4>Introduction</h4><p>GitHub Actions has revolutionized CI/CD workflows, but GitHub-hosted runners come with limitations: restricted compute resources, limited customization, and potential security constraints for enterprise environments. Self-hosted runners offer a solution, but managing them at scale across multiple repositories can be challenging.</p><p>In this comprehensive guide, I’ll walk you through building a robust, scalable solution that deploys self-hosted GitHub Actions runners on AWS ECS, capable of serving multiple repositories simultaneously while maintaining cost efficiency and operational excellence.</p><h3>The Problem: GitHub Runner Management at Scale</h3><p>When working with multiple repositories in an enterprise environment where you don’t have access to create runners at organization level, you quickly encounter several challenges:</p><ul><li>Resource Limitations: GitHub-hosted runners have limited CPU, memory, and storage</li><li>Cost Management: Per-minute billing can become expensive for compute-intensive workflows</li><li>Security Requirements: Need for custom security tools, private dependencies, and network access</li><li>Operational Overhead: Managing individual runners for each repository becomes unwieldy</li><li>Scaling Issues: Manual scaling doesn’t meet varying workload demands</li></ul><h3>The Solution: Multi-Repository ECS Runners</h3><p>Our solution addresses these challenges with a containerized approach that:</p><p>✅ Manages multiple repositories from a single container instance<br>✅ Scales automatically based on demand using ECS auto-scaling<br>✅ Reduces costs through efficient resource sharing<br>✅ Maintains security with proper IAM roles and network isolation<br>✅ Ensures reliability with graceful shutdown and parallel de-registration</p><h3>Architecture Overview</h3><p>The solution consists of several key components:</p><h4>1. Container Infrastructure</h4><ul><li>Base Image: Ubuntu 22.04 with GitHub Actions runner</li><li>Multi-Architecture: Supports both x86_64 and ARM64 architectures</li><li>Dependencies: AWS CLI, Docker, Node.js, Python, and essential build tools</li><li>Security: Updated CA certificates and SSL configuration</li></ul><h4>2. AWS ECS Setup</h4><ul><li>Dedicated ECS Cluster: Isolated environment for GitHub runners</li><li>Fargate Launch Type: Serverless container management</li><li>Auto Scaling: Dynamic scaling based on CPU utilization</li><li>CloudWatch Logging: Centralized log management</li></ul><h4>3. Multi-Runner Management</h4><ul><li>Parallel Registration: Simultaneous runner setup for multiple repositories</li><li>State Tracking: Maintains runner state and health information</li><li>Graceful Shutdown: Proper cleanup and de-registration on container termination</li><li>Error Handling: Robust retry logic and timeout management</li></ul><h3>Implementation Deep Dive</h3><p>Let’s explore the key components of our implementation:</p><h4>Dockerfile: Building the Runner Image</h4><pre>FROM ubuntu:22.04<br># Avoid prompts from apt<br>ENV DEBIAN_FRONTEND=noninteractive<br># Install comprehensive dependencies<br>RUN apt-get update &amp;&amp; apt-get install -y \\<br>    curl wget git jq build-essential \\<br>    libssl-dev libffi-dev python3 python3-pip \\<br>    nodejs npm docker.io unzip tar gzip \\<br>    ca-certificates gnupg sudo openssl \\<br>    postgresql-client &amp;&amp; rm -rf /var/lib/apt/lists/*<br># Install AWS CLI v2<br>RUN wget -O &quot;awscliv2.zip&quot; &quot;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&quot; \\<br>    &amp;&amp; unzip awscliv2.zip &amp;&amp; ./aws/install \\<br>    &amp;&amp; rm -rf awscliv2.zip aws<br># Create runner user with Docker access<br>RUN useradd -m -s /bin/bash runner &amp;&amp; \\<br>    usermod -aG docker runner &amp;&amp; \\<br>    echo &#39;runner ALL=(ALL) NOPASSWD:ALL&#39; &gt;&gt; /etc/sudoers<br># Download GitHub Actions runner (multi-architecture support)<br>ARG RUNNER_VERSION=2.311.0<br>RUN ARCH=$(uname -m) &amp;&amp; \\<br>    if [ &quot;$ARCH&quot; = &quot;aarch64&quot; ]; then RUNNER_ARCH=&quot;arm64&quot;; \\<br>    else RUNNER_ARCH=&quot;x64&quot;; fi &amp;&amp; \\<br>    wget -O actions-runner.tar.gz \\<br>    https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz \\<br>    &amp;&amp; tar xzf actions-runner.tar.gz &amp;&amp; rm actions-runner.tar.gz<br>COPY multi-runner.sh /home/runner/multi-runner.sh<br>RUN chmod +x /home/runner/multi-runner.sh<br>ENTRYPOINT [&quot;/home/runner/multi-runner.sh&quot;]</pre><h4>Multi-Runner Script: The Heart of the Solution</h4><p>The core logic handles multiple repositories through a sophisticated bash script:</p><p>1. Parallel Runner Registration</p><pre># Register runners for all repositories simultaneously<br>register_runners_parallel() {<br>    echo &quot;🚀 Starting parallel runner registration for ${#REPO_ARRAY[@]} repositories...&quot;<br>    local pids=()<br>  <br>    for repo in &quot;${REPO_ARRAY[@]}&quot;; do<br>        echo &quot;🔄 Launching registration for $repo...&quot;<br>        register_single_runner &quot;$repo&quot; &amp;<br>        pids+=($!)<br>    done<br>  <br>    # Wait for all registrations to complete<br>    for pid in &quot;${pids[@]}&quot;; do<br>        if wait &quot;$pid&quot;; then<br>            echo &quot;✅ Registration process $pid completed successfully&quot;<br>        else<br>            echo &quot;❌ Registration process $pid failed&quot;<br>        fi<br>    done<br>}</pre><p>2.State Management and Health Tracking</p><pre># Maintain runner state for proper cleanup<br>track_runner_state() {<br>    local repo=&quot;$1&quot;<br>    local runner_name=&quot;$2&quot; <br>    local pid=&quot;$3&quot;<br>    local workdir=&quot;$4&quot;<br>  <br>    # Store runner information for shutdown handling<br>    echo &quot;$repo|$runner_name|$pid|$workdir|$(date +%s)&quot; &gt;&gt; &quot;$ACTIVE_RUNNERS_FILE&quot;<br>}</pre><p>3. Graceful Shutdown with Parallel De-registration</p><pre># Enhanced cleanup with parallel de-registration<br>cleanup() {<br>    echo &quot;🧹 Starting graceful cleanup and de-registration process...&quot;<br>  <br>    # Step 1: Stop all runner processes<br>    stop_all_runner_processes<br>  <br>    # Step 2: De-register all runners in parallel<br>    local runners_to_deregister=()<br>    # ... collect runner information ...<br>  <br>    # Launch parallel de-registration<br>    for runner_info in &quot;${runners_to_deregister[@]}&quot;; do<br>        deregister_runner_async &quot;$repo&quot; &quot;$runner_name&quot; &quot;$workdir&quot; &amp;<br>        pids+=($!)<br>    done<br>  <br>    # Wait for completion with timeout<br>    wait_for_parallel_completion &quot;${pids[@]}&quot;<br>}</pre><h4>CloudFormation Infrastructure</h4><p>The AWS infrastructure is defined using CloudFormation for reproducible deployments:</p><h4>ECS Cluster and Service Configuration</h4><pre># Dedicated ECS Cluster<br>rGitHubRunnerECSCluster:<br>  Type: AWS::ECS::Cluster<br>  Properties:<br>    ClusterName: !Ref pECSCluster<br>    CapacityProviders: [FARGATE]<br>    DefaultCapacityProviderStrategy:<br>      - CapacityProvider: FARGATE<br>        Weight: 1<br># Task Definition with proper resource allocation<br>rGitHubRunnerTaskDefinition:<br>  Type: AWS::ECS::TaskDefinition<br>  Properties:<br>    Family: github-multi-runners<br>    NetworkMode: awsvpc<br>    RequiresCompatibilities: [FARGATE]<br>    Cpu: 8192        # 8 vCPUs for multiple concurrent runners<br>    Memory: 16384    # 16GB RAM for build-intensive workloads<br>    StopTimeout: 120 # Allow time for graceful shutdown</pre><h4>Auto Scaling Configuration</h4><pre># CPU-based auto scaling<br>rGitHubRunnerScalingTarget:<br>  Type: AWS::ApplicationAutoScaling::ScalableTarget<br>  Properties:<br>    MaxCapacity: !Ref pMaxTaskCount<br>    MinCapacity: 1<br>    ResourceId: !Sub &quot;service/${rGitHubRunnerECSCluster}/${pECSService}&quot;<br>    ScalableDimension: ecs:service:DesiredCount<br>    ServiceNamespace: ecs<br>rGitHubRunnerScaleUpPolicy:<br>  Type: AWS::ApplicationAutoScaling::ScalingPolicy<br>  Properties:<br>    PolicyType: TargetTrackingScaling<br>    TargetTrackingScalingPolicyConfiguration:<br>      PredefinedMetricSpecification:<br>        PredefinedMetricType: ECSServiceAverageCPUUtilization<br>      TargetValue: 70<br>      ScaleOutCooldown: 300<br>      ScaleInCooldown: 600</pre><h4>CI/CD Pipeline: Automated Deployment</h4><p>The solution includes two GitHub Actions workflows for complete automation:</p><p>1. Container Image Deployment</p><pre>name: &quot;Deploy GitHub Runners Container Image&quot;<br>jobs:<br>  build_and_push_image:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Build and push multi-architecture image<br>        run: |<br>          docker buildx build --platform linux/amd64,linux/arm64 \\<br>            --build-arg RUNNER_VERSION=$RUNNER_VERSION \\<br>            -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \\<br>            --push ./GitHub_Runners/<br>      <br>      - name: Force ECS deployment<br>        run: |<br>          aws ecs update-service \\<br>            --cluster github-runners-cluster \\<br>            --service github-runners-service \\<br>            --force-new-deployment</pre><p>2. Infrastructure Deployment</p><pre>name: &quot;Deploy GitHub Multi-Repository Runners Infrastructure&quot;<br>jobs:<br>  deploy_infrastructure:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Deploy CloudFormation stack<br>        run: |<br>          aws cloudformation deploy \\<br>            --template-file github_multi_runner_ecs.yaml \\<br>            --stack-name github-runners-infrastructure \\<br>            --capabilities CAPABILITY_IAM \\<br>            --parameter-overrides file://params.yaml</pre><h3>Key Features and Benefits</h3><h4>Cost Optimization</h4><ul><li>Resource Sharing: One container serves multiple repositories</li><li>Auto Scaling: Scales down during low usage periods</li><li>Efficient Scheduling: Optimized task placement and resource utilization</li></ul><h4>Operational Excellence</h4><ul><li>Parallel Processing: Simultaneous runner registration and de-registration</li><li>State Management: Tracks runner health and status</li><li>Graceful Shutdown: Proper cleanup prevents orphaned runners</li><li>Comprehensive Logging: CloudWatch integration for monitoring</li></ul><h4>Security and Compliance</h4><ul><li>IAM Integration: Fine-grained permissions using AWS IAM roles</li><li>Network Isolation: Private subnets with security group controls</li><li>Secrets Management: AWS Systems Manager Parameter Store integration</li><li>Regular Updates: Automated base image updates with latest security patches</li></ul><h4>Scalability and Reliability</h4><ul><li>Multi-Architecture Support: Works on both x86_64 and ARM64 instances</li><li>Auto Scaling: Dynamic scaling based on workload demands</li><li>Health Checks: Container and application-level health monitoring</li><li>Disaster Recovery: Infrastructure as Code enables quick recovery</li></ul><h3>Performance Optimizations</h3><h4>Parallel De-registration</h4><p>The solution implements parallel de-registration to minimize shutdown times:</p><p>Before (Sequential): 5 repos × 20 seconds = 100 seconds<br>After (Parallel): All 5 repos simultaneously = ~30 seconds<br>Time Savings: 70% reduction in shutdown time</p><h4>Resource Efficiency</h4><ul><li>Memory Optimization: Shared dependencies reduce per-runner overhead</li><li>CPU Utilization: Intelligent scheduling maximizes compute efficiency</li><li>Storage Management: Efficient cleanup prevents disk space issues</li></ul><h3>Monitoring and Observability</h3><p>The solution includes comprehensive monitoring capabilities:</p><h4>CloudWatch Integration</h4><pre># Centralized logging configuration<br>LogConfiguration:<br>  LogDriver: awslogs<br>  Options:<br>    awslogs-group: /ecs/github-multi-runners<br>    awslogs-region: !Ref AWS::Region<br>    awslogs-stream-prefix: multi-runner</pre><h4>Health Monitoring</h4><ul><li>Container Health: ECS service health checks</li><li>Application Health: Runner process monitoring</li><li>Resource Utilization: CPU and memory metrics</li><li>Custom Metrics: Runner registration success/failure rates</li></ul><h3>Security Considerations</h3><h4>IAM Roles and Permissions</h4><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;: [<br>        &quot;ssm:GetParameter&quot;,<br>        &quot;ssm:GetParameters&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;arn:aws:ssm:*:*:parameter/github/*&quot;<br>    }<br>  ]<br></pre><h4>Network Security</h4><ul><li>Private Subnets: Runners operate in private network segments</li><li>Security Groups: Restrictive ingress/egress rules</li><li>VPC Endpoints: Secure AWS service communication</li><li>NAT Gateway: Controlled internet access for package downloads</li></ul><h3>Best Practices and Lessons Learned</h3><h4>Container Design</h4><ul><li>Use multi-stage builds to minimize image size</li><li>Implement proper signal handling for graceful shutdowns</li><li>Include comprehensive dependency management</li><li>Regular security updates and vulnerability scanning</li></ul><h4>State Management</h4><ul><li>Maintain runner state files for reliable cleanup</li><li>Implement retry logic for API calls</li><li>Use proper timeout mechanisms</li><li>Track runner lifecycle events</li></ul><h4>Error Handling</h4><ul><li>Implement comprehensive retry logic for GitHub API calls</li><li>Handle network timeouts gracefully</li><li>Provide detailed logging for troubleshooting</li><li>Fail fast on critical configuration errors</li></ul><h3>Performance Tuning</h3><ul><li>Optimize parallel processing for registration/de-registration</li><li>Use appropriate CPU/memory allocations</li><li>Implement efficient auto-scaling policies</li><li>Monitor and tune resource utilization</li></ul><h3>Cost Analysis</h3><p>Based on real-world usage, here’s a cost comparison:</p><ol><li><em>GitHub Hosted Runner:<br></em>Standard Plan: $0.008 per minute for Linux runners<br>Monthly cost(for 5 repos, ~1000 minutes each): ~$40–50</li></ol><p>2. <em>Self-hosted ECS solution:<br> </em>ECS Fargate: ~25–30/month for baseline capacity</p><p><strong>Cost Savings</strong>: 20–25% reduction with additional benefits of customization and control</p><h3>Getting Started</h3><h4>Prerequisites</h4><ul><li>AWS Account with appropriate IAM permissions</li><li>GitHub organization with repository access</li><li>GitHub Personal Access Token with runner management permissions</li><li>AWS CLI and Docker installed locally</li></ul><h4>Quick Start</h4><ol><li>Clone the repository containing the GitHub_Runners configuration</li><li>Configure parameters in the params.yaml file:</li></ol><pre>pGitHubOrg: &quot;your-organization&quot;<br>pGitHubRepositories: &quot;repo1,repo2,repo3&quot;<br>pRunnerLabels: &quot;ecs,aws,custom-runner&quot;</pre><ol><li>Deploy infrastructure using the provided CloudFormation template</li><li>Build and push the container image using the GitHub Actions workflow</li><li>Monitor deployment through CloudWatch logs and ECS console</li></ol><h4>Configuration Options</h4><pre># Resource allocation (adjust as per workload)<br>pContainerCpu: 8192        # 8 vCPUs <br>pContainerMemory: 16384    # 16GB RAM<br>pInitialTaskCount: 1       # Starting capacity<br>pMaxTaskCount: 3           # Maximum scale-out</pre><h3>Advanced Scenarios</h3><h4>Multi-Environment Deployment</h4><p>Support multiple environments (dev/staging/prod) with environment-specific configurations:</p><pre># Env-specific params<br>environments:<br>  dev:<br>    instance_count: 1<br>    cpu: 2048<br>    memory: 4096<br>  prod:<br>    instance_count: 2<br>    cpu: 8192 <br>    memory: 16384</pre><h4>Custom Runner Labels</h4><p>Specify runners for different workloads:</p><pre># Add workload-specific labels<br>RUNNER_LABELS=&quot;ecs,aws,docker,nodejs,python,gpu&quot;</pre><h3>Conclusion</h3><p>Self-hosted GitHub Actions runners on AWS ECS provide a powerful, cost-effective, and secure solution for scalable CI/CD needs. This approach drives:</p><p>✅ Reduced operational overhead<br>✅ Improved cost efficiency<br>✅ Enhanced security with AWS integration<br>✅ Automatic workload scaling<br>✅ High reliability through error handling</p><p>Using Infrastructure as Code, containerization, and parallel processing, organizations can tailor the solution to their specific demands for optimized workflow performance.</p><p><em>Have questions or suggestions? Feel free to comment below with your experiences implementing self-hosted GitHub runners!</em></p><p>Tags: #GitHub #AWS #ECS #DevOps #CICD #Containers #Infrastructure #CloudFormation #Automation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c673f2f09bd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Power of AI with Model Context Protocol (MCP)]]></title>
            <link>https://medium.com/@nitishgangwar/unlocking-the-power-of-ai-with-model-context-protocol-mcp-4e9d7088148c?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e9d7088148c</guid>
            <category><![CDATA[ai-future-trends]]></category>
            <category><![CDATA[ai-integration]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Fri, 23 May 2025 17:18:35 GMT</pubDate>
            <atom:updated>2025-05-23T17:41:03.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking the Power of AI with Model Context Protocol (MCP): A Beginner’s Guide</h3><h4>Discover How MCP is Revolutionizing AI Integration and Efficiency</h4><p>Hey there, tech enthusiasts! 👋</p><p>Today, let’s dive into something that’s revolutionizing the way AI applications interact with data: the <strong>Model Context Protocol (MCP)</strong>. Whether you’re a seasoned developer or just curious about the latest in AI, this article will break down MCP in simple terms.</p><h4>What is MCP?</h4><p>Imagine MCP as a universal adapter for AI applications. Just like how a USB-C port connects various devices, MCP connects AI models to different data sources and tools effortlessly. It’s designed to make AI smarter and more efficient by providing a standardized way to access and use information.</p><h4>Why MCP Matters</h4><ol><li><strong>Standardization</strong>: MCP offers a consistent method for AI models to interact with various data sources. This eliminates the need for custom solutions for each new integration, making development faster and easier.</li><li><strong>Efficiency</strong>: By breaking down data silos, MCP allows AI systems to access and utilize data more effectively. This leads to smarter, faster, and more connected AI applications.</li><li><strong>Scalability</strong>: MCP helps build AI systems that can scale better, which is crucial for fields like software development and data analysis.</li></ol><h4>How MCP Works</h4><p>MCP uses a client-server architecture. Here’s a simple breakdown:</p><ul><li><strong>Client</strong>: The AI application sends requests to the MCP server.</li><li><strong>Server</strong>: The MCP server processes these requests and returns the necessary data or actions.</li></ul><p>Think of it as a super-efficient middleman ensuring your AI gets exactly what it needs.</p><h4>Real-World Applications</h4><p>MCP is already making a difference in various areas:</p><ul><li><strong>Chatbots</strong>: MCP helps chatbots access and retrieve information from different databases or APIs, making them more responsive and useful.</li><li><strong>Coding Assistants</strong>: Tools like Cursor, an AI-powered code editor, use MCP to connect with servers that provide code snippets, documentation, or other resources.</li></ul><h4>Getting Started with MCP</h4><p>Interested in using MCP? Here are some steps to get you started:</p><ol><li><strong>Set Up MCP Servers</strong>: Configure MCP servers within your applications to handle specific tasks like reading files or querying databases. Here are some helpful resources to get you started with setting up MCP servers:</li><li><strong>Use Open-Source Servers</strong>: There are several open-source MCP servers available, such as those for summarizing chat messages or managing emails.</li></ol><h4>Building Your Own MCP Server</h4><p>Feeling adventurous? You can build your own MCP server by following these steps:</p><ol><li><strong>Check Official Documentation</strong>: Refer to the <a href="https://modelcontextprotocol.io/introduction">official MCP documentation</a> for guidelines and SDKs in languages like Python or Java.</li><li><strong>Define Server Tasks</strong>: Decide what tasks your server will handle and implement the necessary code.</li><li><strong>Test with Clients</strong>: Test your server with MCP clients to ensure it works as expected.</li></ol><h4>Conclusion</h4><p>MCP is paving the way for smarter, more connected AI applications. By providing a standardized and efficient way to access and use data, MCP is helping developers build AI systems that are more powerful and scalable. Whether you’re an AI enthusiast, a developer, or just someone who loves tech, MCP is definitely something to keep an eye on.</p><p>Feel free to share your thoughts or experiences with MCP in the comments below. Let’s keep the conversation going!</p><p>I hope this article helps you understand MCP better. If you have any questions or need more details, just let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e9d7088148c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated PR Compliance and Release Workflow on GitHub]]></title>
            <link>https://medium.com/@nitishgangwar/automated-pr-compliance-and-release-workflow-on-github-02fe4c8a1d6d?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/02fe4c8a1d6d</guid>
            <category><![CDATA[pull-request]]></category>
            <category><![CDATA[release-management]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[conventional-commits]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Sat, 17 May 2025 12:42:16 GMT</pubDate>
            <atom:updated>2025-05-17T12:42:16.572Z</atom:updated>
            <content:encoded><![CDATA[<h4>Streamline your development process using GitHub Actions and commit standards</h4><figure><img alt="GitHub Release Management" src="https://cdn-images-1.medium.com/max/1024/0*yFO0RezSO2tH4F4t.png" /></figure><h3>Introduction</h3><p>This document serves as a comprehensive guide for contributors to gitHub repositories, outlining essential practices and tools to ensure a smooth and efficient workflow. By adhering to the guidelines presented here, contributors will not only enhance the quality of their contributions but also foster collaboration and maintain consistency across the project. This guide covers the use of conventional commits, pull request templates, code ownership, and automated workflows for validation and release management.</p><h3>Process flow</h3><p>Users commit changes following conventional commit standards in their feature branches, and a commit-msg hook ensures compliance. After making all necessary changes, users create a Pull Request (PR) to merge their <em>feature</em> branch into the <em>main</em> branch. At this point, the PR template comes into play, providing users with a pre-filled PR description. GitHub automatically populates the PR title based on the commit messages; however, users must adhere to the title format specified in the commented section of the PR template.</p><p>Once the user submits the PR with all required details, the semantic.yaml workflow is triggered to validate the title. If the title conforms to the established conventions, the workflow passes. If not, the user must update the title, and the workflow will run again to ensure compliance. Successful workflow execution is essential for merging changes into the main branch, as enforced by branch protection rules.</p><p>After all checks are completed, a reviewer — designated in the CODEOWNERS file — will review and approve the PR. The user can then merge the changes and close the PR. Upon closing the PR, the release.yaml workflow is triggered to create the release, corresponding tag, and release notes in GitHub.</p><h3>1. Ensuring all contributors use conventional commits</h3><h4>1.1 Commit Message Hook</h4><p>To maintain a <a href="https://www.conventionalcommits.org/en/v1.0.0/">standard format</a> for commit messages, implement a commit-msg hook in the .git/hooks/commit-msg directory. This hook will validate commit messages against a predefined regex pattern. The template for the hook should be stored in the .githooks folder, as the .git folder is ignored by Git when pushing to remote repositories.</p><pre>#.githooks/commit-msg<br>#!/bin/sh<br>commit_regex=&quot;^(feat|fix|chore|docs|style|refactor|perf|test|build|ci|revert|major)(\([a-zA-Z0-9\-]+\))?: .+&quot;<br>commit_msg=$(cat &quot;$1&quot;)<br><br>if ! echo &quot;$commit_msg&quot; | grep -Eq &quot;$commit_regex&quot;; then<br>  echo &quot;❌ Commit message does not follow Conventional Commits format.&quot;<br>  echo &quot;See: https://www.conventionalcommits.org/en/v1.0.0/&quot;<br>  echo &quot;Examples:\nfeature: Add login button\nfix: Resolved a bug\nmajor: Innovating the app&quot;<br>  exit 1<br>fi</pre><h4>1.2 Installation Script for Commit Hook</h4><p>Create a script named install_hooks.sh that contributors can execute to copy the commit-msg template from the .githooks folder to the .git/hooks folder. This ensures that all contributors have the necessary hooks installed.</p><pre># install_hooks.sh<br>cp -r .githooks/* .git/hooks/<br>chmod +x .git/hooks/*</pre><h4>1.3 Instructions in README.md</h4><p>In the README.md file of the repository, provide clear instructions for users and contributors to run the install_hooks.sh script to set up the commit hooks.</p><h3>2. Pull Request Template</h3><p>Create a pull request template in the .github folder of the repository, named pull_request_template.md, to guide contributors in providing necessary information when submitting a pull request.</p><pre>&lt;!---<br>Provide a short summary in the Title above. Examples of good and valid PR titles:<br>- &quot;fix: fixing a bug&quot;<br>- &quot;feature: Adding a new catalog&quot;<br>- &quot;major: Innovating the app&quot;<br>--&gt;<br>&lt;!--<br>Other than &#39;Description &amp; motivation&#39; and &#39;Changes&#39;, all other headings are optional. You can delete them if those are irrelevant to your PR.<br>--&gt;<br>## Description &amp; motivation<br>&lt;!---<br>Describe your changes, and why you&#39;re making them.<br>--&gt;<br>## Changes:<br>&lt;!---<br>Jot down all the changes made.<br>Is this linked to JIRA issues, or another pull request? Link it here.<br>--&gt;<br>## To-do before merge<br>&lt;!---<br>(Optional -- remove this section if not needed)<br>Include any notes about things that need to happen before this PR is merged, e.g.:<br>&gt; - [ ] Change the base branch<br>&gt; - [ ] Update dbt Cloud jobs<br>&gt; - [ ] Ensure PR #56 is merged<br>--&gt;<br>## Screenshots:<br>&lt;!---<br>Include a screenshot of the relevant changes/results.<br>--&gt;<br>## Validation/Testing:<br>&lt;!---<br>Include any evidence that confirms that changes do what is expected.<br>--&gt;<br>## Checklist:<br>&lt;!---<br>This checklist is mostly useful as a reminder of small things that can easily be forgotten – it is meant as a helpful tool rather than hoops to jump through.<br>Put an `x` in all the items that apply, make notes next to any that haven&#39;t been addressed, and remove any items that are not relevant to this PR.<br>--&gt;<br>&gt; - [ ] My pull request represents one logical piece of work.<br>&gt; - [ ] My commits are related to the pull request and look clean.<br>&gt; - [ ] My SQL follows the style guide.<br>&gt; - [ ] I have added appropriate tests and documentation.<br>&gt; - [ ] I have validated the changes in lower environments.</pre><h3>3. CODEOWNERS File</h3><p>Create a CODEOWNERS file in the repository to ensure that pull requests are merged only after approval from the approver or review team. You can make it more complex as per your requirements.</p><pre># This is a CODEOWNERS file.<br># Lines starting with &#39;#&#39; are comments.<br># Each line is a file pattern followed by one or more owners.<br># Specify the default code owners for the entire repository<br>* @your-github-username @team-name<br></pre><h3>4. GitHub Actions Workflow for PR validation</h3><p>Create a semantic.yaml GitHub Actions workflow that triggers on pull request events such as <em>opened, edited, reopened, and synchronize</em> on the main branch. This workflow validates the title of the pull request against the established conventions.</p><blockquote>You can add more jobs for PR validation in this workflow as per your requirements</blockquote><pre># .github/workflows/semantic.yml<br>name: Semantic PR Validation<br>on:<br>  pull_request_target:<br>    branches: [main]<br>    types: [opened, edited, reopened, synchronize]<br>jobs:<br>  validate-title:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      pull-requests: write<br>    steps:<br>      - uses: amannn/action-semantic-pull-request@v5<br>        with:<br>        # More types can be used from the list as needed<br>        # feat|fix|chore|docs|style|refactor|perf|test|build|ci|revert|major<br>          types: |<br>            fix<br>            feature<br>            major<br>          headerPattern: &#39;^(\w+): ([A-Z]+-\d+): (.+)$&#39;<br>          headerPatternCorrespondence: type, scope, subject<br>          subjectPattern: ^(?![A-Z]).+$<br>          subjectPatternError: |<br>            Invalid subject format in title: &quot;{title}&quot;.<br>            Subject should start with lowercase and follow format: &quot;fix: JIRA-ID: description&quot;<br>        env:<br>          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}</pre><h4>4.1 Branch Protection Rule</h4><p>Ensure that the validate-title check passes before users can merge changes into the main branch. Update the branch protection rule for the main branch accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkuydYcFN56rVVPnTMM-qg.png" /></figure><h3>5. GitHub Actions Workflow for Release Management</h3><p>Create another GitHub Actions workflow named release.yaml that will create a release in the GitHub repository according to semantic versioning. This workflow uses the type of the PR or commits to determine which octate to update in the release number and generates release notes based on commit messages since the last release.</p><pre>#  .github/workflows/release.yml<br>name: Release<br>on:<br>  pull_request:<br>    branches: [main]<br>    types: [closed]<br>jobs:<br>  release:<br>    if: github.event.pull_request.merged<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout<br>        uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 0<br><br>      - name: Generate Release Notes<br>        id: generate_notes<br>        env:<br>          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}<br>        run: |<br>          # Get previous tag (or default to initial commit)<br>          PREV_TAG=$(git describe --tags --abbrev=0 2&gt;/dev/null || echo &quot;&quot;)<br>          if [ -z &quot;$PREV_TAG&quot; ]; then<br>            # First release: get all commits<br>            COMMITS=$(git log --pretty=format:&quot;- %s (%h) by %an&quot; --invert-grep --grep=&quot;^Merge pull request&quot;)<br>          else<br>            # Get commits since last tag<br>            COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:&quot;- %s (%h) by %an&quot; --invert-grep --grep=&quot;^Merge pull request&quot;)<br>          fi<br><br>          # Get merged PRs since last tag<br>          # PRS=$(gh pr list --state merged --base main --search &quot;merged:&gt;$PREV_TAG&quot; --json number,title,author --jq &#39;.[] | &quot;- #\(.number): \(.title): \(.author)&quot;&#39; 2&gt;/dev/null || echo &quot;No PRs found&quot;)<br><br>          # Format release notes<br>          RELEASE_NOTES=$(cat &lt;&lt; EOF<br>          ### Changes since $PREV_TAG<br><br>          $COMMITS<br>          EOF<br>          )<br><br>          # Set output for use in next step (multiline-safe)<br>          echo &quot;release_notes&lt;&lt;EOF&quot; &gt;&gt; $GITHUB_OUTPUT<br>          echo &quot;$RELEASE_NOTES&quot; &gt;&gt; $GITHUB_OUTPUT<br>          echo &quot;EOF&quot; &gt;&gt; $GITHUB_OUTPUT<br><br>          # Set commit_fragment based on COMMITS content with correct precedence<br>          commit_fragment=&quot;&quot;<br>          if echo &quot;$COMMITS&quot; | grep -q &quot;major:&quot;; then<br>            commit_fragment=&quot;major&quot;<br>          elif echo &quot;$COMMITS&quot; | grep -q &quot;feature:&quot;; then<br>            commit_fragment=&quot;minor&quot;<br>          elif echo &quot;$COMMITS&quot; | grep -q &quot;fix:&quot;; then<br>            commit_fragment=&quot;patch&quot;<br>          fi<br>          echo $commit_fragment<br>          echo &quot;commit_fragment=$commit_fragment&quot; &gt;&gt; $GITHUB_OUTPUT<br><br>      - name: Extract version fragment<br>        id: extract_fragment<br>        run: |<br>          # Get commit_fragment from previous step<br>          OCTATE_COUNT=&quot;${{ steps.generate_notes.outputs.commit_fragment }}&quot;<br><br>          # Get PR title fragment<br>          PR_FRAGMENT=$(echo &quot;${{ github.event.pull_request.title }}&quot; | awk -F: &#39;{print $1}&#39; | xargs)<br><br>          # Map PR fragment to semantic version<br>          if [ &quot;$PR_FRAGMENT&quot; = &quot;fix&quot; ]; then<br>            PR_FRAGMENT=&quot;patch&quot;<br>          elif [ &quot;$PR_FRAGMENT&quot; = &quot;feature&quot; ]; then<br>            PR_FRAGMENT=&quot;minor&quot;<br>          elif [ &quot;$PR_FRAGMENT&quot; = &quot;major&quot; ]; then<br>            PR_FRAGMENT=&quot;major&quot;<br>          else<br>            PR_FRAGMENT=&quot;&quot;<br>          fi<br><br>          COMMIT_FRAGMENT=${{ steps.generate_notes.outputs.commit_fragment }}<br><br>          # Decide final fragment with precedence: major &gt; minor &gt; patch<br>          if [ &quot;$COMMIT_FRAGMENT&quot; = &quot;major&quot; ] || [ &quot;$PR_FRAGMENT&quot; = &quot;major&quot; ]; then<br>            FRAGMENT=&quot;major&quot;<br>          elif [ &quot;$COMMIT_FRAGMENT&quot; = &quot;minor&quot; ] || [ &quot;$PR_FRAGMENT&quot; = &quot;minor&quot; ]; then<br>            FRAGMENT=&quot;minor&quot;<br>          elif [ &quot;$COMMIT_FRAGMENT&quot; = &quot;patch&quot; ] || [ &quot;$PR_FRAGMENT&quot; = &quot;patch&quot; ]; then<br>            FRAGMENT=&quot;patch&quot;<br>          else<br>            echo &quot;Unable to determine version fragment from commits or PR title.&quot;<br>            exit 1<br>          fi<br><br>          echo &quot;fragment=$FRAGMENT&quot; &gt;&gt; $GITHUB_OUTPUT<br>      - name: Get version bump<br>        id: bump<br>        uses: christian-draeger/increment-semantic-version@master<br>        with:<br>          current-version: $(git describe --tags --abbrev=0)<br>          version-fragment: ${{ steps.extract_fragment.outputs.fragment }}<br><br>      - name: Create tag<br>        id: create_tag<br>        run: |<br>          git tag ${{ steps.bump.outputs.next-version }}<br>          git push origin ${{ steps.bump.outputs.next-version }}<br><br>      - name: Create release<br>        id: create_release<br>        uses: softprops/action-gh-release@v1<br>        with:<br>          tag_name: ${{ steps.bump.outputs.next-version }}<br>          name: ${{ steps.bump.outputs.next-version }}<br>          body: ${{ steps.generate_notes.outputs.release_notes }}<br>          prerelease: false<br>          draft: false<br>        env:<br>          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}<br>      - name: Cleanup tag if release creation fails<br>        if: failure() &amp;&amp; steps.bump.outputs.next-version != &#39;&#39;<br>        id: cleanup_unused_tag<br>        run: |<br>          echo &quot;Reverting tag ${{ steps.bump.outputs.next-version }}&quot;<br>          git tag -d ${{ steps.bump.outputs.next-version }}<br>          git push origin --delete ${{ steps.bump.outputs.next-version }}</pre><h3>Conclusion</h3><p>In conclusion, this document is a helpful roadmap for contributors looking to engage with GitHub repositories. By following the practices outlined here — such as utilizing conventional commits, following the pull request template, and recognizing the importance of the CODEOWNERS file — contributors can ensure their contributions meet repository standards.</p><p>Moreover, the integration of automated workflows for title validation and release management simplifies the process, making collaboration smoother and preserving the integrity of our codebase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02fe4c8a1d6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Containers are Designed for One Process Only]]></title>
            <link>https://medium.com/@nitishgangwar/why-containers-are-designed-for-one-process-only-4f651b72a77d?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f651b72a77d</guid>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[architecture-design]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Sat, 10 May 2025 04:04:09 GMT</pubDate>
            <atom:updated>2025-05-10T04:04:09.093Z</atom:updated>
            <content:encoded><![CDATA[<p>Containers have revolutionized the way we develop, deploy, and manage applications. They offer a lightweight, portable, and efficient way to package software, but there’s a common best practice that often puzzles newcomers: running only one process per container. In this article, we’ll explore the reasons behind this design principle and why it matters, along with the principles of container-based application design.</p><h4>Principles of Container-Based Application Design</h4><p>To build effective containerized applications, it’s essential to follow certain design principles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J57-dXR01nCQuPsL" /><figcaption>## Image Credits : Diagram from Kubernetes Blog</figcaption></figure><h4>1. Single Concern</h4><p>Each container should address a single concern and do it well. This principle ensures that containers are focused and efficient.</p><h4>2. Self-Containment</h4><p>A container should rely only on the presence of the Linux kernel. Additional libraries and dependencies should be included within the container itself.</p><h4>3. Image Immutability</h4><p>Container images should be immutable. Once built, they should not change between different environments. This ensures consistency and reliability.</p><h4>4. High Observability</h4><p>Containers must implement necessary APIs to help the platform observe and manage the application effectively. This includes logging, metrics, and health checks.</p><h4>5. Lifecycle Conformance</h4><p>Containers should be able to read events from the platform and react accordingly. This includes handling start, stop, and restart events gracefully.</p><h4>6. Process Disposability</h4><p>Containers should be ephemeral and ready to be replaced by another instance at any time. This aligns with the principles of scalability and fault tolerance.</p><h4>7. Runtime Confinement</h4><p>Containers must declare their resource requirements and restrict usage to those limits. This ensures efficient resource management and prevents overconsumption.</p><h4>The Single-Concern Principle</h4><p>The idea of running a single process per container is rooted in the single-concern principle, which is akin to the single-responsibility principle in software design. This principle suggests that each container should focus on one specific task or service. By adhering to this rule, we can achieve several benefits:</p><h4>1. Isolation and Security</h4><p>Containers are designed to isolate applications from each other and the host system. Running multiple processes in a single container can blur these boundaries, making it harder to manage security and isolation. If one process encounters an issue or becomes compromised, it can affect other processes within the same container.</p><h4>2. Scalability</h4><p>One of the key advantages of containers is their ability to scale horizontally. When each container runs a single process, scaling becomes straightforward. Need more instances of a web server? Simply spin up additional containers. This approach is much more efficient than scaling a container that runs multiple services.</p><h4>3. Maintainability</h4><p>Containers with a single process are easier to maintain and troubleshoot. If a container fails, identifying the root cause is simpler when there’s only one process to consider. This clarity reduces the complexity of debugging and ensures that updates and patches can be applied without affecting other services.</p><h4>4. Reusability</h4><p>Single-process containers are highly reusable. They can be easily integrated into different environments and projects. For example, a container running a database can be reused across multiple applications without modification. This modularity enhances the flexibility and portability of your containerized applications.</p><h4>5. Ephemeral Nature</h4><p>Containers are meant to be ephemeral, meaning they can be created, destroyed, and recreated quickly. When a container runs a single process, it aligns perfectly with this ephemeral nature. Containers can be replaced or updated without worrying about the state of multiple processes.</p><h4>Conclusion</h4><p>Adhering to the single-process per container principle brings numerous benefits, including improved isolation, scalability, maintainability, reusability, and alignment with the ephemeral nature of containers. Additionally, following the principles of container-based application design ensures that your applications are robust, scalable, and suitable for automation in cloud-native environments.</p><p>By designing containers with these principles in mind, you can leverage the full potential of containerization and build applications that are ready for the challenges of modern cloud infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f651b72a77d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI Explained: How Self-Directed AI is Shaping Our Future]]></title>
            <link>https://medium.com/@nitishgangwar/agentic-ai-explained-how-self-directed-ai-is-shaping-our-future-675403b8b3f2?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/675403b8b3f2</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[real-world-example]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Thu, 01 May 2025 14:05:22 GMT</pubDate>
            <atom:updated>2025-05-01T14:05:22.075Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4ZQK73ghERRvmKIfGdcyg.png" /></figure><p><strong>Introduction</strong><br>AI is changing fast, and one of the most exciting new ideas is <em>Agentic AI</em>. This is a type of AI that can make its own decisions and take actions without being told what to do every time. I spent my last few days to enhance my understanding of Agentic AI and its real-world impact, and I want to share what I learned in a simple and clear way, with real examples you can relate to.</p><h3>1. What Is Agentic AI and Why It Matters</h3><p>Agentic AI is a smart system that can think and act by itself. It can decide what to do, set goals, and learn from its surroundings. This is different from old-fashioned systems that only do what they are programmed to do.</p><p><strong>Example:</strong> Imagine a chatbot that doesn’t just answer your questions, but also helps you with suggestions based on your past behavior — like offering discounts or finding better deals. That’s Agentic AI.</p><p><strong>Why it matters:</strong> It can help businesses and people work smarter by doing things on its own. It can save time, reduce errors, and make better decisions in areas like health, finance, and transport.</p><h3>2. How Agentic AI Learns and Adapts</h3><p>One big strength of Agentic AI is that it learns from experience. Just like people, it can try something, see what happens, and then do better next time.</p><p><strong>Example:</strong> A robot in a warehouse that finds a faster route when something blocks its usual path. Or an online tutor that changes how it teaches depending on how a student is learning.</p><p><strong>How it works:</strong> It uses learning methods like trial-and-error (called reinforcement learning), and also learns patterns from data.</p><h3>3. Tools and Methods Used in Agentic AI</h3><p>To build Agentic AI systems, developers use special tools and techniques:</p><ul><li><strong>Agent-Based Modeling (ABM):</strong> This means creating many small agents and seeing how they interact.</li><li><strong>Cognitive Models:</strong> These help the AI think like humans.</li><li><strong>Multi-agent Systems:</strong> Many agents work together or compete with each other to solve tasks.</li></ul><p><strong>Example:</strong> In traffic systems, each car can act like its own agent, helping to reduce traffic jams by adjusting speed and routes.</p><p><strong>Popular tools:</strong> Software like NetLogo, GAMA, and JADE are used to design and test these systems.</p><h3>4. How Agentic AI Is Built: Architectures</h3><p>An agentic system has a structure, kind of like a brain. One popular model is called BDI:</p><ul><li><strong>Belief:</strong> What the AI knows about the world</li><li><strong>Desire:</strong> What it wants to do</li><li><strong>Intention:</strong> The plan it makes to get things done</li></ul><p><strong>Example:</strong> A smart thermostat that knows you’re home, wants to save energy, and adjusts the temperature accordingly.</p><p><strong>Why it helps:</strong> This kind of setup makes the AI easier to manage, more flexible, and explainable when something goes wrong.</p><h3>5. How Agentic AI Talks to Others</h3><p>When you have many agents, they need to talk to each other. Communication helps them share information, work as a team, and make joint decisions.</p><p><strong>Example:</strong> Drones flying together to deliver packages. They share maps and tasks so they don’t bump into each other or miss deliveries.</p><p><strong>How they talk:</strong> They use special languages like FIPA-ACL, which helps them understand each other’s messages clearly.</p><h3>6. Ethical and Social Concerns</h3><p>When AI systems become more independent, we have to ask important questions:</p><ul><li>Who is to blame if they make a mistake?</li><li>Are their decisions fair to everyone?</li><li>Can we understand how they make choices?</li></ul><p><strong>Example:</strong> If an AI in a hospital recommends a wrong treatment, who is responsible? The developers? The hospital? The AI itself?</p><p><strong>What we need:</strong> We must build AI with ethics in mind from the start, and follow rules that protect people and keep things fair.</p><h3>7. Staying Safe and Secure</h3><p>Agentic AI needs to be safe from hackers and mistakes. It should keep working even when things go wrong.</p><p><strong>Common threats:</strong></p><ul><li>Bad input that confuses the system (adversarial attacks)</li><li>Fake agents pretending to be real ones</li><li>System crashes or wrong decisions</li></ul><p><strong>Example:</strong> A security system that watches for online threats needs to keep working even if one part fails or gets attacked.</p><p><strong>How to protect it:</strong> By testing often, setting safe boundaries, and teaching the system to spot unusual activity.</p><h3>8. What the Future Holds</h3><p>Agentic AI is already starting to show up in many places, and it will only grow more important:</p><ul><li><strong>In healthcare:</strong> AI assistants helping doctors with decisions</li><li><strong>In finance:</strong> Bots that invest money wisely</li><li><strong>In education:</strong> Personalized learning tools</li><li><strong>In transport:</strong> Self-driving cars that make their own decisions</li></ul><p><strong>What’s next:</strong> These systems will get even better by working with other tech like IoT (smart devices) and LLMs (like ChatGPT).</p><p><strong>Big idea:</strong> Agentic AI will move from being tools we use to becoming partners we work with.</p><p><strong>Conclusion</strong><br> Agentic AI is a big step forward. It can think, act, and learn in a way that makes it feel more like a smart helper than just a machine. I’m excited about where this technology is heading and how it can make our lives better, safer, and easier.</p><p><em>Thanks for reading! Feel free to connect if you’re curious about AI, tech trends, or the future of smart systems.</em><br> #AgenticAI #AI #AutonomousSystems #TechEthics #ArtificialIntelligence #LinkedInLearning</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=675403b8b3f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Apache Airflow with Centralized LDAP Authentication]]></title>
            <link>https://medium.com/@nitishgangwar/apache-airflow-centralized-login-ldap-a45773b956d5?source=rss-fcddb73b48e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a45773b956d5</guid>
            <category><![CDATA[ldap-authentication]]></category>
            <category><![CDATA[administration]]></category>
            <category><![CDATA[airflow-setup]]></category>
            <category><![CDATA[apache-airflow]]></category>
            <category><![CDATA[devops-tool]]></category>
            <dc:creator><![CDATA[Nitish Kumar]]></dc:creator>
            <pubDate>Thu, 17 Apr 2025 15:20:55 GMT</pubDate>
            <atom:updated>2025-04-17T15:47:26.069Z</atom:updated>
            <content:encoded><![CDATA[<p>This document serves as an essential resource for establishing a centralized login system for Airflow utilizing LDAP, which is critical for enhancing both security and user management. As organizations increasingly rely on data-driven decision-making, secure access to platforms such as Airflow becomes paramount. LDAP authentication facilitates a seamless login experience while maintaining robust security measures.</p><p>This guide describes the necessary configurations and procedural steps required to enable LDAP authentication on the Apache Airflow webserver. By doing so, it promotes efficient access and role management for your team. Additionally, it offers valuable insights for system administrators and developers aiming to optimize their Airflow environment.</p><h3>Pre-requisites for LDAP Authentication on Apache Airflow Cluster</h3><p>Before enabling LDAP authentication on your Apache Airflow cluster running on ECS containers, ensure that the following prerequisites are met:</p><ol><li><strong>Apache Airflow Setup</strong>: Ensure that your Apache Airflow cluster is properly set up on ECS containers or platform of your choice, it could be EC2, Azure VM or on-premise host. This includes having the Airflow webserver and scheduler containers running, as well as the Celery executor containers configured for task execution.</li><li><strong>Python-LDAP Module</strong>: The python-ldap module must be installed in the Airflow virtual environment. This module is essential for enabling LDAP authentication. You can install it using pip:<br><strong>pip install python-ldap</strong></li><li>Configuration of webserver_config.py: You need to update the webserver_config.py file located in your Airflow setup. This file contains the necessary configurations for LDAP authentication. Ensure that you replace the placeholder values with actual values specific to your LDAP setup.</li><li><strong>Network Access</strong>: Ensure that your ECS containers have network access to the LDAP server. This may involve configuring security groups and network ACLs to allow traffic on the required ports.</li><li><strong>Testing Environment</strong>: It is advisable to test the LDAP authentication in a non-production environment before deploying it to production. This helps in identifying any configuration issues without affecting the live system.</li></ol><p>By ensuring these prerequisites are met, you can smoothly enable LDAP authentication for your Apache Airflow cluster on ECS containers.</p><h3>Steps to enable LDAP authentication on LDAP AF main server</h3><p>To enable LDAP authentication on Airlfow, LDAP auth method is used in webserver_config.py file of Airflow webserver. For more authentication methods and details, please follow <a href="https://airflow.apache.org/docs/apache-airflow/1.10.1/security.html?highlight=ldap">Apache’s official documentation</a>.</p><ul><li>Update the content of “webserver_config.py” file on Airflow webserver. This file can usually be found in airflow home (~/airflow).</li></ul><p>Replace the parameters with the actual values in the file.</p><ol><li>&lt;password&gt; : Use the password for an account you’re using for connecting to your ldap server.</li></ol><p>2. &lt;LDAP_SEARCH_FILETR&gt; :</p><pre>(|(memberOf=cn=group1,ou=Universal Groups,ou=Groups,dc=example,dc=com)<br>(memberOf=cn=group2,ou=Universal Groups,ou=Groups,dc=example,dc=com)<br>(memberOf=cn=group3,ou=Universal Groups,ou=Groups,dc=example,dc=com)<br>(memberOf=cn=group4,ou=Universal Groups,ou=Groups,dc=example,dc=com))</pre><p>3. &lt;Auth_roles_mapping&gt;:</p><pre><br>{<br> &quot;CN=group1,OU=Universal Groups,OU=Groups,DC=example,DC=com&quot;: [&quot;Admin&quot;],<br> &quot;CN=group2,OU=Universal Groups,OU=Groups,DC=example,DC=com&quot;: [&quot;User&quot;]<br>}</pre><p>Sample webserver_config.py</p><pre><br># Licensed to the Apache Software Foundation (ASF) under one<br># or more contributor license agreements.  See the NOTICE file<br># distributed with this work for additional information<br># regarding copyright ownership.  The ASF licenses this file<br># to you under the Apache License, Version 2.0 (the<br># &quot;License&quot;); you may not use this file except in compliance<br># with the License.  You may obtain a copy of the License at<br>#<br>#   http://www.apache.org/licenses/LICENSE-2.0<br>#<br># Unless required by applicable law or agreed to in writing,<br># software distributed under the License is distributed on an<br># &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY<br># KIND, either express or implied.  See the License for the<br># specific language governing permissions and limitations<br># under the License.<br>&quot;&quot;&quot;Default configuration for the Airflow webserver&quot;&quot;&quot;<br>import os<br><br>#from flask_appbuilder.security.manager import AUTH_DB<br><br>from flask_appbuilder.security.manager import AUTH_LDAP<br># from flask_appbuilder.security.manager import AUTH_OAUTH<br># from flask_appbuilder.security.manager import AUTH_OID<br># from flask_appbuilder.security.manager import AUTH_REMOTE_USER<br><br><br>basedir = os.path.abspath(os.path.dirname(__file__))<br><br># Flask-WTF flag for CSRF<br>WTF_CSRF_ENABLED = True<br><br># ----------------------------------------------------<br># AUTHENTICATION CONFIG<br># ----------------------------------------------------<br># For details on how to set up each of the following authentication, see<br># http://flask-appbuilder.readthedocs.io/en/latest/security.html# authentication-methods<br># for details.<br><br># The authentication type<br># AUTH_OID : Is for OpenID<br># AUTH_DB : Is for database<br># AUTH_LDAP : Is for LDAP<br># AUTH_REMOTE_USER : Is for using REMOTE_USER from web server<br># AUTH_OAUTH : Is for OAuth<br><br><br># Uncomment to setup Full admin role name<br># AUTH_ROLE_ADMIN = &#39;Admin&#39;<br><br># Uncomment to setup Public role name, no authentication needed<br># AUTH_ROLE_PUBLIC = &#39;Public&#39;<br><br># self registration<br># AUTH_USER_REGISTRATION = True<br><br># The recaptcha it&#39;s automatically enabled for user self registration is active and the keys are necessary<br># RECAPTCHA_PRIVATE_KEY = PRIVATE_KEY<br># RECAPTCHA_PUBLIC_KEY = PUBLIC_KEY<br><br># Config for Flask-Mail necessary for user self registration<br># MAIL_SERVER = &#39;smtp.gmail.com&#39;<br># MAIL_USE_TLS = True<br># MAIL_USERNAME = &#39;yourappemail@gmail.com&#39;<br># MAIL_PASSWORD = &#39;passwordformail&#39;<br># MAIL_DEFAULT_SENDER = &#39;sender@gmail.com&#39;<br><br># The default user self<br># AUTH_USER_REGISTRATION_ROLE = &quot;Public&quot;<br><br># When using OAuth Auth, uncomment to setup provider(s) info<br># Google OAuth example:<br># OAUTH_PROVIDERS = [{<br>#   &#39;name&#39;:&#39;google&#39;,<br>#     &#39;token_key&#39;:&#39;access_token&#39;,<br>#     &#39;icon&#39;:&#39;fa-google&#39;,<br>#         &#39;remote_app&#39;: {<br>#             &#39;api_base_url&#39;:&#39;https://www.googleapis.com/oauth2/v2/&#39;,<br>#             &#39;client_kwargs&#39;:{<br>#                 &#39;scope&#39;: &#39;email profile&#39;<br>#             },<br>#             &#39;access_token_url&#39;:&#39;https://accounts.google.com/o/oauth2/token&#39;,<br>#             &#39;authorize_url&#39;:&#39;https://accounts.google.com/o/oauth2/auth&#39;,<br>#             &#39;request_token_url&#39;: None,<br>#             &#39;client_id&#39;: GOOGLE_KEY,<br>#             &#39;client_secret&#39;: GOOGLE_SECRET_KEY,<br>#         }<br># }]<br><br># When using LDAP Auth, setup the ldap server<br>AUTH_TYPE = AUTH_LDAP<br>AUTH_LDAP_SERVER = &quot;ldaps://xyz.example.com:3269&quot;<br>AUTH_LDAP_USE_TLS = False<br><br># registration configs<br>AUTH_USER_REGISTRATION = True  # allow users who are not already in the FAB DB<br>AUTH_USER_REGISTRATION_ROLE = &quot;User&quot;  # this role will be given in addition to any AUTH_ROLES_MAPPING<br>AUTH_LDAP_FIRSTNAME_FIELD = &quot;givenName&quot;<br>AUTH_LDAP_LASTNAME_FIELD = &quot;sn&quot;<br>AUTH_LDAP_EMAIL_FIELD = &quot;mail&quot;  # if null in LDAP, email is set to: &quot;{username}@email.notfound&quot;<br><br>AUTH_LDAP_SEARCH = &quot;dc=example,dc=com&quot;  # the LDAP search base<br>AUTH_LDAP_SEARCH_FILTER=&quot;(|(memberOf=cn=group1,ou=Universal Groups,ou=Groups,dc=example,dc=com)(memberOf=cn=group2,ou=Universal Groups,ou=Groups,dc=example,dc=com)(memberOf=cn=group3,ou=Universal Groups,ou=Groups,dc=example,dc=com)(memberOf=cn=group4,ou=Universal Groups,ou=Groups,dc=example,dc=com))&quot;<br>AUTH_LDAP_UID_FIELD = &quot;cn&quot;  # the username (&quot;common name&quot;) field<br>AUTH_LDAP_BIND_USER = &quot;cn=BindUser,ou=Domain Accounts,dc=example,dc=com&quot;<br>AUTH_LDAP_BIND_PASSWORD = &quot;&lt;password&gt;&quot;  # the special bind password for search<br><br><br># a mapping from LDAP DN to a list of FAB roles<br># NOTE: Values are case sensitive, use the exact DN string as it is in LDAP<br>AUTH_ROLES_MAPPING = {<br> &quot;CN=group1,OU=Universal Groups,OU=Groups,DC=example,DC=com&quot;: [&quot;Admin&quot;],<br> &quot;CN=group2,OU=Universal Groups,OU=Groups,DC=example,DC=com&quot;: [&quot;User&quot;]<br>}<br><br># the LDAP user attribute which has their role DNs<br>AUTH_LDAP_GROUP_FIELD = &quot;memberOf&quot;<br><br># if we should replace ALL the user&#39;s roles each login, or only on registration<br>AUTH_ROLES_SYNC_AT_LOGIN = True<br><br># force users to re-auth after 30min of inactivity (to keep roles in sync)<br>PERMANENT_SESSION_LIFETIME = 1800<br><br># When using OpenID Auth, uncomment to setup OpenID providers.<br># example for OpenID authentication<br># OPENID_PROVIDERS = [<br>#    { &#39;name&#39;: &#39;Yahoo&#39;, &#39;url&#39;: &#39;https://me.yahoo.com&#39; },<br>#    { &#39;name&#39;: &#39;AOL&#39;, &#39;url&#39;: &#39;http://openid.aol.com/&lt;username&gt;&#39; },<br>#    { &#39;name&#39;: &#39;Flickr&#39;, &#39;url&#39;: &#39;http://www.flickr.com/&lt;username&gt;&#39; },<br>#    { &#39;name&#39;: &#39;MyOpenID&#39;, &#39;url&#39;: &#39;https://www.myopenid.com&#39; }]<br><br># ----------------------------------------------------<br># Theme CONFIG<br># ----------------------------------------------------<br># Flask App Builder comes up with a number of predefined themes<br># you can use for Apache Airflow.<br># http://flask-appbuilder.readthedocs.io/en/latest/customizing.html#changing-themes<br># Please make sure to remove &quot;navbar_color&quot; configuration from airflow.cfg<br># in order to fully utilize the theme. (or use that property in conjunction with theme)<br># APP_THEME = &quot;bootstrap-theme.css&quot;  # default bootstrap<br># APP_THEME = &quot;amelia.css&quot;<br># APP_THEME = &quot;cerulean.css&quot;<br># APP_THEME = &quot;cosmo.css&quot;<br># APP_THEME = &quot;cyborg.css&quot;<br># APP_THEME = &quot;darkly.css&quot;<br># APP_THEME = &quot;flatly.css&quot;<br>#.css&quot;<br># APP_THEME = &quot;lumen.css&quot;<br># APP_THEME = &quot;paper.css&quot;<br># APP_THEME = &quot;readable.css&quot;<br># APP_THEME = &quot;sandstone.css&quot;<br># APP_THEME = &quot;simplex.css&quot;<br># APP_THEME = &quot;slate.css&quot;<br># APP_THEME = &quot;solar.css&quot;<br># APP_THEME = &quot;spacelab.css&quot;<br># APP_THEME = &quot;superhero.css&quot;<br># APP_THEME = &quot;united.css&quot;<br># APP_THEME = &quot;yeti.css&quot;</pre><ul><li>After updating the webserver_config.py file, restart your Airflow services to enable LDAP authentication for your users. If you&#39;re running Airflow in non-root mode on ECS, recreate your container to refresh the services.</li></ul><p>By following the steps outlined in this document, you have successfully configured Airflow to enable LDAP authentication. This setup ensures secure and streamlined user management, leveraging your existing LDAP directory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a45773b956d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>