Skip to content

refactor(env): Phase 2 - Migrate API tier to env-tier-api anchor - #350

Merged
POWERFULMOVES merged 1 commit into
mainfrom
env-consolidation-api-tier
Dec 24, 2025
Merged

refactor(env): Phase 2 - Migrate API tier to env-tier-api anchor#350
POWERFULMOVES merged 1 commit into
mainfrom
env-consolidation-api-tier

Conversation

@POWERFULMOVES

@POWERFULMOVES POWERFULMOVES commented Dec 24, 2025

Copy link
Copy Markdown
Owner

Summary

Phase 2 of 6-tier env consolidation: API tier migration

API tier services now receive only data tier URLs and internal credentials - no external API keys.

Changes

  • Fixed tier anchor syntax - Block-style env_file with required: false
  • Migrated postgrest - PostgREST database gateway
  • Migrated presign - MinIO URL presigner
  • Migrated retrieval-eval - Hi-RAG evaluation service
  • Created env.tier-api.example - With secure defaults

API Tier Services

Service Purpose Previous New
postgrest PostgREST DB gateway legacy env_file <<: *env-tier-api
presign MinIO URL presigner legacy env_file <<: *env-tier-api
retrieval-eval Hi-RAG eval legacy env_file <<: *env-tier-api

Security Impact

API tier services now receive only:

  • PostgreSQL credentials (POSTGRES_USER/PASSWORD)
  • MinIO credentials (MINIO_ACCESS_KEY/SECRET_KEY)
  • Presign secret (PRESIGN_SHARED_SECRET)
  • JWT secret (SUPABASE_JWT_SECRET)
  • Internal service URLs

No longer receive: External API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)

Test Plan

  • docker compose config validates without syntax errors
  • API tier services properly inherit from anchor
  • Tier anchor count: 10 services now use tier anchors

Related PRs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Improved environment file loading configuration to be more robust by making missing files non-fatal and centralizing settings across service tiers.
  • Documentation

    • Added example API Tier environment configuration template for deployment setup reference.

✏️ Tip: You can customize this high-level summary in your review settings.

Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Dec 24, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR restructures Docker Compose environment file loading from flat optional lists to structured YAML blocks with explicit required: false properties. Multiple services are consolidated to use centralized YAML anchors instead of redundant env_file declarations, and an example tier configuration template is added.

Changes

Cohort / File(s) Summary
Tier Environment Anchors
pmoves/docker-compose.yml
Updated 6 YAML anchors (x-env-tier-data, x-env-tier-api, x-env-tier-worker, x-env-tier-agent, x-env-tier-media, x-env-tier-llm) from flat optional-list syntax to structured blocks with path and required: false entries for each env file.
Service Consolidation
pmoves/docker-compose.yml
Four services (postgrest, retrieval-eval, presign, hi-rag-gateway-v2) refactored to use <<: *env-tier-api anchor reference instead of explicit env_file lists, centralizing environment loading.
Configuration Template
pmoves/env.tier-api.example
New example file added defining placeholder values for PostgreSQL, MinIO, Hi-RAG gateway, Qdrant, and Meilisearch connections and credentials for the API tier.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Through YAML anchors, we hop with glee,
Tier configs now structured, neat and free,
Env files optional—no fails in sight,
Services unified, all bundled tight! 🌟

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately reflects the main change: migrating the API tier to the env-tier-api anchor as Phase 2 of environment consolidation.
Description check ✅ Passed The PR description includes a clear summary of changes, a comprehensive test plan, and detailed security impact analysis, though it lacks explicit documentation of testing commands/output and a formal Required Checks section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch env-consolidation-api-tier

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cb33ba and 5138957.

📒 Files selected for processing (2)
  • pmoves/docker-compose.yml
  • pmoves/env.tier-api.example
🧰 Additional context used
📓 Path-based instructions (1)
pmoves/**/docker-compose.yml

📄 CodeRabbit inference engine (pmoves/AGENTS.md)

Use Compose profiles (data, workers) to scope what runs locally in docker-compose.yml

Files:

  • pmoves/docker-compose.yml
🧠 Learnings (4)
📚 Learning: 2025-12-15T12:03:17.291Z
Learnt from: CR
Repo: POWERFULMOVES/PMOVES.AI PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-15T12:03:17.291Z
Learning: Applies to pmoves/env.shared.example : Copy env.shared.example → env.shared and fill in secrets; never commit real secrets in env.shared

