<?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 Chamod Tharuka on Medium]]></title>
        <description><![CDATA[Stories by Chamod Tharuka on Medium]]></description>
        <link>https://medium.com/@chamodtharuka45?source=rss-24ee6759c54e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*piRFIApdiZhsA1OO</url>
            <title>Stories by Chamod Tharuka on Medium</title>
            <link>https://medium.com/@chamodtharuka45?source=rss-24ee6759c54e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:31:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chamodtharuka45/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[How I Built a Production-Ready Self-Hosted Password Manager on AWS for Under $15/Month]]></title>
            <link>https://medium.com/@chamodtharuka45/how-i-built-a-production-ready-self-hosted-password-manager-on-aws-for-under-15-month-76895c07369b?source=rss-24ee6759c54e------2</link>
            <guid isPermaLink="false">https://medium.com/p/76895c07369b</guid>
            <category><![CDATA[bitwarden]]></category>
            <category><![CDATA[vaultwarden]]></category>
            <category><![CDATA[password-manager]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[self-hosted]]></category>
            <dc:creator><![CDATA[Chamod Tharuka]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 16:10:18 GMT</pubDate>
            <atom:updated>2026-07-13T16:10:18.737Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Replacing expensive SaaS password managers with an open-source, production-ready solution using Vaultwarden, Docker, Nginx, and AWS.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0v9K39QW0ZB2CQDR9QYvg.png" /></figure><h3>Introduction</h3><p>Every development team reaches a point where sharing passwords becomes a serious problem.</p><p>Database credentials.</p><p>AWS access keys.</p><p>Third-party API tokens.</p><p>SSH credentials.</p><p>Production server logins.</p><p>At first, teams usually rely on Slack messages, emails, spreadsheets, or shared documents. It works… until it doesn’t.</p><p>Our team had reached that stage.</p><p>We wanted something that was:</p><ul><li>Secure</li><li>Affordable</li><li>Easy to maintain</li><li>Under our control</li><li>Compatible with desktop, browser, and mobile devices</li></ul><p>Instead of paying recurring subscription fees to a cloud password manager, I decided to build our own infrastructure.</p><p>The result was a production-ready Vaultwarden deployment running on AWS for less than <strong>$15 per month</strong>.</p><p>This article shares the architecture, security decisions, lessons learned, and why self-hosting was the right choice for our team.</p><h3>Why We Didn’t Choose a Cloud Password Manager</h3><p>There are plenty of excellent password managers available today.</p><ul><li>Bitwarden</li><li>1Password</li><li>LastPass</li></ul><p>They are simple to use and require almost zero maintenance.</p><p>However, we wanted something different.</p><p>We wanted:</p><ul><li>Complete ownership of our data</li><li>No vendor lock-in</li><li>Unlimited users</li><li>Infrastructure we fully control</li><li>Open-source software</li><li>Lower long-term operational costs</li></ul><p>Since our team already manages AWS infrastructure every day, maintaining one small server wasn’t a problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*0dY_Uf52kKtX_S6sZEc6EQ.png" /><figcaption><em>Comparison of cloud password managers versus a self-hosted Vaultwarden deployment.</em></figcaption></figure><h3>Why Vaultwarden?</h3><p>Vaultwarden is a lightweight Rust implementation compatible with Bitwarden clients.</p><p>That means we still get:</p><ul><li>Browser extensions</li><li>Mobile applications</li><li>Desktop applications</li><li>Auto-fill support</li><li>Password generation</li><li>Organizations</li><li>Shared collections</li></ul><p>But the server belongs entirely to us.</p><p>No third-party company stores our secrets.</p><p>No subscription grows every time we hire another developer.</p><h3>Infrastructure Overview</h3><p>I wanted something simple.</p><p>No Kubernetes.</p><p>No managed databases.</p><p>No unnecessary complexity.</p><p>The final architecture looked like this:</p><p>Everything runs inside a single EC2 instance.</p><p>For our team size, this keeps operational costs low while remaining easy to maintain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*fJQZpDzAVS7seIY8CHABpw.png" /><figcaption><em>High-level architecture showing Cloudflare, AWS EC2, Nginx, Docker, Vaultwarden, SQLite, and automated backups.</em></figcaption></figure><h3>AWS Infrastructure</h3><p>The infrastructure is intentionally lightweight.</p><p><strong>Server</strong></p><ul><li>Amazon EC2 t3.micro</li><li>Amazon Linux</li><li>Docker Engine</li><li>Nginx</li><li>Let’s Encrypt SSL</li><li>SQLite Database</li></ul><p>Storage requirements are surprisingly small.</p><p>Even after onboarding multiple users, database size remained tiny because Vaultwarden stores encrypted text rather than large binary data.</p><p>Monthly infrastructure cost stayed around <strong>$10–15</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwAfwwcuYUdrtGsLZ-PrEg.png" /></figure><h3>Docker Made Deployment Simple</h3><p>One reason I enjoy Docker is repeatability.</p><p>Deploying Vaultwarden required only a single container.</p><p>Benefits included:</p><ul><li>Easy upgrades</li><li>Automatic restart</li><li>Portable deployment</li><li>Simple rollback</li><li>Minimal maintenance</li></ul><p>Instead of installing packages directly onto the operating system, everything stayed isolated inside Docker.</p><p>This makes future upgrades significantly safer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlH4e3rRM03NvwtDKq8P6Q.png" /><figcaption><em>Docker container list showing the running Vaultwarden container.</em></figcaption></figure><h3>Nginx as the Reverse Proxy</h3><p>Nginx handles everything entering the server.</p><p>Responsibilities include:</p><ul><li>HTTPS termination</li><li>TLS configuration</li><li>HTTP to HTTPS redirect</li><li>Security headers</li><li>Reverse proxy</li><li>Rate limiting</li></ul><p>Using Nginx also allowed me to separate application logic from web server responsibilities.</p><p>That keeps the overall design much cleaner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOrwIhBZnADIgubIPkdECQ.png" /><figcaption><em>Nginx reverse proxy configuration with SSL enabled.</em></figcaption></figure><h3>Advanced Access Control: Geographic Blocking + Admin IP Whitelist</h3><p>After deploying Vaultwarden, we implemented a two-tier access control system to restrict access based on geography and IP address.</p><p><strong>Tier 1: Public Access (Developers in Sri Lanka)</strong><br>CloudFlare geolocation rule blocks all non-Sri Lankan traffic:</p><p>CloudFlare Rule: “Block non-Sri Lanka vault only”</p><ul><li>Condition: Country ≠ LK (not in Sri Lanka)</li><li>Condition: URI path does not contain /admin</li><li>Action: Block</li></ul><p>Result: Only developers physically located in Sri Lanka can access the vault.</p><p><strong>Tier 2: Admin Access (System Administrator)</strong><br>Nginx enforces IP-based access control on the /admin path:</p><p><em>location /admin {<br> allow [ADMIN_IP_ADDRESS];<br> deny all;<br> proxy_pass </em><a href="http://127.0.0.1:8080/"><em>http://127.0.0.1:8080</em></a><em>;<br>}</em></p><p>Result: Only the authorized system administrator IP can access the admin panel.</p><p><strong>Why Two Layers?</strong><br>Defense in Depth:</p><ul><li>CloudFlare blocks geographic attacks at the edge</li><li>Nginx provides secondary IP verification</li><li>If one fails, the other protects the system</li><li>Admin access is isolated from public access</li></ul><p>This approach eliminated the need for VPN complexity while maintaining enterprise-grade access control.</p><h3>Security Was the Highest Priority</h3><p>A password manager must be designed around security.</p><p>I implemented multiple independent layers rather than relying on a single control.</p><h3>Layer 1 — Network Security</h3><p>AWS Security Groups only expose:</p><ul><li>HTTP</li><li>HTTPS</li><li>SSH (restricted)</li></ul><p>Everything else remains closed.</p><p>Cloudflare also hides the origin server and provides additional protection.</p><h3>Layer 2 — HTTPS Everywhere</h3><p>Traffic is encrypted using Let’s Encrypt certificates.</p><p>Nginx enforces HTTPS while adding modern security headers.</p><p>Every communication between users and Vaultwarden is encrypted.</p><h3>Layer 3 — Application Security</h3><p>Vaultwarden already provides excellent security features.</p><p>We enabled:</p><ul><li>Strong master passwords</li><li>Two-factor authentication</li><li>Organization management</li><li>Role-based permissions</li><li>Audit logging</li></ul><p>Only the user’s master password can decrypt stored secrets.</p><p>Even the server cannot read password contents.</p><h3>Layer 4 — Database Protection</h3><p>Vaultwarden stores encrypted data inside SQLite.</p><p>Even if someone obtained the database file, the information would remain encrypted.</p><p>Without each user’s master password, the stored secrets are useless.</p><h3>Layer 5 — Backup Strategy</h3><p>Infrastructure isn’t complete without backups.</p><p>Every night:</p><ul><li>Database backup</li><li>Compression</li><li>Retention cleanup</li><li>Logging</li></ul><p>Recovery takes only a few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*N8fwC7_YRL1JkDfd3vzTGA.png" /><figcaption><em>Five-layer security model used in the Vaultwarden deployment.</em></figcaption></figure><h3>Team Collaboration</h3><p>One feature our developers immediately appreciated was Organizations.</p><p>Instead of sharing passwords manually, we created logical collections.</p><p>Examples included:</p><ul><li>Production Servers</li><li>AWS Credentials</li><li>Databases</li><li>Third-Party APIs</li><li>Development Environment</li></ul><p>New developers receive access based on their role.</p><p>No more sending passwords over Slack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p7-5RTbRzFLL-16o1b2BXQ.png" /><figcaption><em>Vaultwarden Organization dashboard showing shared collections.</em></figcaption></figure><h3>Browser Extension Experience</h3><p>One of the biggest advantages of Vaultwarden is compatibility with official Bitwarden clients.</p><p>Developers simply:</p><ul><li>Install the browser extension</li><li>Connect it to our server</li><li>Login once</li><li>Auto-fill passwords everywhere</li></ul><p>From the user’s perspective, it behaves exactly like the hosted Bitwarden service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPWZMPUqAs4_dCM4TtBv4w.png" /><figcaption><em>Browser extension connected to the self-hosted Vaultwarden instance.</em></figcaption></figure><h3>Automated Backups</h3><p>Backups are one of those things nobody appreciates until disaster strikes.</p><p>Every day the server automatically:</p><ul><li>Creates a database snapshot</li><li>Compresses it</li><li>Keeps historical copies</li><li>Removes expired backups</li></ul><p>No manual work required.</p><p>If the server fails tomorrow, recovery is straightforward.</p><p><strong>Expand it to explain two-tier backup strategy:</strong></p><p>Add details about:</p><ol><li>Local 30-day backups (quick recovery)</li><li>S3 off-site backups (disaster recovery)</li><li>How they work together</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*TVaDprnQbBHU6cGb6eDAzg.png" /><figcaption>Defense-in-depth backup architecture: Daily automated snapshots <br>maintain 30-day local retention for rapid recovery while S3 archives <br>provide permanent disaster recovery redundancy.</figcaption></figure><h3>Lessons Learned</h3><p>Several interesting lessons came from this project.</p><h3>Keep Infrastructure Simple</h3><p>Not every application needs Kubernetes.</p><p>For a small engineering team, Docker plus EC2 was more than enough.</p><h3>Security Is Built in Layers</h3><p>No single feature makes a system secure.</p><p>Real security comes from combining:</p><ul><li>Network controls</li><li>Encryption</li><li>Authentication</li><li>Access management</li><li>Monitoring</li><li>Backups</li></ul><h3>Open Source Can Be Production Ready</h3><p>Vaultwarden proved to be incredibly stable.</p><p>Despite running on minimal infrastructure, performance remained excellent.</p><h3>Documentation Matters</h3><p>The technical implementation only took a couple of hours.</p><p>Writing proper documentation took significantly longer.</p><p>Future maintenance becomes much easier because every architectural decision has been documented.</p><h3>Cost Breakdown</h3><p>Monthly infrastructure costs remained approximately:</p><ul><li>EC2 Instance</li><li>EBS Storage</li><li>Domain</li><li>SSL (Free)</li><li>Docker (Free)</li><li>Vaultwarden (Free)</li></ul><p>Total monthly cost stayed below <strong>$15</strong>.</p><p>Compared with recurring SaaS subscriptions, the long-term savings become substantial.</p><p>More importantly, the team owns the entire platform.</p><h3>Final Thoughts</h3><p>This project reminded me that DevOps is not just about automation.</p><p>It’s about building reliable systems that solve real business problems.</p><p>Vaultwarden gave our team:</p><ul><li>Better security</li><li>Complete data ownership</li><li>Lower operational costs</li><li>Easier credential management</li><li>Production-ready reliability</li></ul><p>Sometimes the best solution isn’t buying another SaaS product.</p><p>Sometimes it’s building exactly what your team needs.</p><p>If you’re comfortable managing AWS infrastructure and Docker containers, I highly recommend trying Vaultwarden.</p><p>It may become one of the most valuable internal services your engineering team uses every day.</p><h3>What I’d Improve Next</h3><p>If I were building Version 2, I’d consider adding:</p><ul><li>High Availability with multiple EC2 instances</li><li>Infrastructure as Code using Terraform</li><li>Monitoring with Prometheus and Grafana</li><li>Automated CI/CD deployment pipeline</li><li>Disaster recovery testing</li></ul><p>Infrastructure should continuously evolve, and that’s one of the most enjoyable parts of being a DevOps Engineer.</p><p>Thanks for reading.</p><p>If you’re building similar infrastructure or have questions about Vaultwarden, AWS, Docker, or DevOps, I’d love to hear your thoughts in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76895c07369b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Multi-Tenant AI Knowledge Base SaaS with Azure, FastAPI, and RAG]]></title>
            <link>https://medium.com/@chamodtharuka45/building-a-multi-tenant-ai-knowledge-base-saas-with-azure-fastapi-and-rag-8ee9ab36e69b?source=rss-24ee6759c54e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ee9ab36e69b</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[ai-search]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Chamod Tharuka]]></dc:creator>
            <pubDate>Mon, 25 May 2026 14:17:26 GMT</pubDate>
            <atom:updated>2026-05-25T14:36:32.010Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkFo38rSksnZ4P9Dwbz-mg.png" /></figure><p>Every company has knowledge buried inside PDFs, HR policies, onboarding documents, and internal wikis — but finding the right answer still takes too long.</p><p>Customer support teams repeatedly answer the same questions. Employees search through dozens of documents just to find one policy. Most business knowledge remains disconnected from the tools people use daily.</p><p>To solve this, I built BotBase — a multi-tenant AI chatbot platform that allows businesses to upload documents and instantly create AI-powered assistants using Retrieval-Augmented Generation (RAG).</p><p>The platform supports:</p><ul><li>AI chatbots trained on custom knowledge bases</li><li>PDF, DOCX, and TXT ingestion</li><li>Embeddable website widgets</li><li>Domain-based licensing</li><li>Multi-tenant isolation</li><li>Azure-native deployment infrastructure</li></ul><p>In this article, I’ll walk through the architecture, RAG pipeline, deployment strategy, and lessons learned while building the platform.</p><h3>Why I Built BotBase</h3><p>I wanted to explore how modern AI infrastructure could be combined with scalable SaaS architecture using Azure managed services.</p><p>Rather than building a simple chatbot demo, I focused on solving real engineering problems:</p><ul><li>Multi-tenant bot isolation</li><li>Secure embeddable widgets</li><li>Domain-level licensing</li><li>Vector search at scale</li><li>Automated cloud deployments</li><li>Reliable document ingestion pipelines</li></ul><p>The goal was to build something production-oriented instead of another proof-of-concept AI app.</p><h3>Production Architecture on Azure</h3><h4>Solution</h4><p>To make the platform scalable and production-ready, I deployed the system using a cloud-native Azure architecture. The platform uses Azure Container Apps, Azure AI Search, Cosmos DB, Storage Accounts, Key Vault, and Container Registry to power the AI workflow and multi-tenant infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IBQ1a2MMYrVeJXZ2dbQtvQ.png" /></figure><ul><li>Azure Container Apps → backend deployment</li><li>Azure AI Search → RAG search layer</li><li>Cosmos DB → chatbot data storage</li><li>Storage Account → file/document storage</li><li>Container Registry → Docker images</li><li>Key Vault → secrets management</li><li>Static Web App → frontend hosting</li><li>Log Analytics → monitoring</li></ul><h4>The RAG Pipeline</h4><p>At the core of BotBase is a Retrieval-Augmented Generation (RAG) pipeline.</p><p>Instead of fine-tuning a model, the system retrieves relevant document chunks in real time and provides them as context to GPT-4o. This approach allows knowledge bases to update instantly whenever new documents are uploaded.</p><p>The ingestion pipeline follows four stages:</p><p><strong>1. Text Extraction</strong></p><p>Uploaded PDFs, DOCX files, and TXT documents are parsed into plain text using Python-based extractors.</p><p><strong>2. Chunking Strategy</strong></p><p>Documents are split into overlapping chunks before indexing.</p><p>The overlap is important because semantic meaning is often spread across neighboring sentences. Without overlap, context can be lost between chunks.</p><p><strong>3. Vector Embeddings</strong></p><p>Each chunk is converted into a vector embedding using OpenAI’s embedding model.</p><p>These embeddings allow semantically similar content to be discovered even when wording differs from the original document.</p><p><strong>4. Azure AI Search Indexing</strong></p><p>Each bot receives a dedicated Azure AI Search index using HNSW vector search.</p><p>This allows low-latency semantic retrieval across thousands of document chunks.</p><h3>Challenges I Faced</h3><p>Building the platform surfaced several interesting engineering challenges.</p><h4>PDF Parsing Inconsistencies</h4><p>Different PDF structures produce inconsistent extraction results. Some files contained broken line spacing, missing characters, or unreadable layouts that required fallback handling.</p><h4>Chunk Size Tuning</h4><p>Finding the right chunk size was more important than expected. Chunks that were too small lost context, while larger chunks reduced retrieval precision.</p><h4>Widget Compatibility</h4><p>The embeddable widget needed to work across WordPress, Laravel, React, and static HTML sites without dependency conflicts.</p><p>This was one of the reasons I chose Vanilla JavaScript over React for the widget itself.</p><h4>Multi-Tenant Isolation</h4><p>Each bot required isolated vector indexes, domain validation, and document storage to prevent cross-tenant data leakage.</p><h4>Resilience in the Upload Pipeline</h4><p>The ingestion flow was designed to fail gracefully. Even if vector indexing failed temporarily, document metadata would still be stored safely for retry processing.</p><h3>What I Learned</h3><h4>RAG Is Extremely Practical for Business Applications</h4><p>For rapidly changing knowledge bases, RAG is often more flexible than fine-tuning. Uploading a new document updates the assistant immediately without retraining.</p><h4>Azure Managed Services Accelerate Development</h4><p>Azure AI Search, Cosmos DB, and Container Apps removed much of the operational complexity typically associated with AI infrastructure.</p><h4>Vanilla JavaScript Still Has a Place</h4><p>For embeddable widgets, minimizing dependencies and avoiding framework conflicts was more valuable than using a modern frontend framework.</p><h4>CI/CD Matters Early</h4><p>Automated deployments significantly reduced friction during rapid iteration and infrastructure changes.</p><h3>Final Thoughts</h3><p>BotBase started as an experiment to combine AI-powered retrieval with scalable SaaS architecture, but it quickly became a practical exploration of how modern cloud services can accelerate AI application development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*69S57n0S1NtY3NCamCuxYw.png" /></figure><p>The project helped me gain deeper hands-on experience with:</p><ul><li>Azure AI Search</li><li>Cosmos DB</li><li>Container Apps</li><li>CI/CD automation</li><li>Multi-tenant SaaS design</li><li>Embeddable frontend architecture</li><li>Retrieval-Augmented Generation (RAG)</li></ul><p>There’s still more to improve — including analytics, conversation memory, and white-label support — but the platform already demonstrates how quickly production-grade AI systems can be built using modern managed infrastructure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee9ab36e69b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built a Full DevOps CI/CD Pipeline for a WordPress Agency]]></title>
            <link>https://medium.com/@chamodtharuka45/how-i-built-a-full-devops-ci-cd-pipeline-for-a-wordpress-agency-806627a007ed?source=rss-24ee6759c54e------2</link>
            <guid isPermaLink="false">https://medium.com/p/806627a007ed</guid>
            <dc:creator><![CDATA[Chamod Tharuka]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 11:28:49 GMT</pubDate>
            <atom:updated>2026-04-27T06:29:21.253Z</atom:updated>
            <content:encoded><![CDATA[<p>How I Built a Full DevOps CI/CD Pipeline for a WordPress Agency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLrrtW521kmoyXUUE_zhIQ.png" /></figure><h3>Introduction</h3><p>Running a WordPress agency means managing multiple client projects simultaneously. Developers push code, someone manually copies files to the server, activates the theme, clears cache — and repeats this for every single update. It’s slow, error-prone, and not scalable.</p><p>I decided to fix this. Here’s how I built a complete DevOps pipeline for our agency that reduced deployment time from 15 minutes of manual work to a single git push.</p><h3>The Problem</h3><p>Before this system, our workflow looked like this:</p><ul><li>Developer finishes feature</li><li>Manually FTP/SCP files to server</li><li>Login to WP Admin → activate theme</li><li>Clear cache manually</li><li>No code quality checks</li><li>No monitoring</li><li>No standardization across projects</li></ul><p>With 6 developers and multiple client projects, this was becoming unmanageable.</p><h3>The Solution: Automated CI/CD Pipeline</h3><p>Here’s what I built:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcpQaKasN3NEh2ZnEA7Y8w.png" /></figure><p><strong>Infrastructure:</strong></p><ul><li><strong>AWS EC2 (t3.small)</strong> — Staging server running CloudPanel</li><li><strong>AWS EC2 (t3.micro)</strong> — SonarQube code quality scanner</li><li><strong>AWS Lightsail ($10/month)</strong> — Production server running Docker</li><li><strong>Grafana Cloud (Free)</strong> — Server monitoring and alerts</li><li><strong>Cloudflare</strong> — DNS management with wildcard subdomain</li></ul><p><strong>Tools:</strong></p><ul><li>GitHub Actions — CI/CD pipeline</li><li>SonarQube Community Edition — Code quality</li><li>CloudPanel — Multiple WordPress staging sites</li><li>Docker + Nginx + MySQL + Redis — Production stack</li><li>WP-CLI — Theme activation automation</li></ul><h3>Architecture</h3><p>Every client project gets:</p><pre>[client].dev.enfection.com     → Staging (CloudPanel)<br>[client].[domain].com          → Production (Lightsail + Docker)</pre><p>Branch strategy:</p><pre>staging    → auto deploy to staging server<br>production → auto deploy to Lightsail<br>main       → safety backup only</pre><h3>The Pipeline</h3><p>When a developer pushes to the staging branch:</p><p><strong>Step 1 — SonarQube Scan (~1–2 min)</strong></p><ul><li>Scans PHP code for bugs, security issues, bad practices</li><li>If critical issues found → pipeline blocked</li><li>Results visible at sonarqube.enfection.com</li></ul><p><strong>Step 2 — Deploy to Staging (~30–40 sec)</strong></p><ul><li>SCP theme files to staging server</li><li>rsync to CloudPanel WordPress directory</li><li>WP-CLI activates theme automatically</li><li>Cache flushed automatically</li><li>Staging site updated ✅</li></ul><p>When DevOps approves → merge to production branch:</p><p><strong>Step 3 — Deploy to Production</strong></p><ul><li>SCP theme files to Lightsail</li><li>Docker container updated</li><li>WP-CLI activates theme</li><li>Redis cache cleared</li><li>Live site updated ✅</li></ul><h3>New Project Setup — From 15 Minutes to 10 Seconds</h3><p>Previously, setting up a new client project took 15+ minutes of manual work. Now it’s one command:</p><pre>scripts/new-project.sh rocell &quot;Rocell Website&quot; developerUsername</pre><p>This automatically:</p><ul><li>Creates private GitHub repository under company org</li><li>Pushes all CI/CD files (deploy.yml, sonar config, docker files)</li><li>Creates 3 branches (main, staging, production)</li><li>Adds 11 GitHub secrets automatically</li><li>Sends GitHub invite to developer</li></ul><p>Total time: <strong>10 seconds</strong> ✅</p><h3>Production Stack — Optimized Docker</h3><p>The production server runs a fully optimized Docker stack:</p><pre>Services:<br>  - MySQL 8.0        (512MB RAM limit, InnoDB tuned)<br>  - WordPress PHP-FPM (512MB RAM limit, 10 workers)<br>  - Nginx Alpine      (128MB, Gzip + security headers)<br>  - Redis 7           (128MB, WordPress object cache)<br>  - Grafana Alloy     (128MB, metrics + log shipping)</pre><p>Total RAM usage: ~1.4GB out of 2GB Lightsail instance.</p><p>Performance improvements:</p><ul><li>Redis cache → 3–5x faster page loads</li><li>Gzip compression → 70% less bandwidth</li><li>Static file caching → 30 day browser cache</li><li>PHP-FPM tuned workers → better concurrency</li></ul><h3>Monitoring — Grafana Cloud</h3><p>Every production server ships metrics and logs to Grafana Cloud:</p><ul><li>CPU, RAM, Disk, Network → Linux Node dashboard</li><li>Nginx access logs → Loki log explorer</li><li>Alerts: CPU &gt;80%, Disk &gt;85%, Server down</li></ul><p>All servers visible in one dashboard with instance dropdown.</p><h3>Developer Experience</h3><p>Developer receives a simple handover message:</p><pre>GitHub Repo:  github.com/Enfection-Dev-Lab/rocell-wordpress-theme<br>Branch:       staging<br>Staging Site: https://rocell.dev.enfection.com<br>WP Admin:     https://rocell.dev.enfection.com/wp-admin</pre><p>Their daily workflow:</p><pre>git add .<br>git commit -m &quot;feat: update hero section&quot;<br>git push origin staging<br># ✅ That&#39;s it. Everything else is automatic.</pre><h3>Documentation</h3><p>Everything is documented at docs.dev.enfection.com built with MkDocs Material — separate guides for DevOps and Developers. The docs site itself is deployed via CI/CD (push to main → auto deploy to CloudPanel static site).</p><h3>Cost Breakdown</h3><pre>Staging EC2 (t3.small)    ~$15/month  — all client staging sites<br>SonarQube EC2 (t3.micro)  ~$8/month   — code quality<br>Lightsail per project      $10/month   — production<br>Grafana Cloud              Free<br>Total base cost:           ~$23/month</pre><h3>What’s Next</h3><ul><li>Production domain SSL automation with Certbot</li><li>Database backup automation</li><li>Slack/WhatsApp deployment notifications</li><li>Multi-region production support</li></ul><h3>Conclusion</h3><p>This system transformed how our agency delivers WordPress projects. Code quality is enforced automatically, deployments are instant and reliable, and developers can focus on building instead of managing servers.</p><p>The entire infrastructure is open source at: github.com/Enfection-Dev-Lab/wordpress-devops-infrastructure</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=806627a007ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Single EC2 to Scalable, Secure AWS Architecture]]></title>
            <link>https://medium.com/@chamodtharuka45/from-single-ec2-to-scalable-secure-aws-architecture-6fc563e6f646?source=rss-24ee6759c54e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fc563e6f646</guid>
            <dc:creator><![CDATA[Chamod Tharuka]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 06:07:14 GMT</pubDate>
            <atom:updated>2026-04-21T14:15:20.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJto2687vXdgdtjsfvIiNg.jpeg" /></figure><h3>A Real-World WordPress Infrastructure Upgrade</h3><h3>Introduction</h3><p>Recently, I had the opportunity to redesign and modernize a production-grade WordPress infrastructure on AWS.</p><p>The previous setup was relatively simple — a single EC2 instance behind an Application Load Balancer. While it was functional, it lacked scalability, resilience, and production-level security practices.</p><p>This project became my first <strong>end-to-end infrastructure transformation</strong> in a live production environment, covering architecture redesign, performance optimization, and security hardening.</p><h3>The Initial Architecture</h3><p>The original setup included:</p><ul><li>Single EC2 instance</li><li>Application Load Balancer</li><li>Local media storage</li><li>Database hosted on the same instance</li><li>Limited scalability</li></ul><h3>Key Limitations</h3><ul><li>Single point of failure</li><li>Manual deployment process</li><li>Limited performance optimization</li><li>Increased operational risk</li></ul><h3>The New Architecture — Production-Ready Design</h3><p>The upgraded architecture was designed with scalability, security, and reliability in mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fr5lHtD_xmwrtsZpy1hFgw.png" /><figcaption>Production-ready AWS architecture for WordPress — designed for high availability, scalability, security, and performance.</figcaption></figure><h3>1) High Availability Layer</h3><ul><li>3 EC2 instances</li><li>Application Load Balancer</li><li>Health checks with automatic traffic routing</li></ul><p><strong>Outcome:</strong><br> Improved fault tolerance and horizontal scalability, ensuring minimal downtime even if an instance fails.</p><h3>2) Managed Database Layer</h3><ul><li>Amazon RDS for MySQL</li></ul><p><strong>Key Benefits:</strong></p><ul><li>Automated backups</li><li>Managed patching</li><li>Improved reliability</li><li>Clear separation of concerns</li></ul><h3>3) Caching Layer (Performance Optimization)</h3><ul><li>Amazon ElastiCache (Valkey)</li><li>Deployed within private subnets</li><li>No public internet access</li></ul><p><strong>Impact:</strong></p><ul><li>Reduced database load</li><li>Faster response times</li><li>Improved WordPress performance</li></ul><p><strong>Security Note:</strong><br> The cache layer is strictly private and communicates only within the VPC, aligning with production security best practices.</p><h3>4) Static Content Optimization</h3><ul><li>Amazon S3 for media storage</li><li>CloudFront CDN for global content delivery</li></ul><p><strong>Result:</strong></p><ul><li>Reduced load on EC2 instances</li><li>Faster global content delivery</li><li>Improved user experience</li></ul><h3>5) Security Hardening</h3><p>A multi-layered security approach was implemented:</p><ul><li>Ubuntu Pro (ESM) for OS-level security updates</li><li>CrowdStrike for endpoint protection</li><li>Qualys for vulnerability scanning</li><li>Firewall and security group configuration</li><li>Custom SSL certificate</li><li>Web Application Firewall (WAF)</li></ul><p><strong>Approach:</strong><br> Adopted a <strong>defense-in-depth strategy</strong> to secure the infrastructure at every layer.</p><h3>6) CI/CD Automation</h3><ul><li>GitHub Actions for deployment pipelines</li></ul><p><strong>Improvements:</strong></p><ul><li>Version-controlled deployments</li><li>Automated workflows</li><li>Consistent releases</li><li>Reduced human error</li></ul><h3><strong>7) Automated Backup Strategy</strong></h3><p>To ensure production resilience, we implemented a centralized backup plan using <strong>AWS Backup Service</strong> covering all critical infrastructure components.</p><ul><li><strong>EC2 Instances</strong> — Weekly automated snapshots every Saturday at 2:30 AM (Asia/Colombo), with a 7-day retention policy managed by AWS Backup Service</li><li><strong>RDS Database</strong> — Daily automated backups with 7-day Point-in-Time Recovery (PITR) enabled</li><li><strong>S3 Buckets</strong> — Continuous versioning enabled across all production and staging buckets</li><li><strong>ElastiCache (Valkey)</strong> — Daily automated snapshots with 7-day retention</li></ul><p>All backups are automatically deleted after the retention period — no manual cleanup required.</p><pre>┌──────────────────┬────────────┬───────────┬───────────┬──────────────┐<br>│ Service          │ Type       │ Frequency │ Retention │ Cost         │<br>├──────────────────┼────────────┼───────────┼───────────┼──────────────┤<br>│ EC2 (2 servers)  │ AWS Backup │ Weekly    │ 7 days    │ ~$10/month   │<br>│ RDS (Production) │ Automated  │ Daily     │ 7 days    │ FREE         │<br>│ S3 Buckets       │ Versioning │ Real-time │ Unlimited │ ~$2/month    │<br>│ ElastiCache      │ Automated  │ Daily     │ 7 days    │ ~$2/month    │<br>└──────────────────┴────────────┴───────────┴───────────┴──────────────┘<br>Total estimated backup cost: ~$14/month</pre><blockquote><em>For a production system serving real users, $14/month for complete automated backup coverage is a straightforward investment in reliability.</em></blockquote><h3>Architecture Improvements Achieved</h3><p>✔ Improved fault tolerance<br> ✔ Horizontal scalability<br> ✔ Eliminated single point of failure<br> ✔ Enhanced performance through caching<br> ✔ Secure private network architecture<br> ✔ Automated CI/CD pipeline<br> ✔ Clear separation of application, database, and cache layers</p><h3>Key Lessons Learned</h3><p>This project provided hands-on experience in:</p><ul><li>AWS networking (public vs private subnets)</li><li>Designing secure and scalable architectures</li><li>Optimizing WordPress for production environments</li><li>Implementing real-world security best practices</li><li>Managing CI/CD in live systems</li><li>Thinking beyond development — towards infrastructure design</li></ul><h3>Final Thoughts</h3><p>This project marked my first complete infrastructure transformation in a production environment — from redesigning architecture to implementing performance and security improvements.</p><p>It reinforced the importance of building systems that are not only functional, but also scalable, secure, and reliable.</p><p>Looking forward to continuing my journey in <strong>Cloud and DevOps Engineering</strong> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fc563e6f646" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>