py-phone-caller 1.0.0 release plan¶
Date: 2026-08-17
Target milestone: 1.0.0
Status: production hardening roadmap
Purpose¶
This document captures the current py-phone-caller release direction and the API protection discussion around using Caddy first and potentially moving to Apache APISIX later.
The goal for 1.0.0 is not only to make the services work, but to make them consistent, reproducible, air-gapped friendly, and safe enough for a trusted production LAN.
See also:
doc/pre-release-2026.mddoc/RELEASE_CANDIDATE_GUIDE.mddoc/services-and-endpoints.mddoc/uv-migration-and-workspace-guide.md
Current release posture¶
py-phone-caller is now much closer to a release-candidate quality system for a trusted LAN or air-gapped deployment.
Recent hardening work improved these areas:
uvworkspace alignment and reproducible dependency resolution.- Python
3.14consistency across local and container workflows. - Dockerfiles updated to install from the workspace instead of legacy
requirements.*files. - Runtime configuration moved out of images and into generated Dynaconf-compatible environment files.
- Docker Compose and Ansible deployment assets made more consistent and less hardcoded.
- Piccolo configuration fixed through
PICCOLO_CONF. - Legacy database schema drift repaired through
caller_register. - Web UI login, admin bootstrap, and password handling made safer.
- Web UI look and feel improved while keeping all assets local for offline use.
- Kokoro TTS dependency/runtime path validated.
- Rust SMS engine build path documented and validated.
num2wordsdependency constrained to avoid malicious releases.- Nagios and Zabbix scripts updated and live-tested against
call_to_queue. - Empty address book behavior for
phone=oncallchanged from tracebacks to clear operational warnings.
The strongest remaining production concern is API exposure. The Web UI has authentication, but the internal HTTP APIs are still mostly unauthenticated.
Security principle for 1.0.0¶
For 1.0.0, the recommended security model is:
trusted client / monitoring system
|
v
reverse proxy / gateway
|
v
private py-phone-caller service network
The Python services should not be directly reachable from untrusted clients.
Expose only the entrypoint proxy/gateway, and keep these service ports private:
| Service | Port | Exposure recommendation |
|---|---|---|
asterisk_caller |
8081 |
Private; reachable through proxy/gateway only. |
generate_audio |
8082 |
Private; service-to-service only. |
caller_register |
8083 |
Private; service-to-service/UI only. |
caller_prometheus_webhook |
8084 |
Private; monitoring webhook receiver only. |
caller_sms |
8085 |
Private; service-to-service/API gateway only. |
caller_scheduler |
8086 |
Private; service-to-service/UI only. |
caller_address_book |
8087 |
Private; UI/service only. |
py_phone_caller_ui |
5000 |
Exposed through proxy/gateway; keep app login enabled. |
celery_worker |
none | No HTTP exposure. |
PostgreSQL |
5432 |
Private infrastructure network only. |
Redis |
6379 |
Private infrastructure network only. |
Asterisk ARI |
8088 |
Private trusted network only. |
Network isolation is still required even after adding authentication. Authentication should complement firewall/container-network controls, not replace them.
Caddy first, APISIX later¶
A practical 1.0.0 path is to start with Caddy and leave a clean upgrade path to Apache APISIX.
Why start with Caddy¶
Caddy is a good first step because it is simple, reliable, and easy to operate in an air-gapped trusted LAN.
Good fit for the first phase:
- Reverse proxy in front of the Web UI and selected APIs.
- Local TLS termination for
py-phone-caller.lanor similar internal hostnames. - HTTP basic authentication for selected API paths.
- IP/subnet restrictions using Caddy request matchers.
- Simple routing to internal service ports.
- Minimal moving parts compared with a full API gateway.
- Easier packaging for air-gapped deployments.
Caddy is especially useful if the immediate objective is:
Do not expose raw service ports directly.
Protect call-triggering endpoints quickly.
Keep deployment simple for 1.0.0.
Caddy limitations¶
Caddy is a reverse proxy, not a full API gateway.
It can protect routes, but it does not provide the same complete API-management model as APISIX.
Important limitations:
- Per-consumer API key management is limited with stock Caddy.
- Fine-grained authorization policies are simpler in APISIX.
- Rate limiting usually requires a custom Caddy build/plugin or another layer.
- API analytics and gateway-level consumer auditing are more limited.
- Declarative route-level plugin chains are not as rich as APISIX.
Because this project must work offline, avoid depending on unpinned external Caddy plugins unless the custom Caddy build is also packaged and tested as part of the release process.
Recommended Caddy phase¶
For 1.0.0, Caddy can provide a clean perimeter.
Recommended initial routes:
| Public route | Internal upstream | Protection |
|---|---|---|
/ |
py_phone_caller_ui:5000 |
Web UI login plus optional LAN restriction. |
/api/calls/call_to_queue |
asterisk_caller:8081/call_to_queue |
Basic auth or trusted source restriction. |
/api/metrics/* |
service metrics endpoints | Trusted monitoring subnet only. |
Do not expose direct call placement to monitoring tools.
Monitoring integrations should continue using only:
or the proxied equivalent:
Avoid exposing place_call as a public route unless there is a strong operational reason.
Example Caddy topology¶
Nagios / Zabbix / operator
|
| HTTPS
v
py-phone-caller.lan:443 (Caddy)
|
+--> py_phone_caller_ui:5000
+--> asterisk_caller:8081
+--> selected metrics endpoints
Internal service-to-service traffic can initially stay on the private network:
asterisk_ws_monitor -> generate_audio
asterisk_ws_monitor -> asterisk_caller /play
asterisk_caller -> caller_register
asterisk_caller -> caller_address_book
This keeps the first gateway phase simple.
Caddy configuration direction¶
A future Caddy deployment asset should be generated from variables, not hardcoded.
Recommended configurable values:
- public hostname, for example
py-phone-caller.lan - upstream service hostnames
- upstream service ports
- trusted source CIDRs
- monitoring credentials or header token
- TLS certificate mode
- access log path/format
Secrets must not be committed to Git. They should come from generated env files, Ansible Vault, secret files, or local deployment-specific configuration.
A simple first Caddy design can use:
basic_authfor monitoring/API routesremote_ipmatchers for trusted LAN/subnet accessreverse_proxyto service upstreams- local certificates or internal CA certificates for offline TLS
Later APISIX phase¶
APISIX becomes attractive when py-phone-caller needs stronger API gateway behavior.
Useful APISIX features for this project:
key-authfor Nagios, Zabbix, scripts, and service clients.jwt-authif token-based users or identity integration are added later.ip-restrictionfor trusted LAN/subnet enforcement.limit-countorlimit-reqfor call-triggering endpoints.- Route-level authorization and plugin composition.
- Per-consumer credentials and revocation.
- Better gateway-level access logs and auditing.
- Optional
mTLSfor stronger service-to-service identity. proxy-rewritefor cleaner public API paths.
APISIX is more powerful than Caddy, but it adds operational complexity.
The main decision point is:
If we only need a secure reverse proxy for trusted LAN use, use Caddy.
If we need full API gateway controls, consumers, rate limits, and plugin policies, move to APISIX.
APISIX air-gapped notes¶
APISIX can work in air-gapped deployments, but it must be packaged deliberately.
Required release considerations:
- Pin and mirror the APISIX image.
- Pin and mirror required dependency images.
- Decide between standalone mode and the usual
etcd-backed deployment. - Avoid runtime plugin downloads.
- Store declarative config in deployment assets.
- Keep secrets outside Git.
- Document backup/restore for APISIX configuration if using
etcd.
For a small single-site deployment, APISIX standalone mode may be preferable because it reduces moving parts.
Suggested APISIX authorization model¶
A future APISIX deployment should use separate consumers per integration.
Suggested first consumers:
| Consumer | Allowed action |
|---|---|
nagios |
POST /api/calls/call_to_queue only. |
zabbix |
POST /api/calls/call_to_queue only. |
prometheus-alertmanager |
Alert webhook endpoints only. |
operator |
Broader operational API access if required. |
internal-service |
Selected service-to-service routes if routed through APISIX. |
Monitoring consumers should not be able to call direct dangerous endpoints such as immediate place_call unless explicitly required.
Recommended security roadmap¶
Phase 1: Caddy perimeter for 1.0.0¶
- Add Caddy deployment assets under
assets/. - Expose Web UI and selected API paths through Caddy.
- Keep raw service ports private.
- Protect
call_to_queuewith basic auth, an internal token header, or trusted source restrictions. - Keep Web UI password authentication enabled.
- Update Nagios and Zabbix scripts to optionally target the Caddy URL.
- Document firewall rules and trusted subnets.
- Add a smoke test that verifies the proxy path, not only raw service endpoints.
Phase 2: In-application defensive checks¶
Even with Caddy, add lightweight in-app protection later as defense in depth.
Possible application-level features:
- Shared API token validation middleware for
aiohttpservices. - Separate tokens for monitoring integrations and internal services.
- Route-specific permissions.
- Consistent
401and403JSON responses. - Audit logging for every call-triggering request.
This protects the system if a service port is accidentally exposed.
Phase 3: APISIX gateway¶
Move to APISIX when the project needs stronger API governance.
Good triggers for APISIX adoption:
- More external integrations.
- Per-client API keys and revocation.
- Rate limiting and quotas.
- Gateway-level audit requirements.
- mTLS or JWT integration.
- Cleaner API versioning.
Other useful improvements for 1.0.0+¶
1. Standard health and readiness endpoints¶
Each HTTP service should expose both liveness and readiness semantics.
Suggested endpoints:
/health should answer whether the process is alive.
/ready should verify required dependencies for that service, for example:
- PostgreSQL connectivity.
- Redis connectivity.
- Asterisk ARI reachability.
- Kokoro model/runtime availability.
- audio output directory writability.
- Rust SMS engine initialization when enabled.
This would improve Docker Compose, systemd, monitoring, and release smoke testing.
2. Structured audit logging¶
Call-triggering actions should be easy to audit.
Useful fields:
- timestamp
- source IP
- authenticated consumer/user when available
- endpoint
- target phone alias or number
- message checksum
- queue ID or call ID
- result status
- failure reason
This is especially important because the system can trigger real phone calls.
3. API contract documentation¶
Add an OpenAPI document for public/proxied endpoints.
Initial scope:
asterisk_callerqueue endpoint- Prometheus webhook endpoints
- caller SMS endpoint
- address book endpoints used by the UI
- health/readiness endpoints
This would make proxy/gateway configuration safer and make integration scripts easier to validate.
4. Stronger queue behavior¶
The call queue should be observable and operationally predictable.
Useful future additions:
- queue item IDs
- retry counters
- dead-letter state
- failure reason persistence
- queue metrics
- an admin UI view for pending/failed queue items
The recent phone=oncall empty-address-book fix is a good example of the behavior we want: clear warning, no traceback, and predictable queue handling.
5. Production smoke test suite¶
Create a release smoke test that can run against a deployed environment.
Suggested checks:
- proxy/gateway is reachable
- Web UI login page loads
/metricsendpoints are reachable from monitoring network- PostgreSQL is reachable by
caller_register - Redis is reachable by Celery/Scheduler
caller_registerhas run migrations/repairsgenerate_audiocan generate a small test WAVasterisk_callercan accept acall_to_queuetest request- Nagios/Zabbix scripts can enqueue through the configured endpoint
caller_smsstarts with the selected backend
Live call placement should remain optional and clearly marked because it can call real phones.
6. Backup and restore documentation¶
Before 1.0.0, document backup and restore procedures for:
- PostgreSQL data
- generated or cached audio if it must be preserved
- generated Dynaconf env files
- deployment secrets
- APISIX configuration if adopted later
- Caddy certificates and Caddy data if using internal TLS automation
7. Offline asset inventory¶
Because the project targets air-gapped environments, maintain a list of required offline artifacts.
Examples:
- container images
- Python packages in
uv.lock - Rust toolchain/build artifacts if building locally
- Kokoro model files
- Caddy/APISIX images
- PostgreSQL and Redis images
- Asterisk image/package if containerized
- fonts, CSS, JS, and UI static assets
The release should be reproducible without reaching public networks.
8. Dependency and supply-chain checks¶
The num2words issue showed why dependency constraints matter.
Suggested ongoing checks:
- lockfile review before release
- vulnerability scanning for Python dependencies
- container image scanning
- dependency pinning for runtime-critical packages
- SBOM generation for release artifacts
- documented process for replacing vulnerable packages
9. Secrets hygiene¶
The project has moved in the right direction by avoiding baked configuration inside images.
Continue enforcing:
- no raw
.secrets.tomlin images - no generated env files committed to Git
- no default production credentials in docs or playbooks
- use Ansible Vault, local secret files, or deployment-specific secret management
- document secret rotation procedures
10. Operational runbooks¶
Add short runbooks for common production cases:
- first deployment
- admin password bootstrap/reset
- empty on-call address book
- Kokoro audio failure
- Asterisk ARI connection failure
- Redis/PostgreSQL outage
- SMS engine startup failure
- monitoring integration test
- queue item stuck or repeatedly failing
Recommended 1.0.0 gate checklist¶
Before tagging 1.0.0, verify:
uv lock --checkor equivalent lock consistency passes.- Full test suite passes.
- Docker images build from repository root.
- No image contains
src/configor raw secrets. - Generated Dynaconf env files work with Docker Compose.
- Ansible deployment can render configuration without hardcoded lab values.
caller_registerinitializes/repairs the database successfully.- Web UI starts and login works.
- Missing admin user behavior is safe and explicit.
- Nagios/Zabbix scripts enqueue through
call_to_queueonly. - Empty address book produces an operational warning, not tracebacks.
generate_audiocan create an audio file offline.- Rust SMS engine import/build path is documented and reproducible.
- Caddy or another perimeter proxy protects public/trusted entrypoints.
- Raw service ports are not exposed beyond the private service network.
- Release documentation is updated.
Final recommendation¶
For the first production-grade 1.0.0 posture:
Use Caddy first.
Keep the services private.
Protect only the required public/trusted routes.
Continue routing monitoring alerts to call_to_queue.
Plan APISIX as the next security maturity step.
This approach gives py-phone-caller an immediate security improvement without adding too much infrastructure complexity before release.
Later, APISIX can become the right tool when the project needs full API gateway features such as consumers, API keys, quotas, rate limits, route-level policies, and stronger auditability.