Files
bikoret/vav_pipeline/config/runtime.exs
T
Scott KarpandClaude Fable 5.1 e17436c4ca One gate to the world: Shorashim and Gitea behind the shared ingress
Three NLBs became one (185.19.28.170, ingress-nginx).

Shorashim: `shorashim-external` (NLB 185.19.29.180, NodePort 30923)
is replaced by an Ingress — a host-less catch-all (works by IP, no DNS)
plus a `shorashim.ch` rule ready for the A record; TLS deliberately not
requested until the name resolves. Sanhedrin-length proxy timeouts.

The watch behind the ingress (completes tablet 46): the TCP peer is now
the ingress controller, so Mishmar.peer/1 takes the caller from
X-Real-IP — only when the peer is inside TRUSTED_PROXIES (the pod
network, configmap); from anyone else the header is the caller's own
claim and is ignored. The ingress Service was already
externalTrafficPolicy: Local with its health-check port open, so the
caller's address arrives without the security-group change the direct
route needed. Verified live: the 11th knock is 429, a forged X-Real-IP
is still 429, and in the same minute the old route (pod sees the node)
was a different subject.

Gitea: no name of its resolves, so it rides the controller's TCP
passthrough on the same NLB — :3000 → gitea:80, :22 → gitea:22
(ingress-tcp-services.yaml), on the two NodePorts the security group
already allowed. gitea-mcp now reaches Gitea over the cluster network
instead of out through an NLB and back.

Tamid §1.1 note, KOHEN.md, AGENTS.md. Doorpost e4e3d56d… → a2ec3842….
Elixir 539/0 (L3 on and off).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 17:59:23 +00:00

55 lines
2.4 KiB
Elixir

import Config
# Runtime configuration — read from environment variables at boot.
# This file is evaluated at runtime, not compile time.
# Required for OTP releases where env vars aren't known at build time.
if config_env() == :prod do
# L3 — PostgreSQL connection
# The kohen sets DATABASE_URL in the K8s secret
database_url =
System.get_env("DATABASE_URL") ||
raise """
DATABASE_URL not set.
The kohen must set the DATABASE_URL in shorashim-secrets.
Format: ecto://user:password@host:port/database?sslmode=require
"""
config :vav_pipeline, VavPipeline.Repo,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "20"),
ssl: true,
ssl_opts: [verify: :verify_none]
# L1 mount point — overridable via env
config :vav_pipeline,
l1_mount_point: System.get_env("L1_MOUNT_POINT") || "/mnt/torah",
manna_provision_file:
System.get_env("MANNA_PROVISION_FILE") || "/var/lib/shorashim/manna/today.json",
talmudic_socket_path:
System.get_env("TALMUDIC_SOCKET_PATH") || "/tmp/shorashim/talmudic.sock",
korban_socket_path:
System.get_env("KORBAN_SOCKET_PATH") || "/tmp/shorashim/korban.sock",
# The keys themselves are in the file (a mounted Secret), not in env.
api_keys_file: System.get_env("API_KEYS_FILE") || "/etc/shorashim/secrets/api_keys",
# The ingress controller's network: only from there is X-Real-IP the
# caller's address (BigdeiKodesh.Mishmar.peer/1). Comma-separated CIDRs.
trusted_proxies:
(System.get_env("TRUSTED_PROXIES") || "")
|> String.split(",", trim: true)
|> Enum.map(&String.trim/1),
# Shoresh Engine binary — VavPipeline.ShoreshEnginePort opens an
# Erlang Port with {:spawn_executable, binary}, which spawns a CHILD
# PROCESS OF THIS CONTAINER. A Port cannot cross a container
# boundary, so the Haskell binary has to be on this container's
# filesystem, not only in the shoresh-engine image. deployment.yaml
# stages it onto a shared volume with an init container and points
# this variable at it. Without the override, Application.
# maybe_add_shoresh_port/3 finds nothing on PATH and logs
# "running without Haskell engine" — the system comes up DEGRADED
# and says so only in a warning line.
shoresh_engine_binary:
System.get_env("SHORESH_ENGINE_BINARY") || "shoresh-engine",
http_port: String.to_integer(System.get_env("HTTP_PORT") || "4000")
end