{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "blog — hamed ghasempour",
  "home_page_url": "https://hgh.dev/blog/",
  "feed_url": "https://hgh.dev/feed.json",
  "description": "notes on infra, tooling, and things i figure out.",
  "language": "en",
  "icon": "https://avatars.githubusercontent.com/hambn",
  "authors": [
    {
      "name": "hamed ghasempour",
      "url": "https://hgh.dev/",
      "avatar": "https://avatars.githubusercontent.com/hambn"
    }
  ],
  "items": [
    {
      "id": "https://hgh.dev/blog/welcome/",
      "url": "https://hgh.dev/blog/welcome/",
      "title": "Rebuilding the Blog",
      "summary": "How this blog works now — drop a markdown file anywhere under contents/blogs and it shows up automatically.",
      "content_html": "<p>This blog is now <strong>fully file-driven</strong>. There's no registry to maintain — every <code>.md</code>\nfile under <code>contents/blogs/</code> (at <em>any</em> folder depth) becomes a post automatically.</p>\n<h2 id=\"how-it-works\">How it works<a class=\"heading-anchor\" href=\"#how-it-works\" aria-label=\"link to “How it works”\">#</a></h2>\n<ol>\n<li>The route slug is just the filename without <code>.md</code>. So <code>welcome.md</code> lives at <code>/blog/welcome</code>.</li>\n<li>All metadata lives in the frontmatter block at the top of the file:</li>\n</ol>\n<div class=\"code-block\"><pre><code class=\"language-yaml hljs\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Rebuilding</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">Blog</span>\n<span class=\"hljs-attr\">date:</span> <span class=\"hljs-number\">2026-06-22</span>\n<span class=\"hljs-attr\">description:</span> <span class=\"hljs-string\">A</span> <span class=\"hljs-string\">short</span> <span class=\"hljs-string\">summary</span> <span class=\"hljs-string\">shown</span> <span class=\"hljs-string\">in</span> <span class=\"hljs-string\">the</span> <span class=\"hljs-string\">list.</span>\n<span class=\"hljs-attr\">tags:</span> [<span class=\"hljs-string\">meta</span>, <span class=\"hljs-string\">markdown</span>, <span class=\"hljs-string\">devops</span>]\n<span class=\"hljs-meta\">---\n</span></code></pre><span class=\"code-lang\">yaml</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<ol start=\"3\">\n<li>Posts are sorted by <code>date</code>, newest first.</li>\n</ol>\n<blockquote>\n<p>Drop a file in <code>contents/blogs/</code>, give it frontmatter, done. No JSON to edit.</p>\n</blockquote>\n<h2 id=\"what-renders\">What renders<a class=\"heading-anchor\" href=\"#what-renders\" aria-label=\"link to “What renders”\">#</a></h2>\n<p>Everything GitHub-flavored markdown supports — <code>inline code</code>, <strong>bold</strong>, <em>italic</em>,\ntables, task lists, blockquotes, and fenced code with syntax highlighting.</p>\n<div class=\"table-wrap\"><table>\n<thead>\n<tr>\n<th>Feature</th>\n<th align=\"center\">Supported</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Code blocks</td>\n<td align=\"center\">✅</td>\n</tr>\n<tr>\n<td>Tables</td>\n<td align=\"center\">✅</td>\n</tr>\n<tr>\n<td>Mermaid</td>\n<td align=\"center\">✅</td>\n</tr>\n<tr>\n<td>Task lists</td>\n<td align=\"center\">✅</td>\n</tr>\n</tbody></table></div>\n<ul>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> frontmatter metadata</li>\n<li><input checked=\"\" disabled=\"\" type=\"checkbox\"> recursive discovery</li>\n<li><input disabled=\"\" type=\"checkbox\"> write more posts</li>\n</ul>\n",
      "image": "https://hgh.dev/og/blog-welcome.png",
      "date_published": "2026-06-22T00:00:00Z",
      "tags": [
        "meta",
        "markdown",
        "devops"
      ]
    },
    {
      "id": "https://hgh.dev/blog/gitops-with-argocd/",
      "url": "https://hgh.dev/blog/gitops-with-argocd/",
      "title": "GitOps with Argo CD",
      "summary": "A practical GitOps setup where the cluster state always matches what's in git — using Argo CD to sync manifests automatically.",
      "content_html": "<p>The idea behind GitOps is simple: <strong>git is the source of truth</strong>. The cluster\ncontinuously reconciles itself to match what's committed. No more <code>kubectl apply</code>\nfrom someone's laptop.</p>\n<h2 id=\"the-flow\">The flow<a class=\"heading-anchor\" href=\"#the-flow\" aria-label=\"link to “The flow”\">#</a></h2>\n<pre><code class=\"language-mermaid\">flowchart LR\n  A[Developer] --&gt;|git push| B[Git Repo]\n  B --&gt;|webhook| C[Argo CD]\n  C --&gt;|sync| D[Kubernetes Cluster]\n  D --&gt;|status| C\n</code></pre>\n<p>Argo CD watches the repo, notices drift, and reconciles. If someone edits the\ncluster by hand, Argo CD flags it as <strong>OutOfSync</strong> and can revert it.</p>\n<h2 id=\"a-minimal-application\">A minimal Application<a class=\"heading-anchor\" href=\"#a-minimal-application\" aria-label=\"link to “A minimal Application”\">#</a></h2>\n<div class=\"code-block\"><pre><code class=\"language-yaml hljs\"><span class=\"hljs-attr\">apiVersion:</span> <span class=\"hljs-string\">argoproj.io/v1alpha1</span>\n<span class=\"hljs-attr\">kind:</span> <span class=\"hljs-string\">Application</span>\n<span class=\"hljs-attr\">metadata:</span>\n  <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">web</span>\n  <span class=\"hljs-attr\">namespace:</span> <span class=\"hljs-string\">argocd</span>\n<span class=\"hljs-attr\">spec:</span>\n  <span class=\"hljs-attr\">project:</span> <span class=\"hljs-string\">default</span>\n  <span class=\"hljs-attr\">source:</span>\n    <span class=\"hljs-attr\">repoURL:</span> <span class=\"hljs-string\">https://github.com/hambn/infra</span>\n    <span class=\"hljs-attr\">targetRevision:</span> <span class=\"hljs-string\">main</span>\n    <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">apps/web</span>\n  <span class=\"hljs-attr\">destination:</span>\n    <span class=\"hljs-attr\">server:</span> <span class=\"hljs-string\">https://kubernetes.default.svc</span>\n    <span class=\"hljs-attr\">namespace:</span> <span class=\"hljs-string\">web</span>\n  <span class=\"hljs-attr\">syncPolicy:</span>\n    <span class=\"hljs-attr\">automated:</span>\n      <span class=\"hljs-attr\">prune:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">selfHeal:</span> <span class=\"hljs-literal\">true</span>\n</code></pre><span class=\"code-lang\">yaml</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<p>With <code>selfHeal: true</code>, manual changes get reverted automatically. With <code>prune: true</code>,\ndeleting a manifest from git deletes it from the cluster.</p>\n<h2 id=\"lessons-learned\">Lessons learned<a class=\"heading-anchor\" href=\"#lessons-learned\" aria-label=\"link to “Lessons learned”\">#</a></h2>\n<ol>\n<li>Keep app config and cluster config in separate repos.</li>\n<li>Use <code>prune</code> carefully in production.</li>\n<li>The Argo CD UI is genuinely great for debugging sync issues.</li>\n</ol>\n",
      "image": "https://hgh.dev/og/blog-gitops-with-argocd.png",
      "date_published": "2026-06-01T00:00:00Z",
      "tags": [
        "kubernetes",
        "gitops",
        "argocd",
        "devops"
      ]
    },
    {
      "id": "https://hgh.dev/blog/nixos-homelab/",
      "url": "https://hgh.dev/blog/nixos-homelab/",
      "title": "Building a NixOS Homelab",
      "summary": "Rebuilding my homelab declaratively with NixOS flakes — reproducible, version-controlled infrastructure at home.",
      "content_html": "<p>After one too many \"what did I install on this box?\" moments, I rebuilt my entire\nhomelab on <strong>NixOS</strong>. Everything is declarative now — the whole machine is one\ngit repo.</p>\n<h2 id=\"the-flake\">The flake<a class=\"heading-anchor\" href=\"#the-flake\" aria-label=\"link to “The flake”\">#</a></h2>\n<div class=\"code-block\"><pre><code class=\"language-nix hljs\">{\n  <span class=\"hljs-attr\">description</span> <span class=\"hljs-operator\">=</span> <span class=\"hljs-string\">\"homelab\"</span>;\n\n  <span class=\"hljs-attr\">inputs.nixpkgs.url</span> <span class=\"hljs-operator\">=</span> <span class=\"hljs-string\">\"github:NixOS/nixpkgs/nixos-unstable\"</span>;\n\n  <span class=\"hljs-attr\">outputs</span> <span class=\"hljs-operator\">=</span> { self, nixpkgs }: {\n    <span class=\"hljs-attr\">nixosConfigurations.box</span> <span class=\"hljs-operator\">=</span> nixpkgs.lib.nixosSystem {\n      <span class=\"hljs-attr\">system</span> <span class=\"hljs-operator\">=</span> <span class=\"hljs-string\">\"x86_64-linux\"</span>;\n      <span class=\"hljs-attr\">modules</span> <span class=\"hljs-operator\">=</span> [ <span class=\"hljs-symbol\">./configuration.nix</span> ];\n    };\n  };\n}\n</code></pre><span class=\"code-lang\">nix</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<h2 id=\"why-it-s-worth-it\">Why it's worth it<a class=\"heading-anchor\" href=\"#why-it-s-worth-it\" aria-label=\"link to “Why it's worth it”\">#</a></h2>\n<ul>\n<li><strong>Reproducible</strong> — <code>nixos-rebuild switch</code> gets me an identical machine every time.</li>\n<li><strong>Rollbacks</strong> — bad config? boot the previous generation.</li>\n<li><strong>Documented by default</strong> — the config <em>is</em> the documentation.</li>\n</ul>\n<div class=\"code-block\"><pre><code class=\"language-bash hljs\"><span class=\"hljs-comment\"># rebuild and switch</span>\n<span class=\"hljs-built_in\">sudo</span> nixos-rebuild switch --flake .#box\n\n<span class=\"hljs-comment\"># roll back if it broke</span>\n<span class=\"hljs-built_in\">sudo</span> nixos-rebuild switch --rollback\n</code></pre><span class=\"code-lang\">bash</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<blockquote>\n<p>NixOS is a rabbit hole. A very good rabbit hole.</p>\n</blockquote>\n<p>It took a weekend to learn, but I haven't lost track of a single service since.</p>\n",
      "image": "https://hgh.dev/og/blog-nixos-homelab.png",
      "date_published": "2026-05-12T00:00:00Z",
      "tags": [
        "nixos",
        "homelab",
        "devops",
        "linux"
      ]
    },
    {
      "id": "https://hgh.dev/blog/docker-multistage/",
      "url": "https://hgh.dev/blog/docker-multistage/",
      "title": "Smaller Images with Multi-stage Builds",
      "summary": "Cutting a Go image from 900MB to 12MB with multi-stage Docker builds and distroless base images.",
      "content_html": "<p>A naive Dockerfile ships the entire build toolchain to production. Multi-stage\nbuilds let you compile in one stage and copy <em>only the binary</em> into a tiny final\nimage.</p>\n<h2 id=\"before-900mb\">Before — 900MB<a class=\"heading-anchor\" href=\"#before-900mb\" aria-label=\"link to “Before — 900MB”\">#</a></h2>\n<div class=\"code-block\"><pre><code class=\"language-dockerfile hljs\"><span class=\"hljs-keyword\">FROM</span> golang:<span class=\"hljs-number\">1.22</span>\n<span class=\"hljs-keyword\">WORKDIR</span><span class=\"language-bash\"> /app</span>\n<span class=\"hljs-keyword\">COPY</span><span class=\"language-bash\"> . .</span>\n<span class=\"hljs-keyword\">RUN</span><span class=\"language-bash\"> go build -o server .</span>\n<span class=\"hljs-keyword\">CMD</span><span class=\"language-bash\"> [<span class=\"hljs-string\">\"./server\"</span>]</span>\n</code></pre><span class=\"code-lang\">dockerfile</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<h2 id=\"after-12mb\">After — 12MB<a class=\"heading-anchor\" href=\"#after-12mb\" aria-label=\"link to “After — 12MB”\">#</a></h2>\n<div class=\"code-block\"><pre><code class=\"language-dockerfile hljs\"><span class=\"hljs-comment\"># build stage</span>\n<span class=\"hljs-keyword\">FROM</span> golang:<span class=\"hljs-number\">1.22</span> AS build\n<span class=\"hljs-keyword\">WORKDIR</span><span class=\"language-bash\"> /app</span>\n<span class=\"hljs-keyword\">COPY</span><span class=\"language-bash\"> . .</span>\n<span class=\"hljs-keyword\">RUN</span><span class=\"language-bash\"> CGO_ENABLED=0 go build -o server .</span>\n\n<span class=\"hljs-comment\"># final stage</span>\n<span class=\"hljs-keyword\">FROM</span> gcr.io/distroless/static\n<span class=\"hljs-keyword\">COPY</span><span class=\"language-bash\"> --from=build /app/server /server</span>\n<span class=\"hljs-keyword\">ENTRYPOINT</span><span class=\"language-bash\"> [<span class=\"hljs-string\">\"/server\"</span>]</span>\n</code></pre><span class=\"code-lang\">dockerfile</span><button class=\"code-copy\" type=\"button\">copy</button></div>\n<p>The <code>distroless/static</code> base has no shell, no package manager, nothing but your\nbinary and the certs it needs.</p>\n<div class=\"table-wrap\"><table>\n<thead>\n<tr>\n<th>Image</th>\n<th>Size</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>golang:1.22</code></td>\n<td>900 MB</td>\n</tr>\n<tr>\n<td><code>alpine</code> + binary</td>\n<td>25 MB</td>\n</tr>\n<tr>\n<td><code>distroless</code> + binary</td>\n<td>12 MB</td>\n</tr>\n</tbody></table></div>\n<p>Smaller images pull faster, have a smaller attack surface, and cost less to store.</p>\n",
      "image": "https://hgh.dev/og/blog-docker-multistage.png",
      "date_published": "2026-04-08T00:00:00Z",
      "tags": [
        "docker",
        "containers",
        "go",
        "devops"
      ]
    }
  ]
}
