diff --git a/farm-aggregator/render.yaml b/farm-aggregator/render.yaml index 7338144..1711266 100644 --- a/farm-aggregator/render.yaml +++ b/farm-aggregator/render.yaml @@ -1,14 +1,13 @@ services: - - type: web - name: farm-aggregator + - type: cron + name: farm-pulse runtime: node rootDir: farm-aggregator buildCommand: npm install - startCommand: node index.js - plan: starter - envVars: - - key: NODE_ENV - value: production + startCommand: node scripts/run-pulse.js + schedule: "0 * * * *" + plan: free + envVars: &env - key: ANTHROPIC_API_KEY sync: false - key: AGREFINE_API_URL @@ -37,9 +36,23 @@ services: sync: false - key: TOMTOM_API_KEY sync: false - - key: PULSE_SCHEDULE - value: "0 * * * *" - - key: DAILY_SCHEDULE - value: "0 6 * * *" - - key: WEEKLY_SCHEDULE - value: "0 6 * * 1" + + - type: cron + name: farm-daily-digest + runtime: node + rootDir: farm-aggregator + buildCommand: npm install + startCommand: node scripts/run-daily.js + schedule: "0 6 * * *" + plan: free + envVars: *env + + - type: cron + name: farm-weekly-summary + runtime: node + rootDir: farm-aggregator + buildCommand: npm install + startCommand: node scripts/run-weekly.js + schedule: "0 6 * * 1" + plan: free + envVars: *env diff --git a/farm-aggregator/scripts/run-daily.js b/farm-aggregator/scripts/run-daily.js new file mode 100644 index 0000000..7d6f060 --- /dev/null +++ b/farm-aggregator/scripts/run-daily.js @@ -0,0 +1,2 @@ +import { runDaily } from '../jobs/digest.js'; +runDaily().then(() => process.exit(0)).catch((e) => { console.error(e); process.exit(1); }); diff --git a/farm-aggregator/scripts/run-pulse.js b/farm-aggregator/scripts/run-pulse.js new file mode 100644 index 0000000..fba194b --- /dev/null +++ b/farm-aggregator/scripts/run-pulse.js @@ -0,0 +1,2 @@ +import { runPulse } from '../jobs/pulse.js'; +runPulse().then(() => process.exit(0)).catch((e) => { console.error(e); process.exit(1); }); diff --git a/farm-aggregator/scripts/run-weekly.js b/farm-aggregator/scripts/run-weekly.js new file mode 100644 index 0000000..405d548 --- /dev/null +++ b/farm-aggregator/scripts/run-weekly.js @@ -0,0 +1,2 @@ +import { runWeekly } from '../jobs/digest.js'; +runWeekly().then(() => process.exit(0)).catch((e) => { console.error(e); process.exit(1); });