Files
momentum-system/deploy/helm/momentum/templates/secret.yaml
T
Claude e91979a622 Add Kubernetes image + Helm package with in-cluster Postgres
Containerizes the momentum monolith and packages every run mode for
deployment in a single Kubernetes namespace, with PostgreSQL hosted in
the cluster.

- Dockerfile (python:3.11-slim, non-root, writable /app/data) + .dockerignore
- GitHub Actions workflow publishing to ghcr.io/fez5587/momentum-system
- Helm chart (deploy/helm/momentum):
  * PostgreSQL StatefulSet + PVC (single source of truth; schema
    auto-creates from storage/pg_schema.sql on first connect)
  * App Deployment running run_live_paper.py with the embedded dashboard
    (replicas: 1, Recreate; the dashboard's write endpoints need the
    in-process TradingExecutionService) + Service/Ingress on 8010, plus a
    wait-for-postgres initContainer
  * CronJobs for journal / eod-replay / nightly-tune (US/Eastern via
    spec.timeZone) sharing the app data PVC
  * ConfigMap (tuning env) + Secret (DATABASE_URL/broker keys, existingSecret
    supported); DATABASE_URL built from the in-cluster Postgres service
  * Optional Grafana provisioned against the in-cluster Postgres
- deploy/README.md with install, secrets, and constraints

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCVMm2AbmZvvxwLTX6UpNR
2026-06-19 17:22:06 +00:00

27 lines
1.2 KiB
YAML

{{- if not .Values.secrets.existingSecret }}
{{- $pgPassword := include "momentum.postgresPassword" . }}
{{- $pgHost := include "momentum.postgresName" . }}
{{- $databaseUrl := printf "postgresql://%s:%s@%s:%v/%s" .Values.postgres.username $pgPassword $pgHost .Values.postgres.port .Values.postgres.database }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "momentum.fullname" . }}-secrets
labels:
{{- include "momentum.labels" . | nindent 4 }}
type: Opaque
stringData:
# Consumed by the Postgres StatefulSet.
POSTGRES_PASSWORD: {{ $pgPassword | quote }}
# Consumed by the app + CronJobs (storage/db_pg.py prefers DATABASE_URL).
DATABASE_URL: {{ $databaseUrl | quote }}
# Alpaca paper broker (the client reads both the ALPACA_* and APCA_* names).
ALPACA_API_KEY: {{ .Values.secrets.alpacaApiKey | quote }}
ALPACA_SECRET_KEY: {{ .Values.secrets.alpacaSecretKey | quote }}
APCA_API_KEY_ID: {{ .Values.secrets.alpacaApiKey | quote }}
APCA_API_SECRET_KEY: {{ .Values.secrets.alpacaSecretKey | quote }}
APCA_API_BASE_URL: {{ .Values.secrets.alpacaBaseUrl | quote }}
{{- range $k, $v := .Values.secrets.schwab }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}