Applied to files:

  • pmoves/env.tier-api.example
📚 Learning: 2025-12-07T11:03:53.415Z
Learnt from: CR
Repo: POWERFULMOVES/PMOVES.AI PR: 0
File: pmoves/AGENTS.md:0-0
Timestamp: 2025-12-07T11:03:53.415Z
Learning: Applies to pmoves/**/environment.yml : Preferred Python: Conda 3.11+ (env name: `PMOVES.AI` or `pmoves-ai`); use `environment.yml` at repo root for setup

Applied to files:

  • pmoves/env.tier-api.example
📚 Learning: 2025-12-15T12:03:17.291Z
Learnt from: CR
Repo: POWERFULMOVES/PMOVES.AI PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-15T12:03:17.291Z
Learning: Applies to {.env,.env.local,pmoves/env.shared,pmoves/.env} : Never commit secrets; keep personal scratch in ignored files only, and store shared credentials in GitHub Actions secrets with environment scoping

Applied to files:

  • pmoves/docker-compose.yml
📚 Learning: 2025-12-07T11:03:53.415Z
Learnt from: CR
Repo: POWERFULMOVES/PMOVES.AI PR: 0
File: pmoves/AGENTS.md:0-0
Timestamp: 2025-12-07T11:03:53.415Z
Learning: Keep shared defaults in `env.shared` and machine-specific overrides in `.env.local`. Copy `env.shared.example` → `env.shared`; never commit secrets

Applied to files:

  • pmoves/docker-compose.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (python)
🔇 Additional comments (11)
pmoves/env.tier-api.example (4)

10-19: LGTM! PostgreSQL configuration is well-documented.

Clear instructions for matching credentials with env.tier-data and generating JWT secrets. The required field annotations help prevent configuration errors.


21-30: LGTM! MinIO configuration follows best practices.

Credentials properly marked as required with clear instructions to match env.tier-data values. The openssl rand -hex 32 command for PRESIGN_SHARED_SECRET is appropriate.


32-38: LGTM! Hi-RAG and Qdrant configuration is appropriate.

Internal service URLs use Docker network hostnames correctly, and the collection name aligns with the system's default configuration.


40-42: LGTM! Meilisearch configuration properly references shared credentials.

Clear instruction to match env.tier-data MEILI_MASTER_KEY ensures consistency across tiers.

Based on learnings: This template follows the pattern of env.shared.example—copy to env.tier-api and fill in secrets; never commit real secrets.

pmoves/docker-compose.yml (7)

5-45: LGTM! Tier anchor definitions are correctly structured.

The block-style env_file with required: false properties is the correct Docker Compose syntax for optional environment files. This approach provides graceful fallback when tier-specific files don't exist, improving developer experience. All six tier anchors follow the same consistent pattern.


76-76: LGTM! PostgREST successfully migrated to API tier anchor.

The service correctly uses <<: *env-tier-api and will now load env.tier-api and .env.local files. The explicit environment variables in lines 77-82 properly override/extend the anchor's base configuration.


197-197: LGTM! retrieval-eval successfully migrated to API tier anchor.

The service correctly uses <<: *env-tier-api. The explicit environment variables (lines 198-200) provide service-specific configuration while inheriting API tier credentials.


214-214: LGTM! presign successfully migrated to API tier anchor.

The service correctly uses <<: *env-tier-api. The explicit MinIO environment variables (lines 215-222) properly reference the credentials that will be loaded from env.tier-api.


665-665: LGTM! hi-rag-gateway-v2 successfully migrated to API tier anchor.

The service correctly uses <<: *env-tier-api. This aligns with the PR objectives and ensures the Hi-RAG gateway receives only internal credentials and data-tier URLs.


834-834: LGTM! gpu-orchestrator successfully migrated to API tier anchor.

The service correctly uses <<: *env-tier-api. The explicit environment variables (lines 835-842) provide service-specific configuration while inheriting API tier credentials. This service appropriately uses the API tier since it coordinates with NATS and orchestrates GPU models via internal service URLs.


602-602: Clarify that env.tier-media must be created by the developer with MinIO credentials.

