Dynamic site engine: Flask per-CT, live API, per-vertical identities, seed content generator
This commit is contained in:
@@ -22,14 +22,14 @@ OLLAMA_MACBOOK = "http://localhost:11434"
|
||||
OLLAMA_GAMINGPC = "http://10.30.20.186:11434"
|
||||
|
||||
VERTICALS = {
|
||||
"ai": {"domain": "ai.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"tech": {"domain": "tech.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"science": {"domain": "science.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"crypto": {"domain": "crypto.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"linux": {"domain": "linux.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"gaming": {"domain": "gaming.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"diy": {"domain": "diy.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"guides": {"domain": "guides.thetempleofdoom.com", "ct_id": None, "ip": None, "port": 5000},
|
||||
"ai": {"domain": "ai.thetempleofdoom.com", "ct_id": 135, "ip": "10.30.20.240", "port": 5000},
|
||||
"tech": {"domain": "tech.thetempleofdoom.com", "ct_id": 136, "ip": "10.30.20.241", "port": 5000},
|
||||
"science": {"domain": "science.thetempleofdoom.com", "ct_id": 137, "ip": "10.30.20.242", "port": 5000},
|
||||
"crypto": {"domain": "crypto.thetempleofdoom.com", "ct_id": 138, "ip": "10.30.20.243", "port": 5000},
|
||||
"linux": {"domain": "linux.thetempleofdoom.com", "ct_id": 139, "ip": "10.30.20.244", "port": 5000},
|
||||
"gaming": {"domain": "gaming.thetempleofdoom.com", "ct_id": 140, "ip": "10.30.20.246", "port": 5000},
|
||||
"diy": {"domain": "diy.thetempleofdoom.com", "ct_id": 141, "ip": "10.30.20.247", "port": 5000},
|
||||
"guides": {"domain": "guides.thetempleofdoom.com", "ct_id": 142, "ip": "10.30.20.248", "port": 5000},
|
||||
}
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -1102,15 +1102,26 @@ def run_daily_pipeline(max_articles: int = 3):
|
||||
articles_published += 1
|
||||
log.info(f" ✓ Published: {topic_title} → {vertical}")
|
||||
|
||||
# Step 5: Build and deploy each vertical site
|
||||
# Step 5: Publish to live site APIs
|
||||
for vertical, articles in vertical_articles.items():
|
||||
site_dir = build_site(vertical, articles)
|
||||
vinfo = VERTICALS.get(vertical, {})
|
||||
ct_ip = vinfo.get("ip")
|
||||
if ct_ip:
|
||||
deploy_site(vertical, site_dir, ct_ip)
|
||||
else:
|
||||
log.warning(f"No CT IP for {vertical} — skipping deploy")
|
||||
if not ct_ip:
|
||||
log.warning(f"No CT IP for {vertical} — skipping publish")
|
||||
continue
|
||||
|
||||
api_url = f"http://{ct_ip}:5000/api/publish"
|
||||
for article in articles:
|
||||
try:
|
||||
r = requests.post(api_url, json=article,
|
||||
headers={"Authorization": "Bearer auto-publish-2026"},
|
||||
timeout=15)
|
||||
if r.status_code in (200, 201):
|
||||
log.info(f" 📤 Published to {vertical}: {article.get('title', '')[:60]}")
|
||||
else:
|
||||
log.warning(f" ❌ {vertical} API returned {r.status_code}: {r.text[:100]}")
|
||||
except Exception as e:
|
||||
log.warning(f" ❌ Failed to publish to {vertical}: {e}")
|
||||
|
||||
# Update run log
|
||||
db.execute("""
|
||||
|
||||
Reference in New Issue
Block a user