HN favorites scrape CronJob -> AWS DynamoDB
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| .nvmrc | ||
| .prettierignore | ||
| .prettierrc.json | ||
| commitlint.config.js | ||
| Dockerfile | ||
| eslint.config.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
hackernews-favs-cron
Runs the Hacker News favorites scrape from nholtware/hackernews-favs (the AWS
Lambda version) as a Kubernetes CronJob on the homelab k3s cluster. It still
writes each batch to the AWS DynamoDB table hackernews-favs (same item shape:
pk=date#YYYY-MM-DD, sk=batch#<uuid>), so existing readers are unaffected.
- Code:
src/favorites.ts(fetch + parse),src/main.ts(one-shot entrypoint). - Deploy: push to
main-> Forgejo CI builds the image ->gitops-bump-> ArgoCD syncsmanifests/hackernews-favs-cron(CronJob, Sundays 02:00 UTC). - Config env:
TABLE_NAME,HN_USER(defaultnoaoh),AWS_REGION. - Credentials: Secret
aws-dynamodbin namespacehackernews-favs-cron, keysAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY. Created by kubectl, never in git. Scope the IAM user todynamodb:PutItemon the table. - Run once now:
kubectl create job -n hackernews-favs-cron --from=cronjob/hackernews-favs-cron manual-$(date +%s) - Remove the Lambda schedule once happy:
cdk destroyinhackernews-favswould also delete the table (RemovalPolicy.DESTROY), so disable the EventBridge rule instead.