* [f1-stream] Remove committed cluster-admin kubeconfig ## Context A kubeconfig granting cluster-admin access was accidentally committed into the f1-stream stack's application bundle inc7c7047f(2026-02-22). It contained the cluster CA certificate plus the kubernetes-admin client certificate and its RSA private key. Both remotes (github.com, forgejo) are public, so the credential has been reachable for ~2 months. Grep across the repo confirms no .tf / .hcl / .sh / .yaml file references this path; the file is a stray local artifact, likely swept in during a bulk `git add`. ## This change - git rm stacks/f1-stream/files/.config ## What is NOT in this change - Cluster-admin cert rotation on the control plane. The leaked client cert must be invalidated separately via `kubeadm certs renew admin.conf` or CA regeneration. Tracked in the broader secrets-remediation plan. - Git-history rewrite. The file is still reachable in every commit sincec7c7047f. A `git filter-repo --path ... --invert-paths` pass against a fresh mirror is planned and will be force-pushed to both remotes. ## Test plan ### Automated No tests needed for a file removal. Sanity: $ grep -rn 'f1-stream/files/\.config' --include='*.tf' --include='*.hcl' \ --include='*.yaml' --include='*.yml' --include='*.sh' (no output) ### Manual Verification 1. `git show HEAD --stat` shows exactly one path deleted: stacks/f1-stream/files/.config | 19 ------------------- 2. `test ! -e stacks/f1-stream/files/.config` returns true. 3. A copy of the leaked file is at /tmp/leaked.conf for post-rotation verification (confirming `kubectl --kubeconfig /tmp/leaked.conf get ns` fails with 401/403 once the admin cert is renewed). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [frigate] Remove orphan config.yaml with leaked RTSP passwords ## Context A Frigate configuration file was added to modules/kubernetes/frigate/ inbcad200a(2026-04-15, ~2 days ago) as part of a bulk `chore: add untracked stacks, scripts, and agent configs` commit. The file contains 14 inline rtsp://admin:<password>@<host>:554/... URLs, leaking two distinct RTSP passwords for the cameras at 192.168.1.10 (LAN-only) and valchedrym.ddns.net (confirmed reachable from public internet on port 554). Both remotes are public, so the creds have been exposed for ~2 days. Grep across the repo confirms nothing references this config.yaml — the active stacks/frigate/main.tf stack reads its configuration from a persistent volume claim named `frigate-config-encrypted`, not from this file. The file is therefore an orphan from the bulk add, with no production function. ## This change - git rm modules/kubernetes/frigate/config.yaml ## What is NOT in this change - Camera password rotation. The user does not own the cameras; rotation must be coordinated out-of-band with the camera operators. The DDNS camera (valchedrym.ddns.net:554) is internet-reachable, so the leaked password is high-priority to rotate from the device side. - Git-history rewrite. The file plus its leaked strings remain in all commits frombcad200aforward. Scheduled to be purged via `git filter-repo --path modules/kubernetes/frigate/config.yaml --invert-paths --replace-text <list>` in the broader remediation pass. - Future Frigate config provisioning. If the stack is re-platformed to source config from Git rather than the PVC, the replacement should go through ExternalSecret + env-var interpolation, not an inline YAML. ## Test plan ### Automated $ grep -rn 'frigate/config\.yaml' --include='*.tf' --include='*.hcl' \ --include='*.yaml' --include='*.yml' --include='*.sh' (no output — confirms orphan status) ### Manual Verification 1. `git show HEAD --stat` shows exactly one deletion: modules/kubernetes/frigate/config.yaml | 229 --------------------------------- 2. `test ! -e modules/kubernetes/frigate/config.yaml` returns true. 3. `kubectl -n frigate get pvc frigate-config-encrypted` still shows the PVC bound (unaffected by this change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [setup-tls-secret] Delete deprecated renew.sh with hardcoded Technitium token ## Context modules/kubernetes/setup_tls_secret/renew.sh is a 2.5-year-old expect(1) script for manual Let's Encrypt wildcard-cert renewal via Technitium DNS TXT-record challenges. It hardcodes a 64-char Technitium API token on line 7 (as an expect variable) and line 27 (inside a certbot-cleanup heredoc). Both remotes are public, so the token has been exposed for ~2.5 years. The script is not invoked by the module's Terraform (main.tf only creates a kubernetes.io/tls Secret from PEM files); it is a standalone run-it-yourself tool. grep across the repo confirms nothing references `renew.sh` — neither the 20+ stacks that consume the `setup_tls_secret` module, nor any CI pipeline, nor any shell wrapper. A replacement script `renew2.sh` (4 weeks old) lives alongside it. It sources the Technitium token from `$TECHNITIUM_API_KEY` env var and also supports Cloudflare DNS-01 challenges via `$CLOUDFLARE_TOKEN`. It is the current renewal path. ## This change - git rm modules/kubernetes/setup_tls_secret/renew.sh ## What is NOT in this change - Technitium token rotation. The leaked token still works against `technitium-web.technitium.svc.cluster.local:5380` until revoked in the Technitium admin UI. Rotation is a prerequisite for the upcoming git-history scrub, which will remove the token from every commit via `git filter-repo --replace-text`. - renew2.sh is retained as-is (already env-var-sourced; clean). - The setup_tls_secret module's main.tf is not touched; 20+ consuming stacks keep working. ## Test plan ### Automated $ grep -rn 'renew\.sh' --include='*.tf' --include='*.hcl' \ --include='*.yaml' --include='*.yml' --include='*.sh' (no output — confirms no consumer) $ git grep -n 'e28818f309a9ce7f72f0fcc867a365cf5d57b214751b75e2ef3ea74943ef23be' (no output in HEAD after this commit) ### Manual Verification 1. `git show HEAD --stat` shows exactly one deletion: modules/kubernetes/setup_tls_secret/renew.sh | 136 --------- 2. `test ! -e modules/kubernetes/setup_tls_secret/renew.sh` returns true. 3. `renew2.sh` still exists and is executable: ls -la modules/kubernetes/setup_tls_secret/renew2.sh 4. Next cert-renewal run uses renew2.sh with env-var-sourced token; no behavioral regression because renew.sh was never part of the automated flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [monitoring] Delete orphan server-power-cycle/main.sh with iDRAC default creds ## Context stacks/monitoring/modules/monitoring/server-power-cycle/main.sh is an old shell implementation of a power-cycle watchdog that polled the Dell iDRAC on 192.168.1.4 for PSU voltage. It hardcoded the Dell iDRAC default credentials (root:calvin) in 5 `curl -u root:calvin` calls. Both remotes are public, so those credentials — and the implicit statement that 'this host has not rotated the default BMC password' — have been exposed. The current implementation is main.py in the same directory. It reads iDRAC credentials from the environment variables `idrac_user` and `idrac_password` (see module's iDRAC_USER_ENV_VAR / iDRAC_PASSWORD_ENV_VAR constants), which are populated from Vault via ExternalSecret at runtime. main.sh is not referenced by any Terraform, ConfigMap, or deploy script — grep confirms no `file()` / `templatefile()` / `filebase64()` call loads it, and no hand-rolled shell wrapper invokes it. ## This change - git rm stacks/monitoring/modules/monitoring/server-power-cycle/main.sh main.py is retained unchanged. ## What is NOT in this change - iDRAC password rotation on 192.168.1.4. The BMC should be moved off the vendor default `calvin` regardless; rotation is tracked in the broader remediation plan and in the iDRAC web UI. - A separate finding in stacks/monitoring/modules/monitoring/idrac.tf (the redfish-exporter ConfigMap has `default: username: root, password: calvin` as a fallback for iDRAC hosts not explicitly listed) is NOT addressed here — filed as its own task so the fix (drop the default block vs. source from env) can be considered in isolation. - Git-history scrub of main.sh is pending the broader filter-repo pass. ## Test plan ### Automated $ grep -rn 'server-power-cycle/main\.sh\|main\.sh' \ --include='*.tf' --include='*.hcl' --include='*.yaml' \ --include='*.yml' --include='*.sh' (no consumer references) ### Manual Verification 1. `git show HEAD --stat` shows only the one deletion. 2. `test ! -e stacks/monitoring/modules/monitoring/server-power-cycle/main.sh` 3. `kubectl -n monitoring get deploy idrac-redfish-exporter` still shows the exporter running — unrelated to this file. 4. main.py continues to run its watchdog loop without regression, because it was never coupled to main.sh. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [tls] Move 3 outlier stacks from per-stack PEMs to root-wildcard symlink ## Context foolery, terminal, and claude-memory each had their own `stacks/<x>/secrets/` directory with a plaintext EC-256 private key (privkey.pem, 241 B) and matching TLS certificate (fullchain.pem, 2868 B) for *.viktorbarzin.me. The 92 other stacks under stacks/ symlink `secrets/` → `../../secrets`, which resolves to the repo-root /secrets/ directory covered by the `secrets/** filter=git-crypt` .gitattributes rule — i.e., every other stack consumes the same git-crypt-encrypted root wildcard cert. The 3 outliers shipped their keys in plaintext because `.gitattributes` secrets/** rule matches only repo-root /secrets/, not stacks/*/secrets/. Both remotes are public, so the 6 plaintext PEM files have been exposed for 1–6 weeks (commits5a9881332026-03-11,a6f71fc62026-03-18,9820f2ce2026-04-10). Verified: - Root wildcard cert subject = CN viktorbarzin.me, SAN *.viktorbarzin.me + viktorbarzin.me — covers the 3 subdomains. - Root privkey + fullchain are a valid key pair (pubkey SHA256 match). - All 3 outlier certs have the same subject/SAN as root; different distinct cert material but equivalent coverage. ## This change - Delete plaintext PEMs in all 3 outlier stacks (6 files total). - Replace each stacks/<x>/secrets directory with a symlink to ../../secrets, matching the fleet pattern. - Add `stacks/**/secrets/** filter=git-crypt diff=git-crypt` to .gitattributes as a regression guard — any future real file placed under stacks/<x>/secrets/ gets git-crypt-encrypted automatically. setup_tls_secret module (modules/kubernetes/setup_tls_secret/main.tf) is unchanged. It still reads `file("${path.root}/secrets/fullchain.pem")`, which via the symlink resolves to the root wildcard. ## What is NOT in this change - Revocation of the 3 leaked per-stack certs. Backed up the leaked PEMs to /tmp/leaked-certs/ for `certbot revoke --reason keycompromise` once the user's LE account is authenticated. Revocation must happen before or alongside the history-rewrite force-push to both remotes. - Git-history scrub. The leaked PEM blobs are still reachable in every commit from 2026-03-11 forward. Scheduled for removal via `git filter-repo --path stacks/<x>/secrets/privkey.pem --invert-paths` (and fullchain.pem for each stack) in the broader remediation pass. - cert-manager introduction. The fleet does not use cert-manager today; this commit matches the existing symlink-to-wildcard pattern rather than introducing a new component. ## Test plan ### Automated $ readlink stacks/foolery/secrets ../../secrets (likewise for terminal, claude-memory) $ for s in foolery terminal claude-memory; do openssl x509 -in stacks/$s/secrets/fullchain.pem -noout -subject done subject=CN = viktorbarzin.me (x3 — all resolve via symlink to root wildcard) $ git check-attr filter -- stacks/foolery/secrets/fullchain.pem stacks/foolery/secrets/fullchain.pem: filter: git-crypt (now matched by the new rule, though for the symlink target the repo-root rule already applied) ### Manual Verification 1. `terragrunt plan` in stacks/foolery, stacks/terminal, stacks/claude-memory shows only the K8s TLS secret being re-created with the root-wildcard material. No ingress changes. 2. `terragrunt apply` for each stack → `kubectl -n <ns> get secret <name>-tls -o yaml` → tls.crt decodes to CN viktorbarzin.me with the root serial (different from the pre-change per-stack serials). 3. `curl -v https://foolery.viktorbarzin.me/` (and likewise terminal, claude-memory) → cert chain presents the new serial, handshake OK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add broker-sync Terraform stack (pending apply) Context ------- Part of the broker-sync rollout — see the plan at ~/.claude/plans/let-s-work-on-linking-temporal-valiant.md and the companion repo at ViktorBarzin/broker-sync. This change ----------- New stack `stacks/broker-sync/`: - `broker-sync` namespace, aux tier. - ExternalSecret pulling `secret/broker-sync` via vault-kv ClusterSecretStore. - `broker-sync-data-encrypted` PVC (1Gi, proxmox-lvm-encrypted, auto-resizer) — holds the sync SQLite db, FX cache, Wealthfolio cookie, CSV archive, watermarks. - Five CronJobs (all under `viktorbarzin/broker-sync:<tag>`, public DockerHub image; no pull secret): * `broker-sync-version` — daily 01:00 liveness probe (`broker-sync version`), used to smoke-test each new image. * `broker-sync-trading212` — daily 02:00 `broker-sync trading212 --mode steady`. * `broker-sync-imap` — daily 02:30, SUSPENDED (Phase 2). * `broker-sync-csv` — daily 03:00, SUSPENDED (Phase 3). * `broker-sync-fx-reconcile` — 7th of month 05:05, SUSPENDED (Phase 1 tail). - `broker-sync-backup` — daily 04:15, snapshots /data into NFS `/srv/nfs/broker-sync-backup/` with 30-day retention, matches the convention in infra/.claude/CLAUDE.md §3-2-1. NOT in this commit: - Old `wealthfolio-sync` CronJob retirement in stacks/wealthfolio/main.tf — happens in the same commit that first applies this stack, per the plan's "clean cutover" decision. - Vault seed. `secret/broker-sync` must be populated before apply; required keys documented in the ExternalSecret comment block. Test plan --------- ## Automated - `terraform fmt` — clean (ran before commit). - `terraform validate` needs `terragrunt init` first; deferred to apply time. ## Manual Verification 1. Seed Vault `secret/broker-sync/*` (see comment block on the ExternalSecret in main.tf). 2. `cd stacks/broker-sync && scripts/tg apply`. 3. `kubectl -n broker-sync get cronjob` — expect 6 CJs, 3 suspended. 4. `kubectl -n broker-sync create job smoke --from=cronjob/broker-sync-version`. 5. `kubectl -n broker-sync logs -l job-name=smoke` — expect `broker-sync 0.1.0`. * fix(beads-server): disable Authentik + CrowdSec on Workbench Authentik forward-auth returns 400 for dolt-workbench (no Authentik application configured for this domain). CrowdSec bouncer also intermittently returns 400. Both disabled — Workbench is accessible via Cloudflare tunnel only. TODO: Create Authentik application for dolt-workbench.viktorbarzin.me Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
614 lines
15 KiB
HCL
614 lines
15 KiB
HCL
variable "tls_secret_name" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
resource "kubernetes_namespace" "beads" {
|
|
metadata {
|
|
name = "beads-server"
|
|
labels = {
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_persistent_volume_claim" "dolt_data" {
|
|
wait_until_bound = false
|
|
metadata {
|
|
name = "dolt-data"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
annotations = {
|
|
"resize.topolvm.io/threshold" = "80%"
|
|
"resize.topolvm.io/increase" = "100%"
|
|
"resize.topolvm.io/storage_limit" = "10Gi"
|
|
}
|
|
}
|
|
spec {
|
|
access_modes = ["ReadWriteOnce"]
|
|
storage_class_name = "proxmox-lvm"
|
|
resources {
|
|
requests = { storage = "2Gi" }
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_config_map" "dolt_init" {
|
|
metadata {
|
|
name = "dolt-init"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
}
|
|
data = {
|
|
"01-create-beads-user.sql" = <<-EOT
|
|
CREATE USER IF NOT EXISTS 'beads'@'%' IDENTIFIED BY '';
|
|
GRANT ALL PRIVILEGES ON *.* TO 'beads'@'%' WITH GRANT OPTION;
|
|
EOT
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_deployment" "dolt" {
|
|
metadata {
|
|
name = "dolt"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "dolt"
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
strategy {
|
|
type = "Recreate"
|
|
}
|
|
selector {
|
|
match_labels = {
|
|
app = "dolt"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "dolt"
|
|
}
|
|
}
|
|
spec {
|
|
container {
|
|
name = "dolt"
|
|
image = "dolthub/dolt-sql-server:latest"
|
|
|
|
port {
|
|
name = "mysql"
|
|
container_port = 3306
|
|
}
|
|
|
|
env {
|
|
name = "DOLT_ROOT_HOST"
|
|
value = "%"
|
|
}
|
|
|
|
volume_mount {
|
|
name = "dolt-data"
|
|
mount_path = "/var/lib/dolt"
|
|
}
|
|
volume_mount {
|
|
name = "init-scripts"
|
|
mount_path = "/docker-entrypoint-initdb.d"
|
|
read_only = true
|
|
}
|
|
|
|
startup_probe {
|
|
tcp_socket {
|
|
port = 3306
|
|
}
|
|
failure_threshold = 30
|
|
period_seconds = 2
|
|
}
|
|
liveness_probe {
|
|
tcp_socket {
|
|
port = 3306
|
|
}
|
|
initial_delay_seconds = 10
|
|
period_seconds = 30
|
|
}
|
|
readiness_probe {
|
|
tcp_socket {
|
|
port = 3306
|
|
}
|
|
initial_delay_seconds = 5
|
|
period_seconds = 10
|
|
}
|
|
|
|
resources {
|
|
requests = {
|
|
memory = "256Mi"
|
|
cpu = "50m"
|
|
}
|
|
limits = {
|
|
memory = "512Mi"
|
|
}
|
|
}
|
|
}
|
|
|
|
volume {
|
|
name = "dolt-data"
|
|
persistent_volume_claim {
|
|
claim_name = kubernetes_persistent_volume_claim.dolt_data.metadata[0].name
|
|
}
|
|
}
|
|
volume {
|
|
name = "init-scripts"
|
|
config_map {
|
|
name = kubernetes_config_map.dolt_init.metadata[0].name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
lifecycle {
|
|
ignore_changes = [
|
|
spec[0].template[0].spec[0].dns_config
|
|
]
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "dolt" {
|
|
metadata {
|
|
name = "dolt"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "dolt"
|
|
}
|
|
annotations = {
|
|
"metallb.universe.tf/loadBalancerIPs" = "10.0.20.200"
|
|
"metallb.io/allow-shared-ip" = "shared"
|
|
}
|
|
}
|
|
spec {
|
|
type = "LoadBalancer"
|
|
external_traffic_policy = "Cluster"
|
|
selector = {
|
|
app = "dolt"
|
|
}
|
|
port {
|
|
name = "mysql"
|
|
port = 3306
|
|
target_port = 3306
|
|
}
|
|
}
|
|
}
|
|
|
|
# ── Dolt Workbench (web UI) ──
|
|
|
|
resource "kubernetes_config_map" "workbench_store" {
|
|
metadata {
|
|
name = "workbench-store"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
}
|
|
data = {
|
|
"store.json" = jsonencode([{
|
|
name = "beads"
|
|
connectionUrl = "mysql://beads@dolt.beads-server.svc.cluster.local:3306/code"
|
|
hideDoltFeatures = false
|
|
useSSL = false
|
|
type = "Mysql"
|
|
}])
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_deployment" "workbench" {
|
|
metadata {
|
|
name = "dolt-workbench"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "dolt-workbench"
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
selector {
|
|
match_labels = {
|
|
app = "dolt-workbench"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "dolt-workbench"
|
|
}
|
|
}
|
|
spec {
|
|
init_container {
|
|
name = "seed-config"
|
|
image = "dolthub/dolt-workbench:latest"
|
|
command = ["sh", "-c", <<-EOT
|
|
# Seed connection store
|
|
cp /config/store.json /store/store.json
|
|
# Copy static JS to writable volume and patch GraphQL URL
|
|
cp -r /app/web/.next/static/* /static/
|
|
for f in /static/chunks/pages/_app-*.js; do
|
|
sed -i 's|http://localhost:9002/graphql|/graphql|g' "$f"
|
|
done
|
|
echo "Patched GraphQL URL and store path"
|
|
EOT
|
|
]
|
|
volume_mount {
|
|
name = "store-config"
|
|
mount_path = "/config"
|
|
read_only = true
|
|
}
|
|
volume_mount {
|
|
name = "store"
|
|
mount_path = "/store"
|
|
}
|
|
volume_mount {
|
|
name = "static-patched"
|
|
mount_path = "/static"
|
|
}
|
|
}
|
|
|
|
container {
|
|
name = "workbench"
|
|
image = "dolthub/dolt-workbench:latest"
|
|
command = ["sh", "-c", <<-EOT
|
|
# Patch GraphQL server to listen on 0.0.0.0 (IPv4) — Node 18+ defaults to IPv6
|
|
sed -i 's|app.listen(9002)|app.listen(9002,"0.0.0.0")|g' /app/graphql-server/dist/main.js
|
|
# Start PM2, then auto-connect to Dolt after GraphQL is ready
|
|
pm2-runtime /app/process.yml &
|
|
PM2_PID=$!
|
|
# Wait for GraphQL server to be ready, then auto-connect
|
|
for i in $(seq 1 30); do
|
|
if node -e "fetch('http://127.0.0.1:9002/graphql',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({query:'{storedConnections{name}}'})}).then(r=>{if(r.ok)process.exit(0);process.exit(1)}).catch(()=>process.exit(1))" 2>/dev/null; then
|
|
node -e "fetch('http://127.0.0.1:9002/graphql',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({query:'mutation{addDatabaseConnection(connectionUrl:\"mysql://beads@dolt.beads-server.svc.cluster.local:3306/code\",name:\"beads\",hideDoltFeatures:false,useSSL:false,type:Mysql){currentDatabase}}'})}).then(r=>r.text()).then(t=>{console.log('Auto-connect:',t);process.exit(0)}).catch(e=>{console.error(e);process.exit(1)})" 2>&1
|
|
break
|
|
fi
|
|
sleep 1
|
|
done &
|
|
wait $PM2_PID
|
|
EOT
|
|
]
|
|
|
|
port {
|
|
name = "http"
|
|
container_port = 3000
|
|
}
|
|
port {
|
|
name = "graphql"
|
|
container_port = 9002
|
|
}
|
|
|
|
env {
|
|
name = "NODE_OPTIONS"
|
|
value = "--dns-result-order=ipv4first"
|
|
}
|
|
env {
|
|
name = "GRAPHQLAPI_URL"
|
|
value = "http://localhost:9002/graphql"
|
|
}
|
|
|
|
volume_mount {
|
|
name = "store"
|
|
mount_path = "/app/graphql-server/store"
|
|
}
|
|
volume_mount {
|
|
name = "static-patched"
|
|
mount_path = "/app/web/.next/static"
|
|
}
|
|
|
|
startup_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
failure_threshold = 30
|
|
period_seconds = 2
|
|
}
|
|
liveness_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
initial_delay_seconds = 10
|
|
period_seconds = 30
|
|
}
|
|
readiness_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
initial_delay_seconds = 5
|
|
period_seconds = 10
|
|
}
|
|
|
|
resources {
|
|
requests = {
|
|
memory = "128Mi"
|
|
cpu = "10m"
|
|
}
|
|
limits = {
|
|
memory = "512Mi"
|
|
}
|
|
}
|
|
}
|
|
|
|
volume {
|
|
name = "store-config"
|
|
config_map {
|
|
name = kubernetes_config_map.workbench_store.metadata[0].name
|
|
}
|
|
}
|
|
volume {
|
|
name = "store"
|
|
empty_dir {}
|
|
}
|
|
volume {
|
|
name = "static-patched"
|
|
empty_dir {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
lifecycle {
|
|
ignore_changes = [
|
|
spec[0].template[0].spec[0].dns_config
|
|
]
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "workbench" {
|
|
metadata {
|
|
name = "dolt-workbench"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "dolt-workbench"
|
|
}
|
|
}
|
|
spec {
|
|
selector = {
|
|
app = "dolt-workbench"
|
|
}
|
|
port {
|
|
name = "http"
|
|
port = 80
|
|
target_port = 3000
|
|
}
|
|
port {
|
|
name = "graphql"
|
|
port = 9002
|
|
target_port = 9002
|
|
}
|
|
}
|
|
}
|
|
|
|
module "tls_secret" {
|
|
source = "../../modules/kubernetes/setup_tls_secret"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
tls_secret_name = var.tls_secret_name
|
|
}
|
|
|
|
module "ingress" {
|
|
source = "../../modules/kubernetes/ingress_factory"
|
|
dns_type = "proxied"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
name = "dolt-workbench"
|
|
tls_secret_name = var.tls_secret_name
|
|
protected = false
|
|
exclude_crowdsec = true
|
|
extra_annotations = {
|
|
"gethomepage.dev/enabled" = "true"
|
|
"gethomepage.dev/name" = "Dolt Workbench"
|
|
"gethomepage.dev/description" = "Beads task database UI"
|
|
"gethomepage.dev/icon" = "dolt.png"
|
|
"gethomepage.dev/group" = "Core Platform"
|
|
"gethomepage.dev/pod-selector" = ""
|
|
}
|
|
}
|
|
|
|
# GraphQL API ingress — the frontend JS hardcodes localhost:9002/graphql,
|
|
# but we rewrite the browser request to hit the same hostname on /graphql
|
|
# routed to port 9002.
|
|
resource "kubernetes_ingress_v1" "graphql" {
|
|
metadata {
|
|
name = "dolt-workbench-graphql"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
annotations = {
|
|
# No Authentik — browser fetch() can't follow 302 redirects on POST.
|
|
# Main page (/) is still protected. GraphQL has no sensitive data beyond task list.
|
|
}
|
|
}
|
|
spec {
|
|
ingress_class_name = "traefik"
|
|
tls {
|
|
hosts = ["dolt-workbench.viktorbarzin.me"]
|
|
secret_name = var.tls_secret_name
|
|
}
|
|
rule {
|
|
host = "dolt-workbench.viktorbarzin.me"
|
|
http {
|
|
path {
|
|
path = "/graphql"
|
|
path_type = "Exact"
|
|
backend {
|
|
service {
|
|
name = kubernetes_service.workbench.metadata[0].name
|
|
port {
|
|
number = 9002
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# ── BeadBoard (task visualization dashboard) ──
|
|
|
|
resource "kubernetes_config_map" "beadboard_config" {
|
|
metadata {
|
|
name = "beadboard-beads-config"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
}
|
|
data = {
|
|
"metadata.json" = jsonencode({
|
|
database = "dolt"
|
|
backend = "dolt"
|
|
dolt_mode = "server"
|
|
dolt_server_host = "dolt.beads-server.svc.cluster.local"
|
|
dolt_server_port = 3306
|
|
dolt_server_user = "root"
|
|
dolt_database = "code"
|
|
project_id = "a8f8bae7-ce65-4145-a5db-a13d11d297da"
|
|
})
|
|
"dolt-server.port" = "3306"
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_deployment" "beadboard" {
|
|
metadata {
|
|
name = "beadboard"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "beadboard"
|
|
tier = local.tiers.aux
|
|
}
|
|
}
|
|
spec {
|
|
replicas = 1
|
|
selector {
|
|
match_labels = {
|
|
app = "beadboard"
|
|
}
|
|
}
|
|
template {
|
|
metadata {
|
|
labels = {
|
|
app = "beadboard"
|
|
}
|
|
}
|
|
spec {
|
|
image_pull_secrets {
|
|
name = "registry-credentials"
|
|
}
|
|
|
|
init_container {
|
|
name = "seed-beads-config"
|
|
image = "busybox:1.36"
|
|
command = ["sh", "-c", "cp /config/* /beads/ && mkdir -p /beads/templates /beads/archetypes"]
|
|
volume_mount {
|
|
name = "beads-config"
|
|
mount_path = "/config"
|
|
read_only = true
|
|
}
|
|
volume_mount {
|
|
name = "beads-writable"
|
|
mount_path = "/beads"
|
|
}
|
|
}
|
|
|
|
container {
|
|
name = "beadboard"
|
|
image = "registry.viktorbarzin.me:5050/beadboard:latest"
|
|
|
|
port {
|
|
name = "http"
|
|
container_port = 3000
|
|
}
|
|
|
|
volume_mount {
|
|
name = "beads-writable"
|
|
mount_path = "/app/.beads"
|
|
}
|
|
|
|
startup_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
failure_threshold = 30
|
|
period_seconds = 2
|
|
}
|
|
liveness_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
initial_delay_seconds = 10
|
|
period_seconds = 30
|
|
}
|
|
readiness_probe {
|
|
http_get {
|
|
path = "/"
|
|
port = 3000
|
|
}
|
|
initial_delay_seconds = 5
|
|
period_seconds = 10
|
|
}
|
|
|
|
resources {
|
|
requests = {
|
|
memory = "256Mi"
|
|
cpu = "50m"
|
|
}
|
|
limits = {
|
|
memory = "512Mi"
|
|
}
|
|
}
|
|
}
|
|
|
|
volume {
|
|
name = "beads-config"
|
|
config_map {
|
|
name = kubernetes_config_map.beadboard_config.metadata[0].name
|
|
}
|
|
}
|
|
volume {
|
|
name = "beads-writable"
|
|
empty_dir {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
lifecycle {
|
|
ignore_changes = [
|
|
spec[0].template[0].spec[0].dns_config
|
|
]
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_service" "beadboard" {
|
|
metadata {
|
|
name = "beadboard"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
labels = {
|
|
app = "beadboard"
|
|
}
|
|
}
|
|
spec {
|
|
selector = {
|
|
app = "beadboard"
|
|
}
|
|
port {
|
|
name = "http"
|
|
port = 80
|
|
target_port = 3000
|
|
}
|
|
}
|
|
}
|
|
|
|
module "beadboard_ingress" {
|
|
source = "../../modules/kubernetes/ingress_factory"
|
|
dns_type = "proxied"
|
|
namespace = kubernetes_namespace.beads.metadata[0].name
|
|
name = "beadboard"
|
|
tls_secret_name = var.tls_secret_name
|
|
protected = true
|
|
exclude_crowdsec = true
|
|
extra_annotations = {
|
|
"gethomepage.dev/enabled" = "true"
|
|
"gethomepage.dev/name" = "BeadBoard"
|
|
"gethomepage.dev/description" = "Agent task visualization dashboard"
|
|
"gethomepage.dev/icon" = "mdi-chart-gantt"
|
|
"gethomepage.dev/group" = "Core Platform"
|
|
"gethomepage.dev/pod-selector" = ""
|
|
}
|
|
}
|