### Summary of Changes - **Added `ermnvldmr` Platform Documentation (English & Russian)**: - `_index.md`: Overview and navigation cards - `architecture.md`: End-to-end architecture (Packer, Cloud-Init, K3s, Flux v2, Cloudflare) with Mermaid diagram - `golden-image.md`: Packer QEMU build pipeline, S3 storage & quota pruning - `deployment-gitops.md`: Declarative Flux GitOps, release pipelines, fast-track deploys, and automated `/version.json` rollout validation - `operations.md`: SSH access, SOPS + Age secret encryption, PostgreSQL storage, S3 backups, and Cloudflare configuration - **Deprecated Section Cleanup**: - Deleted obsolete `services/docs/content/en/root/` and `services/docs/content/ru/root/`
5.0 KiB
5.0 KiB
title, weight, type
| title | weight | type |
|---|---|---|
| Architecture & Flow | 2 | docs |
The ermnvldmr.com infrastructure architecture combines immutable OS image baking, autonomous cloud-init bootstrapping, and declarative Flux GitOps reconciliation into a single unified deployment model.
1. High-Level System Architecture
flowchart TD
subgraph GitHub ["GitHub Infrastructure"]
Repo["Git Repository (next branch)"]
Workflows["GitHub Actions Pipelines"]
GHCR["GitHub Container Registry (GHCR)"]
end
subgraph S3 ["S3-Compatible Object Storage"]
GoldenImage["Packer Golden Image (.qcow2)"]
Backups["Daily PostgreSQL Backups"]
end
subgraph Cloud ["Cloud Infrastructure / Compute Platform"]
subgraph VM ["Compute Virtual Machine"]
subgraph OS ["Debian 12 Bookworm"]
CloudInit["Cloud-Init First-Boot"]
UFW["UFW Firewall (80, 443, 22)"]
SSD["Secondary SSD (/dev/vdb /var/lib/rancher/k3s/storage)"]
end
subgraph K3s ["K3s Single-Node Cluster"]
Flux["Flux v2 Operator"]
Traefik["Traefik Ingress (HostPort 80/443)"]
CertManager["Cert-Manager (Let's Encrypt Prod)"]
subgraph Apps ["Namespaced Workloads (com-ermnvldmr)"]
WWW["www (React 19 SSG + Nginx)"]
Docs["docs (Hugo + Hextra + Nginx)"]
Postgres["PostgreSQL 16 StatefulSet"]
Umami["Umami Analytics Server"]
BackupCron["Postgres S3 Backup CronJob"]
end
end
end
end
subgraph Edge ["Cloudflare Edge"]
CF["Cloudflare Proxy (Full Strict)"]
end
Users["Internet Visitors"] --> CF
CF --> Traefik
Traefik --> WWW
Traefik --> Docs
Traefik --> Umami
Umami --> Postgres
BackupCron --> Backups
Workflows --> GHCR
Workflows --> GoldenImage
Repo --> Flux
Flux --> Apps
2. Platform Lifecycle Stages
The lifecycle of the platform operates in three distinct phases:
Phase 1: Golden Image Build (Packer)
- Automated Trigger: GitHub Actions runs
.github/workflows/ci-next-build-golden-image.yml. - QEMU Virtualization: Packer launches a headless QEMU Debian 12 installation with preseed automation (
preseed.cfg). - Provisioning:
- Installs base system packages (
curl,git,htop,fail2ban,ufw,qemu-guest-agent,isc-dhcp-client). - Configures
ds-identifywithpolicy: enabledso cloud-init is guaranteed to run. - Pre-installs K3s binary (
INSTALL_K3S_SKIP_ENABLE=true,INSTALL_K3S_SKIP_START=true). - Strips machine identity (
/etc/machine-id, DBus ID, SSH host keys, network MAC caches) for clean first-boot isolation.
- Installs base system packages (
- S3 Upload & Quota Management: Converts image to compressed
qcow2format, prunes older images indev/images/to prevent bucket exhaustion, and uploads the verified golden image to S3-compatible object storage.
Phase 2: Autonomous First-Boot (Cloud-Init)
When a VM is created from the golden image with ci/cloud-init/user-data.template.yaml:
- User & Network Setup:
- Creates administrative user
adamwith public SSH key. - Disables password authentication and root direct SSH access.
- Configures reliable fallback DNS nameservers (
1.1.1.1,8.8.8.8,77.88.8.8).
- Creates administrative user
- Security & Kernel Hardening:
- Applies sysctl rules: SYN flood protection, disabling ICMP redirects, source routing protection, and strict reverse path filtering.
- Configures UFW firewall rules allowing only SSH (22), Traefik HTTP (80), and Traefik HTTPS (443), while routing pod CIDR (
10.42.0.0/16) and service CIDR (10.43.0.0/16). - Enables Fail2ban.
- Persistent Secondary Storage:
- Detects secondary virtual disk
/dev/vdb. - Formats with
ext4and filesystem labelk3s-storageif not yet formatted. - Mounts to
/var/lib/rancher/k3s/storageand persists mount configuration in/etc/fstab.
- Detects secondary virtual disk
- K3s & GitOps Engine Startup:
- Starts
k3s.servicewith built-in ServiceLB enabled. - Injects the SOPS age decryption key into Kubernetes secret
flux-system/sops-age. - Installs Flux v2 custom resource definitions and controllers.
- Applies the root GitOps sync (
GitRepository+Kustomization) pointing directly tohttps://github.com/deytenit/ermnvldmr.com.giton branchnext.
- Starts
Phase 3: Continuous Reconciliation & Delivery (GitOps)
- Flux Controller:
- Polls the
nextbranch every 1 minute for repository changes. - Evaluates Kustomize overlays in
ci/k8s/clusters/production. - Automatically decrypts
*.sops.yamlsecrets in-cluster using the injectedsops-agekey. - Enforces zero-downtime rolling update strategies (
maxUnavailable: 0,maxSurge: 1).
- Polls the
- Ingress & TLS Automation:
- Traefik binds HostPorts 80 and 443.
- Cert-Manager solves Let's Encrypt HTTP-01 challenges via Ingress routes.
- Cloudflare Edge operates in Full (strict) SSL mode, proxying traffic securely to Traefik.