Add Coremarket: Federated Core VM sizing and cloud pricing app
Dockerised FastAPI web app that sizes a VM for a selection of Federated Computer apps (Base/Good/Better/Best tiers or custom) and prices it across 14 cloud providers and ~250 regions, grouped by continent. - Sizing model per app with shared databases, headroom and disk growth - Live pricing from Vultr, Akamai/Linode and Azure (DigitalOcean and Hetzner with tokens); dated catalog for the rest - Hand-maintained Contabo price sheet with editor and table paste, including the one-time setup fee - HIPAA/SOC2/PCI DSS/GDPR status, SMTP port 25, IPv4 and egress notes - Estimated latency to 40 cities, real RTT via Globalping probes - Versioned REST API (/api/v1) with OpenAPI docs and CSV export - Accounts with admin/user roles, first admin from ADMIN_USERNAME / ADMIN_PASSWORD, per-account API keys, SQLite storage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""Shared runtime state: live-price cache and the effective (live/manual/catalog) provider list."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from app import live, manual
|
||||
from app.data.providers import CATALOG_DATE, PROVIDERS
|
||||
|
||||
log = logging.getLogger("coremarket")
|
||||
live_cache: dict = {}
|
||||
|
||||
|
||||
def effective_providers() -> list[dict]:
|
||||
out = []
|
||||
for p in PROVIDERS:
|
||||
if p.get("manual_defaults"):
|
||||
out.append(manual.apply(p))
|
||||
continue
|
||||
p2 = copy.copy(p)
|
||||
lc = live_cache.get(p["id"])
|
||||
if lc and lc.get("plans"):
|
||||
p2["plans"] = lc["plans"]
|
||||
p2["price_source"] = f"live API {lc['fetched_at']}"
|
||||
else:
|
||||
p2["price_source"] = f"catalog {CATALOG_DATE}"
|
||||
out.append(p2)
|
||||
return out
|
||||
|
||||
|
||||
async def refresh_live() -> dict:
|
||||
await live.refresh(live_cache)
|
||||
log.info("live pricing: %s", live_cache.get("_status"))
|
||||
return live_cache.get("_status", {})
|
||||
Reference in New Issue
Block a user