-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
626 lines (593 loc) · 20.7 KB
/
index.html
File metadata and controls
626 lines (593 loc) · 20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>From Snowflake Servers to GitOps Nirvana</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="A beginner-friendly tour of the declarative stack that actually runs itself."
/>
<meta
name="keywords"
content="GitOps,NixOS,Kubernetes,ArgoCD,Terraform,Docker,DSPy,OPA"
/>
<meta name="author" content="Jonathan McGuinness" />
<meta name="theme-color" content="#111827" />
<meta
property="og:title"
content="From Snowflake Servers to GitOps Nirvana"
/>
<meta
property="og:description"
content="A beginner-friendly tour of 8 open-source tools that turn a git push into a zero-downtime deploy."
/>
<meta
property="og:image"
content="https://yourdomain.com/images/og-card.png"
/>
<meta name="twitter:card" content="summary_large_image" />
<link rel="stylesheet" href="styles.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css"
/>
<!-- Android/Chrome (via manifest for PWA) -->
<link rel="manifest" href="images/site.webmanifest">
<!-- Standard Icons -->
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" href="icons/favicon.ico" type="image/x-icon">
<!-- Apple Touch Icon -->
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-touch-icon.png">
<!-- Optional: High-Resolution Icons for Android -->
<link rel="icon" type="image/png" sizes="192x192" href="icons/android-chrome-192x192.png">
<link rel="icon" type="image/png" sizes="512x512" href="icons/android-chrome-512x512.png">
</head>
<body>
<h1>From Snowflake Servers to GitOps Nirvana</h1>
<p class="tagline">
<em
>8 open-source tools you can combine so that
<strong>git push</strong> deploys your entire stack.</em
>
</p>
<p align="center"><a target="_blank" href="glossary.html">View the GitOps Glossary</a></p>
<!-- paragraph with per-link copy buttons -->
<p>
You’ve probably heard the buzzwords: <span title="Manage infrastructure and apps via Git for automated, traceable deployments">GitOps</span>, <span title="Automation eliminates manual operations, letting developers focus on coding">NoOps</span>, <span title="Replace, don't modify, servers for consistent, reproducible deployments">immutable infrastructure</span>.<br />
Today I’d like to walk you—step by step—through why these concepts exist
and how a small constellation of tools (<a
href="https://git-scm.com/"
title="Version control for code, configs; tracks changes, enables collaboration"
target="_blank"
rel="noopener"
>Git</a
>, <a href="https://nixos.org/" title="Declarative Linux distro for reproducible system configurations" target="_blank" rel="noopener">NixOS</a>,
<a href="https://docker.com/" title="Packages apps into portable containers for consistent cross-environment execution" target="_blank" rel="noopener">Docker</a>,
<a
href="https://developer.hashicorp.com/terraform/"
title="Code-driven cloud infrastructure provisioning for consistent, repeatable setups"
target="_blank"
rel="noopener"
>Terraform</a
>,
<a href="https://kubernetes.io/" title="Automates container deployment, scaling, and management for reliable apps" target="_blank" rel="noopener"
>Kubernetes</a
>,
<a
href="https://argo-cd.readthedocs.io/en/stable/"
title="Automates Kubernetes deployments by syncing with Git configurations"
target="_blank"
rel="noopener"
>ArgoCD</a
>, <a href="https://dspy.ai/" title="Framework for coding, testing, and reproducing LLM prompt pipelines" target="_blank" rel="noopener">DSPy</a>, and
<a href="https://www.openpolicyagent.org/" title="Policy-as-code tool enforcing rules for secure, compliant configurations" target="_blank" rel="noopener"
>OPA</a
>) fit together to create a platform that deploys itself every time you
hit <i>merge</i>.
<button id="copyAllTools" class="copy-btn" title="Copy all tool URLs">
<svg
class="copy-icon"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
>
<rect
x="3"
y="3"
width="10"
height="10"
rx="1"
stroke="currentColor"
stroke-width="1.4"
/>
<rect
x="1"
y="1"
width="10"
height="10"
rx="1"
stroke="currentColor"
stroke-width="1.4"
/>
</svg>
All
</button>
</p>
<details class="toc">
<summary>Quick tool map (click to open)</summary>
<table border="1" cellpadding="6" cellspacing="0">
<tr>
<td>
<a href="https://git-scm.com/" target="_blank" rel="noopener"
>Git</a
>
</td>
<td>
<a href="https://nixos.org/" target="_blank" rel="noopener"
>NixOS</a
>
</td>
<td>
<a href="https://docker.com/" target="_blank" rel="noopener"
>Docker</a
>
</td>
<td>
<a
href="https://developer.hashicorp.com/terraform/"
target="_blank"
rel="noopener"
>Terraform</a
>
</td>
<td>
<a href="https://kubernetes.io/" target="_blank" rel="noopener"
>Kubernetes</a
>
</td>
<td>
<a
href="https://argo-cd.readthedocs.io/en/stable/"
target="_blank"
rel="noopener"
>ArgoCD</a
>
</td>
<td>
<a href="https://dspy.ai/" target="_blank" rel="noopener">DSPy</a>
</td>
<td>
<a
href="https://www.openpolicyagent.org/"
target="_blank"
rel="noopener"
>OPA</a
>
</td>
</tr>
</table>
</details>
<!-- rest of your article -->
<h2>1. The Problem We’re Solving</h2>
<p>
In the old world, a server was a pet: lovingly hand-fed config files,
patched on Sundays, and inevitably different from every other server. The
result?
</p>
<ul>
<li>“It works on my machine!”</li>
<li>Snow-flake drift and 3 a.m. pages.</li>
<li>Scaling = more pets.</li>
</ul>
<h2>2. The North Star: Everything as Code</h2>
<p>
Instead of pets, we want cattle - identical, replaceable, and defined in
text files that live in Git.<br />
If Git is the single source of truth, the rest of the stack becomes a
conveyor belt that turns that truth into running software.
</p>
<h2>3. The Cast of Characters and Their Jobs</h2>
<details open class="tools">
<summary>Full tool map (click to open)</summary>
<table class="tools-table" border="1" cellpadding="8">
<thead>
<tr>
<th>Tool</th>
<th>One-Sentence Job</th>
<th>Why It Matters</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Git</strong></td>
<td>
The single source-of-truth for every line of code and config.
</td>
<td>
Immutable history + pull-requests = collaboration without chaos.
</td>
</tr>
<tr>
<td><strong>NixOS</strong></td>
<td>An entire Linux distro expressed in one declarative file.</td>
<td>
Reinstalls laptop or 1 000-server fleet with
<code>nixos-rebuild</code>.
</td>
</tr>
<tr>
<td><strong>Terraform</strong></td>
<td>Describe cloud resources (VPCs, disks, IAM) in HCL.</td>
<td>
Re-creates an entire region from scratch in 15 min after a coffee
spill.
</td>
</tr>
<tr>
<td><strong>Docker</strong></td>
<td>Bundle the app and its libraries into an immutable image.</td>
<td>Same artifact runs on your Mac, in CI, and in prod.</td>
</tr>
<tr>
<td><strong>Argo CD</strong></td>
<td>A robot that watches Git and makes Kubernetes match it.</td>
<td>
Manual <code>kubectl apply</code> is now a pull-request review.
</td>
</tr>
<tr>
<td><strong>Kubernetes</strong></td>
<td>
The planet-scale scheduler that keeps those containers healthy.
</td>
<td>Auto-heals, scales, and rolls out with zero downtime.</td>
</tr>
<tr>
<td><strong>DSPy</strong></td>
<td>Prompt-engineering as typed, testable code.</td>
<td>Turns LLM prompts into reproducible pipelines.</td>
</tr>
<tr>
<td><strong>OPA / Kyverno</strong></td>
<td>Policy-as-code gatekeepers for every API call.</td>
<td>
Blocks <code>:latest</code> images or unencrypted buckets before
they deploy.
</td>
</tr>
</tbody>
</table>
</details>
<h2>4. How the Characters relate to Each Other</h2>
<p>
<details open>
<summary>Declarative GitOps workflow</summary>
<!-- external SVG as image -->
<img
src="/images/DeclarativeArchitectureMermaidChart-Dark.svg"
alt="Declarative GitOps workflow"
title="Right click to open full image"
class="diagram-img"
/>
<p class="diagram-note">
💡 Press <kbd>Ctrl</kbd> + <kbd>+</kbd> / <kbd>-</kbd>, or pinch-zoom on
mobile to enlarge the diagram. Right Click to Open Image in New Tab.
</p>
</details>
</p>
<h2>5. A Day in the Life of a Change</h2>
<p>Let’s add a new feature: “Show real-time in-game leaderboards”.</p>
<ol>
<li>
<details open>
<summary><strong>Code</strong></summary>
<p>
<ul>
<li>Write the leaderboard service in Go.</li>
<li>Add a DSPy pipeline to pre-aggregate stats.</li>
<li>Commit everything to git.</li>
</ul>
</p>
</details>
</li>
<li>
<details open>
<summary><strong>CI Gate</strong></summary>
<p>
<ul>
<li>Nix builds the Docker image (bit-for-bit reproducible).</li>
<li>Terraform dry-run shows a new Redis cache.</li>
<li>Tests pass → image is signed & pushed.</li>
</ul>
</p>
</details>
</li>
<li>
<details open>
<summary><strong>GitOps Sync</strong></summary>
<p>
<ul>
<li>Argo CD detects the new commit hash.</li>
<li>Kubernetes manifests are applied; pods roll out blue-green.</li>
<li>OPA policy ensures the service can’t talk to the payments DB.</li>
</ul>
</p>
</details>
</li>
<li>
<details open>
<summary><strong>Observe</strong></summary>
<p>
<ul>
<li>Prometheus sees p95 latency drop.</li>
<li>Grafana dashboard auto-updates.</li>
<li>No humans touched a server.</li>
</ul>
</p>
</details>
</li>
</ol>
<h2>6. Beginner Take-aways</h2>
<ul>
<li>
Start small: Put one service in Docker, store its manifest in Git, and
let Argo CD sync it.
</li>
<li>
Lean on NixOS for dev laptops - <code>nix develop</code> gives the exact
same tools as prod.
</li>
<li>
Policies early: A 15-line OPA rule today prevents a 3 a.m. breach
tomorrow.
</li>
<li>
Celebrate merges: Every green PR is a fully tested, policy-compliant,
zero-downtime release.
</li>
</ul>
<!-- assets list + copy button -->
<!-- ===== Grab the configs ===== -->
<section id="stack-assets">
<h3>📦 Grab the configs</h3>
<button onclick="copyAssets()" class="copy-btn">
<svg
class="copy-icon"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
>
<rect
x="3"
y="3"
width="10"
height="10"
rx="1"
stroke="currentColor"
stroke-width="1.4"
/>
<rect
x="1"
y="1"
width="10"
height="10"
rx="1"
stroke="currentColor"
stroke-width="1.4"
/>
</svg>
Copy URLs
</button>
<ul class="assets-list">
<!-- README.md -->
<li class="file-block">
<div class="file-header">
<a href="assets/README.md" download>⬇ Download README.md</a>
<details open>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-1">Copy</button>
<pre><code id="file-1" class="language-markdown"># Reproducible Stack in 5 Steps
| Step | Tech | One-liner Purpose |
|------|-------------|------------------------------------------|
| 1 | NixOS | Immutable host OS |
| 2 | Terraform | Provision K8s cluster |
| 3 | Docker | Local dev parity |
| 4 | Argo CD | GitOps continuous delivery |
| 5 | OPA Gatekeeper | Policy guardrails |
## Quickstart
1. `nix develop` – drops you into a shell with Terraform, kubectl, Argo CD CLI.
2. `terraform init && terraform apply` – spins up managed K8s.
3. `kubectl apply -f argocd-app.yaml` – bootstraps Argo CD.
4. `kubectl apply -f constraint-template.yaml` – sample “no latest tag” policy.
</code></pre>
</div>
</details>
</div>
</li>
<!-- flake.nix -->
<li class="file-block">
<div class="file-header">
<a href="assets/flake.nix" download>⬇ Download flake.nix</a> NixOS Operating System
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-2">Copy</button>
<pre><code id="file-2" class="language-nix">{
description = "Reproducible Dev Shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
terraform
kubectl
argocd
docker
];
};
});
}</code></pre>
</div>
</details>
</div>
</li>
<!-- main.tf -->
<li class="file-block">
<div class="file-header">
<a href="assets/main.tf" download>⬇ Download main.tf</a> Terraform for Infrastructure
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-3">Copy</button>
<pre><code id="file-3" class="language-hcl">provider "kubernetes" {
config_path = "~/.kube/config"
}
resource "kubernetes_namespace" "example" {
metadata {
name = "example-namespace"
}
}</code></pre>
</div>
</details>
</div>
</li>
<!-- Docker Compose -->
<li class="file-block">
<div class="file-header">
<a href="assets/docker-compose.yml" download>⬇ Download Docker Compose</a>Docker for Containerisation of Systems
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-2">Copy</button>
<pre><code id="file-2" class="language-yaml">version: '3.8'
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./html:/usr/share/nginx/html
depends_on:
- redis
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- redis_data:/data
volumes:
redis_data:</code></pre>
</div>
</details>
</div>
</li>
<!-- argocd-app.yaml -->
<li class="file-block">
<div class="file-header">
<a href="assets/argocd-app.yaml" download
>⬇ Download argocd-app.yaml</a
> ArgoCD for GitOps Continuous Delivery
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-4">Copy</button>
<pre><code id="file-4" class="language-yaml">apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: example-app
namespace: argocd
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
source:
repoURL: https://github.com/example/repo.git
path: manifests
project: default
syncPolicy:
automated: {}</code></pre>
</div>
</details>
</div>
</li>
<li class="file-block">
<div class="file-header">
<a href="assets/nginx-chart.tgz" download>⬇ Download Helm Chart</a>Helm chart to deploy and manage Kubernetes Applications
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-1">Copy</button>
<pre><code id="file-1" class="language-yaml">apiVersion: v2
name: nginx-chart
description: A Helm chart for Kubernetes
version: 0.1.0
appVersion: "1.20"</code></pre>
</div>
</details>
</div>
</li>
<!-- constraint-template.yaml -->
<li class="file-block">
<div class="file-header">
<a href="assets/constraint-template.yaml" download
>⬇ Download constraint-template.yaml</a
> OPA Agent for Policy Management
<details>
<summary>Show Code</summary>
<div class="code-container">
<button class="copy-btn" data-target="file-5">Copy</button>
<pre><code id="file-5" class="language-yaml">apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: k8sallowedrepos
spec:
crd:
spec:
names:
kind: K8sAllowedRepos
targets:
- target: admission.k8s.gatekeeper.sh
rego: |
package k8sallowedrepos
violation[{"msg": msg}] {
input.review.object.spec.containers[_].image != "allowed/repo"
msg := "Image repository is not allowed"
}</code></pre>
</div>
</details>
</div>
</li>
</ul>
</section>
<h2>7. The Bigger Picture</h2>
<p>
Declarative, Git-driven stacks aren’t tools; they’re a culture.<br />
When everything is code, knowledge lives in the repo, not in someone’s
head.<br />
That means faster onboarding, fearless refactors, and - best of all -
Friday deploys that don’t ruin weekends.
</p>
<p>
<strong>Welcome to the Declared World: </strong>where the robots do the
toil, and we get back to building great games.
</p>
<ul class="custom-context-menu" id="customContextMenu">
<li onclick="copyText()">Copy Text</li>
<li onclick="openLinkNewTab()">Open Link in New Tab</li>
<li onclick="downloadAsset()">Download Asset</li>
<li onclick="copyURL()">Copy URL</li>
<li onclick="viewImage()">View Image in New Tab</li>
</ul>
<!-- JavaScript for copy buttons -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="scripts.js"></script>
</body>
</html>