<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on mahroot's blog</title><link>https://mahroot.dev/posts/</link><description>Recent content in Blog on mahroot's blog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>Ayoub</managingEditor><lastBuildDate>Thu, 19 Mar 2026 23:33:57 +0100</lastBuildDate><item><title>Day 0 - linux primitives that make k8s possible</title><link>https://mahroot.dev/posts/day-0---linux-primitives-that-make-k8s-possible/</link><pubDate>Thu, 19 Mar 2026 23:33:57 +0100</pubDate><guid>https://mahroot.dev/posts/day-0---linux-primitives-that-make-k8s-possible/</guid><description>&lt;h2 id="so-what-what-happen-when-we-install-k8s-"&gt;so what what happen when we install k8s ?&lt;/h2&gt;
&lt;p&gt;when we install k8s actually we get this processes
we can separate them logically (they are not separated physically like not namespaces or something)
they are just have a different roles :&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Our Physical Machine (or VM)
│
├── Control plan processes ← just Linux processes
│ ├── etcd (a process)
│ ├── kube-apiserver (a process)
│ ├── kube-scheduler (a process)
│ └── kube-controller-manager (a process)
│
└── Worker Node processes ← also just Linux processes
├── kubelet (a process)
├── kube-proxy (a process)
└── containerd (a process)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="so-what-is-a-node-"&gt;so what is a node ?&lt;/h2&gt;
&lt;p&gt;a node it&amp;rsquo;s just a machine (VM/ cloud instance) that k8s know about it and can schedule a work onto it&lt;/p&gt;</description></item><item><title>etcd</title><link>https://mahroot.dev/posts/day-1---etcd/</link><pubDate>Thu, 19 Mar 2026 23:31:51 +0100</pubDate><guid>https://mahroot.dev/posts/day-1---etcd/</guid><description>&lt;h1 id="setup"&gt;setup&lt;/h1&gt;
&lt;p&gt;i have 3 VMs: vm1, vm2 and vm3&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Node&lt;/th&gt;
&lt;th&gt;IP Address&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;node1&lt;/td&gt;
&lt;td&gt;172.31.253.147&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node2&lt;/td&gt;
&lt;td&gt;172.31.250.205&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node3&lt;/td&gt;
&lt;td&gt;172.31.253.194&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260319171638.png" alt="Pasted image 20260319171638"&gt;&lt;/p&gt;
&lt;h1 id="step1-install-etcd-on-all-3-nodes-and-create-the-data-dir"&gt;step1: Install etcd on ALL 3 Nodes and create the data dir&lt;/h1&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260319171828.png" alt="Pasted image 20260319171828"&gt;&lt;/p&gt;
&lt;p&gt;let&amp;rsquo;s verify the version and create the data directory
&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260319171932.png" alt="Pasted image 20260319171932"&gt;&lt;/p&gt;
&lt;h1 id="step2-create-the-etcd-systemd-service"&gt;step2: Create the etcd systemd Service&lt;/h1&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260319172432.png" alt="Pasted image 20260319172432"&gt;&lt;/p&gt;
&lt;p&gt;we do the same thing for other VMs changing just the ip add
for example for node1&lt;/p&gt;</description></item><item><title>Containerd under the hood</title><link>https://mahroot.dev/posts/containerd-under-the-hood/</link><pubDate>Fri, 06 Mar 2026 00:00:47 +0100</pubDate><guid>https://mahroot.dev/posts/containerd-under-the-hood/</guid><description>&lt;h1 id="phase-1-runc-raw--zero-tooling"&gt;Phase 1: runc Raw — Zero Tooling&lt;/h1&gt;
&lt;p&gt;so what we&amp;rsquo;ll do in this phase is exactly what containerd does internally&lt;/p&gt;
&lt;p&gt;me (manually) vs containerd (automatically) ─────────────────────────────────────────────────────────&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create rootfs → pulls image layers&lt;/li&gt;
&lt;li&gt;Write config.json → generates OCI bundle&lt;/li&gt;
&lt;li&gt;Call runc run → calls runc via shim&lt;/li&gt;
&lt;li&gt;Watch cgroups appear → same thing happens&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;first i installed containerd
&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260305002032.png" alt="Pasted image 20260305002032"&gt;
so it&amp;rsquo;s automatically we can see that we have runc but not crun, (so the default OCI implementation in containerd is runc)&lt;/p&gt;</description></item><item><title>Container Filesystem</title><link>https://mahroot.dev/posts/container-filesystem/</link><pubDate>Sun, 08 Feb 2026 23:56:04 +0100</pubDate><guid>https://mahroot.dev/posts/container-filesystem/</guid><description>&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260209000710.png" alt="Pasted image 20260209000710"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260209000844.png" alt="Pasted image 20260209000844"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260209001058.png" alt="Pasted image 20260209001058"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260209001254.png" alt="Pasted image 20260209001254"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020260209001457.png" alt="Pasted image 20260209001457"&gt;&lt;/p&gt;</description></item><item><title>Crafting My Own Storage Engine-Part 01: Java I/O Fundamentals</title><link>https://mahroot.dev/posts/crafting-my-own-storage-engine-part-01--java-io-fundamentals/</link><pubDate>Tue, 13 Jan 2026 19:37:47 +0100</pubDate><guid>https://mahroot.dev/posts/crafting-my-own-storage-engine-part-01--java-io-fundamentals/</guid><description>&lt;h1 id="the-page-abstraction"&gt;The &amp;ldquo;Page&amp;rdquo; Abstraction&lt;/h1&gt;
&lt;p&gt;so the &lt;code&gt;ByteBuffer&lt;/code&gt; acts like a staging area where we serialize our Java objects (the &lt;code&gt;Page&lt;/code&gt; object) into raw bytes and keep them in RAM using methods like &lt;code&gt;putInt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and after that, we need to persist the data to disk — meaning we write those bytes into a file so the data survives after the program stops&lt;/p&gt;
&lt;p&gt;so we have one large file, and since all pages have a fixed size, if we want to write the data for &lt;code&gt;pageId = 14&lt;/code&gt;, we simply compute the offset &lt;code&gt;4096 * 14&lt;/code&gt; and write the buffer at that position using the &lt;code&gt;write&lt;/code&gt; method&lt;/p&gt;</description></item><item><title>Part 1 - Building a Mini Spring Framework (v0.1)-Dependency Injection Basics</title><link>https://mahroot.dev/posts/part-1---building-a-mini-spring-framework-v0.1-dependency-injection-basics/</link><pubDate>Wed, 10 Dec 2025 23:14:46 +0100</pubDate><guid>https://mahroot.dev/posts/part-1---building-a-mini-spring-framework-v0.1-dependency-injection-basics/</guid><description>&lt;h1 id="the-problem-spring-solves"&gt;The problem Spring solves&lt;/h1&gt;
&lt;p&gt;easy right ?
let&amp;rsquo;s see :)&lt;/p&gt;
&lt;p&gt;imagine you are building an e-commerce backend, and you have OrderService that needs to process payments&lt;/p&gt;
&lt;p&gt;the naive approach is: inside the OrderService you write for example&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PaymentProcess process &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; PaypalService();
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;if your boss comes and says &amp;ldquo;we&amp;rsquo;re switching the contract from PayPal to Stripe&amp;rdquo; what do you have to do to your code?&lt;/p&gt;
&lt;p&gt;The answer is use an interface&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;interface&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;PaymentProcess&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;void&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;pay&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;double&lt;/span&gt; amount);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and the OrderService looks like&lt;/p&gt;</description></item><item><title>Fixing Flyway Database Connection Errors in Docker</title><link>https://mahroot.dev/posts/fixing-flyway-database-connection-errors-in-docker/</link><pubDate>Thu, 20 Nov 2025 12:19:05 +0100</pubDate><guid>https://mahroot.dev/posts/fixing-flyway-database-connection-errors-in-docker/</guid><description>&lt;p&gt;Before reading this blog i suggest you have a quick look at how &lt;em&gt;Docker Compose starts services&lt;/em&gt; especially how databases take time to initialize before they start accepting connections.&lt;/p&gt;
&lt;p&gt;so basically, when you work with microservices, each service has its own database (in my case: patient-db, doctor-db…). and when Spring Boot starts, Flyway tries to run the migration scripts immediately.&lt;/p&gt;
&lt;p&gt;But there is a problem:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Flyway is much faster than PostgreSQL.&lt;/em&gt;&lt;br&gt;
PostgreSQL says: “I’m starting…”&lt;br&gt;
Flyway says: “I want to connect now.”&lt;br&gt;
PostgreSQL says: “Wait wait wait hold on…”&lt;br&gt;
Flyway says: “Connection refused.”&lt;/p&gt;</description></item><item><title>Collection Interface</title><link>https://mahroot.dev/posts/collection-interface/</link><pubDate>Tue, 14 Oct 2025 01:15:28 +0200</pubDate><guid>https://mahroot.dev/posts/collection-interface/</guid><description>&lt;p&gt;the collection interface extends Iterable interface from java.lang
we have a method
&lt;strong&gt;boolean add(E e)&lt;/strong&gt; that return true if the collection changed (the elem e added) and false if not
&lt;strong&gt;boolean addAdd(Collection &amp;lt; ? extends E&amp;gt; c)&lt;/strong&gt; , that take a collection of type E of subtype of E and return true if the collection changed (all elm added)&lt;/p&gt;
&lt;p&gt;So if you have a &lt;code&gt;Collection&amp;lt;Animal&amp;gt;&lt;/code&gt; and another &lt;code&gt;Collection&amp;lt;Dog&amp;gt;&lt;/code&gt;,&lt;br&gt;
you can add the &lt;code&gt;Dog&lt;/code&gt;s into the &lt;code&gt;Animal&lt;/code&gt; collection because &lt;code&gt;Dog&lt;/code&gt; &lt;strong&gt;extends&lt;/strong&gt; &lt;code&gt;Animal&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Create My Own JCF-week1</title><link>https://mahroot.dev/posts/create-my-own-jcf-week1/</link><pubDate>Sat, 11 Oct 2025 00:59:35 +0200</pubDate><guid>https://mahroot.dev/posts/create-my-own-jcf-week1/</guid><description>&lt;h3 id="jcf-java-collection-framework-hierarchy"&gt;JCF: Java Collection Framework Hierarchy&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://mahroot.dev/images/Pasted%20image%2020251014010626.png" alt="Pasted image 20251014010626"&gt;&lt;/p&gt;
&lt;p&gt;_Bfore starting implementing JCF should you know the Iterable&lt;E&gt; interface&lt;/p&gt;
&lt;h1 id="1-iterable"&gt;1. Iterable&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Iterable interface is a builtin interface in java it allow us using &amp;ldquo;for-each&amp;rdquo; loop thanks to Iterator method&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;let&amp;rsquo;s take an example
if you work with arrays in java and suppose you create an new array&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt;&lt;span style="color:#f92672"&gt;[]&lt;/span&gt; arr &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; Interger&lt;span style="color:#f92672"&gt;[]&lt;/span&gt;{1,2,3}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and you want to make the forEach loop like this &lt;code&gt;for(int n : arr)&lt;/code&gt; =&amp;gt; this will give you a compiler error&lt;/p&gt;</description></item><item><title>MicroServices With Go and kuber</title><link>https://mahroot.dev/posts/microservices-with-go-and-kuber/</link><pubDate>Wed, 08 Oct 2025 08:45:00 +0200</pubDate><guid>https://mahroot.dev/posts/microservices-with-go-and-kuber/</guid><description>&lt;p&gt;coming soon :)&lt;/p&gt;</description></item><item><title>Obsidian + Hugo + GitHub Pages Blog Setup Guide</title><link>https://mahroot.dev/posts/obsidian-+-hugo-+-github-pages-blog-setup-guide/</link><pubDate>Sun, 10 Aug 2025 00:00:00 +0000</pubDate><guid>https://mahroot.dev/posts/obsidian-+-hugo-+-github-pages-blog-setup-guide/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;
&lt;p&gt;This setup creates an automated blog workflow where you write in Obsidian, push to GitHub, and GitHub Actions automatically builds and deploys your Hugo site.&lt;/p&gt;
&lt;h2 id="phase-1-local-setup"&gt;Phase 1: Local Setup&lt;/h2&gt;
&lt;h3 id="step-1-install-required-tools"&gt;Step 1: Install Required Tools&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Hugo&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Windows (using Chocolatey)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;choco install hugo-extended
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# macOS (using Homebrew)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;brew install hugo
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Linux (using Snap)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo snap install hugo
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Git&lt;/strong&gt; (if not already installed)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download from &lt;a href="https://git-scm.com/"&gt;git-scm.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Obsidian&lt;/strong&gt;&lt;/p&gt;</description></item></channel></rss>