The pmoves-yt service correctly uses the <<: *env-tier-media anchor which loads env.tier-media and .env.local (both marked required: false). However, env.tier-media does not exist in the repository—it is a developer-created secrets file (gitignored) following the pattern established in env.tier-api.example. The service requires MINIO_ACCESS_KEY and MINIO_SECRET_KEY with no fallback defaults, so developers must create env.tier-media and populate these credentials before running the service, or provide them via .env.local.

The service profiles are correct: ["orchestration", "workers", "agents"].

# =============================================================================
# PMOVES API Tier Environment Variables
# =============================================================================
# Services: postgrest, presign, retrieval-eval, hi-rag-gateway-v2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update service list to include gpu-orchestrator.

The docker-compose.yml file shows that gpu-orchestrator (line 834) also uses the env-tier-api anchor, but it's not listed here. Including all services helps users understand the scope of this tier configuration.

🔎 Proposed fix
-# Services: postgrest, presign, retrieval-eval, hi-rag-gateway-v2
+# Services: postgrest, presign, retrieval-eval, hi-rag-gateway-v2, gpu-orchestrator
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Services: postgrest, presign, retrieval-eval, hi-rag-gateway-v2
# Services: postgrest, presign, retrieval-eval, hi-rag-gateway-v2, gpu-orchestrator
🤖 Prompt for AI Agents
In pmoves/env.tier-api.example around line 4, the service list comment omits
gpu-orchestrator; update the comment to include "gpu-orchestrator" alongside
postgrest, presign, retrieval-eval, and hi-rag-gateway-v2 so the list matches
docker-compose usage and accurately documents all services that use the
env-tier-api anchor.

