vault-sync: 2026-09-13 12:07 (jimmy)

This commit is contained in:
jimmy
2026-09-13 12:07:23 -07:00
parent e918f23707
commit aa52eecb5c
50 changed files with 4101 additions and 103 deletions
@@ -0,0 +1,93 @@
# ai News Daily → preprod2 Deploy Workflow
> Publish the locally-aggregated AI News Daily edition to the live site
> `https://preprod2.afterthedemo.com/`. Aggregation and ingestion live on the
> local PC; the rendered site is pushed to Gitea, whose webhook syncs it to the
> VPS webroot.
## Architecture (2 halves)
- **Aggregation (local):** `~/athena-oracle-new/` — ingest Reddit → `oracle.db` → render `site/`.
- **Delivery (Gitea → VPS):** commit + push `main` to `Tony_tech/athena-oracle`;
the preprod webhook syncs to `/var/www/preprod2` → served at
`https://preprod2.afterthedemo.com/`.
## Local pipeline (one cycle)
```bash
cd ~/athena-oracle-new
python pipeline.py --sources reddit # ingest → oracle.db
python -m oracle render --variant ai-news-daily # render site/ai-news-daily/
# Wrapper does both:
python cron/run-ai-news-daily.py --preview # dry-run both
python cron/run-ai-news-daily.py # full run (ingest + render)
```
- **Reddit adapter:** `adapters/reddit.py`, subreddits
`HuggingFace, llamacpp, artificial, DeepLearning`, limit 10-20.
Anonymous RSS is ~1 req/min per IP → the adapter reads `x-ratelimit-reset`
and sleeps between subreddits (~60s). Expect 429 + wait on all-but-first sub.
- **Scoring:** rule-based, AI-keyword boost (`~7.3-7.8` typical for top).
Non-blocking warning `scoring attach failed: no such column: bucket` still
lets entries store + render; a schema migration to add `bucket` is pending.
## Automated schedule (Hermes cron, local)
Two `no_agent` cron jobs run `~/.hermes/scripts/ai-news-daily.py` (deliver=telegram):
| Job | Schedule (local) | Notes |
|-----|------------------|-------|
| AI News Daily Morning | `0 6 * * *` (6am) | first of two daily cycles |
| AI News Daily Evening | `0 18 * * *` (6pm) | second cycle |
The script sets `ROOT` from `AI_ORACLE_ROOT` (default `~/athena-oracle-new`).
## Publish to preprod2 (the "post" step)
**Credential:** git credential manager stores `git:https://gitea.vps1.afterthedemo.com`
(user `tonyjbala`) — auto-supplied on push, nothing to configure. There is also
an SSH deploy key pair at `~/ssh-keys/vps-deploy` (`.pub` = `fight@DESKTOP-81CBTV2`).
No GITEA_ACCESS_TOKEN env var is needed on this box (the earlier leonard-flow
token-inline recipe is for the VPS's HTTP-only localhost:3000, not needed here).
```bash
cd ~/athena-oracle-new
git status --short # confirm changed files (adapter, variants, site/, cron)
git add -A
git commit -m "ai news daily: <summary>"
git push origin main # triggers preprod2 webhook → VPS sync
# DO NOT print the git credential or let the URL leak the token/scheme in chat output.
```
**Verify at the box (never trust plain "pushed"):**
```bash
git rev-parse HEAD # local commit SHA
curl -sI https://preprod2.afterthedemo.com/ | head -1 # expect HTTP 200
curl -s https://preprod2.afterthedemo.com/ | grep -oE "<story keyword>" | sort -u
```
Confirm a freshly-pushed story title is present in the live HTML.
## Deploy config
- `.preprod-config.toml`: `build.command = "true"` (files pre-rendered), `output = "site"`,
`[[deploy.branch]] branch="main" target="preprod2"`.
- `.preprod-manifest.json`: records last deploy status/SHA (regenerated server-side;
disk copy is stale after push).
## Gotchas
- **Push scheme:** remote is `https://gitea.vps1.afterthedemo.com/...` (public HTTPS).
Anonymous **clone** works; **push** needs the stored git credential manager entry.
Tailnet route to VPS is broken → always use the public URL, never tailnet IPs.
- **Live page is the main `site/index.html` feed** ("Athena AI News"), which is the
`default` variant (55KB), **not** the isolated `site/ai-news-daily/index.html`.
"Posted to aind" = the daily stories flowing into the main feed; verify against the
full titles, not just the ai-news-daily variant.
- **Rate limits:** a full Reddit cycle takes 3-6 min (60s sleeps). Don't stack runs.
- **Agent cannot write `/var/www` on the VPS** (hardline guard). Live publish goes
through the Gitea webhook, never a direct `cp`.
## Related
- Project: [[athena-oracle/status]] · [[athena-oracle/decisions]]
- Vault git backup: see `[[memory_consolidation]]` (gitea `Tony_tech/obsidian-vault`)
- Deploy plan: `~/athena-oracle-new/docs/Deployment-Plan.md`