Unify AppProxy config generation between TUI dev mode and pyinfra deploy
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
## Summary
Extract AppProxy configuration generation (coordinator.toml, worker.toml, alembic.ini) into a shared module used by both TUI dev mode (context.py) and pyinfra deploy scripts.
## Background
AppProxy has the **highest duplication** (~170 lines in context.py + separate Jinja2 templates in pyinfra). The frontend mode logic (traefik/wildcard/port_proxy) is complex and maintaining it in two places is error-prone.
## Current State
- `context.py:configure_appproxy()` (lines 844-974) — tomlkit-based config generation
- `deploy/cores/appproxy/coordinator/deploy.py` — Jinja2 template-based
- `deploy/cores/appproxy/worker_*/deploy.py` — Jinja2 template-based
- Both generate the same config files with different approaches
## Approach
1. Create `src/ai/backend/install/config_gen/appproxy.py` with pure functions that take config params and return config dicts
1. TUI dev mode calls these functions and writes via tomlkit
1. Pyinfra deploy scripts call these functions instead of using Jinja2 templates
1. Frontend mode logic (traefik/wildcard/port) lives in one place
## Acceptance Criteria
- Single source of truth for appproxy config generation
- Both TUI dev mode and pyinfra produce identical configs
- Frontend mode logic tested in isolation
JIRA Issue: BA-5565
Contributor guide
Assessment
This issue has not been assessed yet.