@POWERFULMOVES
POWERFULMOVES merged commit 590c52b into main Dec 24, 2025
6 checks passed
POWERFULMOVES added a commit that referenced this pull request Jan 2, 2026
Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES added a commit that referenced this pull request Jan 3, 2026
Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES added a commit that referenced this pull request Jan 3, 2026
…tion (#443)

* refactor(env): Phase 2 - Migrate API tier to env-tier-api anchor (#350)

Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 3 - Migrate LLM tier to env-tier-llm anchor (#351)

Phase 3 of env consolidation: LLM tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate tensorzero-ui to <<: *env-tier-llm
- Create env.tier-llm.example with all LLM provider API keys

CRITICAL: LLM tier is the ONLY tier with access to external API keys.
All other services call TensorZero internally, not providers directly.

Services in LLM tier:
- tensorzero-gateway: Already using <<: *env-tier-llm
- tensorzero-ui: Migrated from legacy env_file
- tensorzero-clickhouse: Uses inline env (no API keys needed)
- pmoves-ollama: Uses inline env (no API keys needed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 6 - Migrate agent tier + API additions (#354)

Completes the 6-tier environment consolidation by migrating:

**Agent Tier (10 services):**
- mesh-agent, deepresearch, supaserch, consciousness-service
- archon-agent-work-orders, botz-gateway, publisher-discord
- messaging-gateway, jellyfin-bridge, chat-relay

**API Tier Additions (4 services):**
- postgrest-cli, hi-rag-gateway, hi-rag-gateway-gpu, hi-rag-gateway-v2-gpu

**Worker Tier (6 services) - included in this commit:**
- render-webhook, comfy-watcher, pdf-ingest, langextract
- notebook-sync, session-context-worker

**Media Tier (10 services) - included in this commit:**
- ultimate-tts-studio, flute-gateway, ffmpeg-whisper
- media-video, media-audio, channel-monitor
- invidious, invidious-companion, grayjay-plugin-host, grayjay-server

Security improvement: 30 services now use tier-based env_file anchors
instead of legacy x-env-legacy pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): GPU access + production hardening (health checks, image pins, required password) (#355)

* docs: address PR review comments for env tier consolidation

- Add GPU Orchestrator and E2B Runner to services-catalog.md
- Add gpu-orchestrator to env.tier-api.example service list
- Create learnings file documenting 6-tier env architecture
- Add env.tier-*.example files for worker, media, agent tiers

Addresses nitpick comments from PRs #349-354.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gpu): ensure GPU access for all CUDA-enabled services

- gpu-orchestrator: Add GPU deploy section + NVIDIA_VISIBLE_DEVICES
- ultimate-tts-studio: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-v2-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- media-audio: Change base image to nvidia/cuda:12.4.1-runtime-ubuntu22.04
  (was python:3.11-slim which caused silent CPU fallback)

This fixes silent CPU fallbacks where PyTorch CUDA packages were installed
but the CUDA runtime was not available in the container.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): production hardening - health checks and image pinning

Critical security and reliability fixes:

1. **POSTGRES_PASSWORD now required** - Changed from insecure default
   `:-pmoves` to required syntax `${VAR:?error}`. Compose will fail if
   POSTGRES_PASSWORD is not set (lines 59, 78, 937).

2. **Pinned 8 :latest images to specific versions:**
   - postgrest/postgrest:latest → v12.2.3
   - minio/minio:latest → RELEASE.2024-12-18T13-15-44Z
   - ollama/ollama:latest → 0.5.4
   - tensorzero/gateway:latest → 2024.12.18
   - tensorzero/ui:latest → 2024.12.18
   - invidious:latest → 2024.12.09
   - invidious-companion:latest → 2024.12.20
   - grayjay:latest → 2024.11.01

3. **Added health checks to 37 services** (52 total, up from 15):
   - Data tier: qdrant, meilisearch, minio
   - API tier: hi-rag-*, retrieval-eval, presign, render-webhook
   - Worker tier: extract-worker, pdf-ingest, langextract, notebook-sync,
     ffmpeg-whisper, media-video, media-audio, pmoves-yt, channel-monitor
   - Agent tier: agent-zero, mesh-agent, deepresearch, supaserch
   - TensorZero: gateway, ui, ollama
   - Others: publisher-discord, messaging-gateway, jellyfin-bridge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(health): address PR review critical issues

Fixes critical issues identified by PR review:

MinIO:
- Change health check from `mc ready local` to curl-based
  (minio/minio image doesn't include mc binary)

NATS:
- Add `-m 8222` flag to enable HTTP monitoring port
  (health check was targeting port that wasn't enabled)

Health checks:
- comfy-watcher: verify module imports instead of just `import sys`
- mesh-agent: verify main module and NATS client availability

Missing start_period:
- postgres: add 15s start_period
- chat-relay: add 30s start_period
- n8n-agent: add 30s start_period
- invidious-postgres: add 15s start_period

All 52 health checks now have start_period defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* security(dockerfile): Harden notebook-sync and vibevoice-realtime

Increase Dockerfile hardening from 33/36 (91.7%) to 35/36 (97.2%):

- notebook-sync: Add USER pmoves (user creation already existed)
- vibevoice-realtime: Add full hardening with UID/GID 65532

Accepted exception: agent-zero uses root for initialization then
drops to pmoves via 'su' for the service process. This pattern is
required by upstream Agent Zero's prepare.py and /ins/copy_A0.sh.

Pattern reference: flute-gateway/Dockerfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Address PR #345 CodeRabbit review comments

- Normalize Supabase Kong hostnames to lowercase (DNS convention)
- Remove duplicate ARCHON_SUPABASE_BASE_URL env var definition
- Fix notebook-sync Dockerfile: remove USER directive so entrypoint
  can run chown/su as root before dropping privileges
- Improve deepresearch _get_or_create_counter: use module-level cache
  to avoid private prometheus_client API dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Archon Supabase connectivity and UI dashboard fixes

Changes:
- Archon health check: Add Kong gateway hostname support for internal
  Docker networking (supabase_kong_pmoves.ai:8000)
- UI dashboard: Add /dashboard redirect page to /dashboard/services
- Grafana: Fix env var placeholders and job name mismatches in queries
- Docs: Add placeholder for Jellyfin service documentation

The Archon health check now properly handles both:
- Supabase CLI endpoint (host.docker.internal:65421)
- Internal Kong gateway (supabase_kong_pmoves.ai:8000)

This resolves the 404 errors in Archon health checks when using
internal Docker DNS names instead of host.docker.internal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore(gitignore): Exclude agent-zero runtime data directory

Add pmoves/data/agent-zero/ to gitignore. This directory contains
runtime settings (settings.json) that persist via Docker volume mount.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(deepresearch): Prometheus counter double-registration

Use registry lookup pattern instead of try/except for counter
registration. Prevents 'Duplicated timeseries' error when container
restarts with existing registry state.

Before: try/except around Counter() creation
After: REGISTRY._names_to_collectors.get() for existing lookup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(flute-gateway): add logging to silent exception handlers (#323)

- Add warning log to Supabase health check exception handler
- Improve persona fetch error logging with status code and truncated body
- Add metrics tracking for non-200 persona fetch responses

Closes #322

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add comprehensive service documentation (#338)

Merged after rebase to resolve Jellyfin README conflict

* fix(compose): Agent Zero settings persistence and Archon hostname

- Add volume mount ./data/agent-zero/tmp:/a0/tmp for settings.json
  Root cause: PMOVES-Agent-Zero/python/helpers/settings.py:162 stores
  settings at /a0/tmp/settings.json but path was not mounted

- Normalize Archon SUPABASE_URL to lowercase supabase_kong_pmoves.ai
  Root cause: Docker DNS is case-sensitive on some configurations

- Fix archon-agent-work-orders health check: /healthz → /health
  Root cause: Service exposes /health, not /healthz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES added a commit that referenced this pull request Jan 18, 2026
…tion (#443)

* refactor(env): Phase 2 - Migrate API tier to env-tier-api anchor (#350)

Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 3 - Migrate LLM tier to env-tier-llm anchor (#351)

Phase 3 of env consolidation: LLM tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate tensorzero-ui to <<: *env-tier-llm
- Create env.tier-llm.example with all LLM provider API keys

CRITICAL: LLM tier is the ONLY tier with access to external API keys.
All other services call TensorZero internally, not providers directly.

Services in LLM tier:
- tensorzero-gateway: Already using <<: *env-tier-llm
- tensorzero-ui: Migrated from legacy env_file
- tensorzero-clickhouse: Uses inline env (no API keys needed)
- pmoves-ollama: Uses inline env (no API keys needed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 6 - Migrate agent tier + API additions (#354)

Completes the 6-tier environment consolidation by migrating:

**Agent Tier (10 services):**
- mesh-agent, deepresearch, supaserch, consciousness-service
- archon-agent-work-orders, botz-gateway, publisher-discord
- messaging-gateway, jellyfin-bridge, chat-relay

**API Tier Additions (4 services):**
- postgrest-cli, hi-rag-gateway, hi-rag-gateway-gpu, hi-rag-gateway-v2-gpu

**Worker Tier (6 services) - included in this commit:**
- render-webhook, comfy-watcher, pdf-ingest, langextract
- notebook-sync, session-context-worker

**Media Tier (10 services) - included in this commit:**
- ultimate-tts-studio, flute-gateway, ffmpeg-whisper
- media-video, media-audio, channel-monitor
- invidious, invidious-companion, grayjay-plugin-host, grayjay-server

Security improvement: 30 services now use tier-based env_file anchors
instead of legacy x-env-legacy pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): GPU access + production hardening (health checks, image pins, required password) (#355)

* docs: address PR review comments for env tier consolidation

- Add GPU Orchestrator and E2B Runner to services-catalog.md
- Add gpu-orchestrator to env.tier-api.example service list
- Create learnings file documenting 6-tier env architecture
- Add env.tier-*.example files for worker, media, agent tiers

Addresses nitpick comments from PRs #349-354.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gpu): ensure GPU access for all CUDA-enabled services

- gpu-orchestrator: Add GPU deploy section + NVIDIA_VISIBLE_DEVICES
- ultimate-tts-studio: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-v2-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- media-audio: Change base image to nvidia/cuda:12.4.1-runtime-ubuntu22.04
  (was python:3.11-slim which caused silent CPU fallback)

This fixes silent CPU fallbacks where PyTorch CUDA packages were installed
but the CUDA runtime was not available in the container.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): production hardening - health checks and image pinning

Critical security and reliability fixes:

1. **POSTGRES_PASSWORD now required** - Changed from insecure default
   `:-pmoves` to required syntax `${VAR:?error}`. Compose will fail if
   POSTGRES_PASSWORD is not set (lines 59, 78, 937).

2. **Pinned 8 :latest images to specific versions:**
   - postgrest/postgrest:latest → v12.2.3
   - minio/minio:latest → RELEASE.2024-12-18T13-15-44Z
   - ollama/ollama:latest → 0.5.4
   - tensorzero/gateway:latest → 2024.12.18
   - tensorzero/ui:latest → 2024.12.18
   - invidious:latest → 2024.12.09
   - invidious-companion:latest → 2024.12.20
   - grayjay:latest → 2024.11.01

3. **Added health checks to 37 services** (52 total, up from 15):
   - Data tier: qdrant, meilisearch, minio
   - API tier: hi-rag-*, retrieval-eval, presign, render-webhook
   - Worker tier: extract-worker, pdf-ingest, langextract, notebook-sync,
     ffmpeg-whisper, media-video, media-audio, pmoves-yt, channel-monitor
   - Agent tier: agent-zero, mesh-agent, deepresearch, supaserch
   - TensorZero: gateway, ui, ollama
   - Others: publisher-discord, messaging-gateway, jellyfin-bridge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(health): address PR review critical issues

Fixes critical issues identified by PR review:

MinIO:
- Change health check from `mc ready local` to curl-based
  (minio/minio image doesn't include mc binary)

NATS:
- Add `-m 8222` flag to enable HTTP monitoring port
  (health check was targeting port that wasn't enabled)

Health checks:
- comfy-watcher: verify module imports instead of just `import sys`
- mesh-agent: verify main module and NATS client availability

Missing start_period:
- postgres: add 15s start_period
- chat-relay: add 30s start_period
- n8n-agent: add 30s start_period
- invidious-postgres: add 15s start_period

All 52 health checks now have start_period defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* security(dockerfile): Harden notebook-sync and vibevoice-realtime

Increase Dockerfile hardening from 33/36 (91.7%) to 35/36 (97.2%):

- notebook-sync: Add USER pmoves (user creation already existed)
- vibevoice-realtime: Add full hardening with UID/GID 65532

Accepted exception: agent-zero uses root for initialization then
drops to pmoves via 'su' for the service process. This pattern is
required by upstream Agent Zero's prepare.py and /ins/copy_A0.sh.

Pattern reference: flute-gateway/Dockerfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Address PR #345 CodeRabbit review comments

- Normalize Supabase Kong hostnames to lowercase (DNS convention)
- Remove duplicate ARCHON_SUPABASE_BASE_URL env var definition
- Fix notebook-sync Dockerfile: remove USER directive so entrypoint
  can run chown/su as root before dropping privileges
- Improve deepresearch _get_or_create_counter: use module-level cache
  to avoid private prometheus_client API dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Archon Supabase connectivity and UI dashboard fixes

Changes:
- Archon health check: Add Kong gateway hostname support for internal
  Docker networking (supabase_kong_pmoves.ai:8000)
- UI dashboard: Add /dashboard redirect page to /dashboard/services
- Grafana: Fix env var placeholders and job name mismatches in queries
- Docs: Add placeholder for Jellyfin service documentation

The Archon health check now properly handles both:
- Supabase CLI endpoint (host.docker.internal:65421)
- Internal Kong gateway (supabase_kong_pmoves.ai:8000)

This resolves the 404 errors in Archon health checks when using
internal Docker DNS names instead of host.docker.internal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore(gitignore): Exclude agent-zero runtime data directory

Add pmoves/data/agent-zero/ to gitignore. This directory contains
runtime settings (settings.json) that persist via Docker volume mount.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(deepresearch): Prometheus counter double-registration

Use registry lookup pattern instead of try/except for counter
registration. Prevents 'Duplicated timeseries' error when container
restarts with existing registry state.

Before: try/except around Counter() creation
After: REGISTRY._names_to_collectors.get() for existing lookup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(flute-gateway): add logging to silent exception handlers (#323)

- Add warning log to Supabase health check exception handler
- Improve persona fetch error logging with status code and truncated body
- Add metrics tracking for non-200 persona fetch responses

Closes #322

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add comprehensive service documentation (#338)

Merged after rebase to resolve Jellyfin README conflict

* fix(compose): Agent Zero settings persistence and Archon hostname

- Add volume mount ./data/agent-zero/tmp:/a0/tmp for settings.json
  Root cause: PMOVES-Agent-Zero/python/helpers/settings.py:162 stores
  settings at /a0/tmp/settings.json but path was not mounted

- Normalize Archon SUPABASE_URL to lowercase supabase_kong_pmoves.ai
  Root cause: Docker DNS is case-sensitive on some configurations

- Fix archon-agent-work-orders health check: /healthz → /health
  Root cause: Service exposes /health, not /healthz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES added a commit that referenced this pull request Jan 18, 2026
Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES added a commit that referenced this pull request Jan 18, 2026
Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@POWERFULMOVES
POWERFULMOVES deleted the env-consolidation-api-tier branch March 7, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant