From 7d3bba8d785f8979b8fcd02470465a25ddf71ddc Mon Sep 17 00:00:00 2001 From: david kiania Date: Thu, 25 Jun 2026 18:23:17 +0300 Subject: [PATCH] chore(schedule): INC ingest cron -> every 20 min, 06:00-20:40 EAT Was hourly at :15 (15 7-19 * * *); now */20 6-20 * * * for fresher ticket data through the working day. Updates the documented schedule in the Coolify Scheduled Task command, run_ingest.sh, Dockerfile, README, and implementation notes (the live schedule is set in the Coolify UI). Co-Authored-By: Claude Opus 4.8 --- Dockerfile | 2 +- README.md | 6 +++--- docs/implementation.md | 2 +- run_ingest.sh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d91eb92..974e637 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # fleettickets — INC ingestion image (Coolify-deployable). # A small batch/cron worker: it has no web server. Coolify keeps the container # running (CMD below) and fires the ingest via a Scheduled Task: -# python import_tickets.py --from-bucket --apply (cron: 15 7-19 * * *) +# python import_tickets.py --from-bucket --apply (cron: */20 6-20 * * *) # Env (set in Coolify): DATABASE_URL, RUSTFS_*, GEOCODER_*. S3 is via boto3 — no # aws CLI needed. psycopg2-binary ships its own libpq, so no build toolchain. FROM python:3.12-slim diff --git a/README.md b/README.md index 7faa516..4457b69 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Coolify builds it and keeps the container alive (`CMD tail -f /dev/null`); the i runs as a **Scheduled Task**, not a system crontab: - **Command:** `python import_tickets.py --from-bucket --apply` -- **Frequency:** `15 7-19 * * *` (`:15` past each hour, **07:15–19:15 EAT**). This +- **Frequency:** `*/20 6-20 * * *` (every 20 min, **06:00–20:40 EAT**). This Coolify instance runs scheduled tasks in **EAT (Africa/Nairobi)**, so no UTC conversion is needed. - **Env vars** (Coolify → Environment Variables): `DATABASE_URL` (internal DB host), @@ -118,7 +118,7 @@ The watermark makes a run with no new change files a cheap no-op. For a plain host/VM instead of Coolify, [`run_ingest.sh`](run_ingest.sh) loads `.env` and runs the ingest; schedule it with a crontab line -(`CRON_TZ=Africa/Nairobi` / `15 7-19 * * *`). +(`CRON_TZ=Africa/Nairobi` / `*/20 6-20 * * *`). ### Bucket cutover (one-time reseed) @@ -212,7 +212,7 @@ Findings to keep in mind (see the PRD for detail): ## Status / roadmap -Live: INC ingestion deployed on Coolify (hourly `15 7-19 * * *` EAT), schema + +Live: INC ingestion deployed on Coolify (every 20 min `*/20 6-20 * * *` EAT), schema + generated columns + geocoding + the `inc_open_sla` view in `tracksolid_db`. Next (Phase 2): time-series analytics (closure rate, MTTR/SLA trends), then FleetNow vehicle **dispatch** off `geog`, and **team closure attribution**. **CRQ** is a diff --git a/docs/implementation.md b/docs/implementation.md index f26fc11..426ce19 100644 --- a/docs/implementation.md +++ b/docs/implementation.md @@ -54,7 +54,7 @@ What is actually built and deployed, as of the Phase-1 completion. Companion to `TZ=Africa/Nairobi`, keep-alive `tail -f /dev/null`). Separate from the FleetOps web app (`fleet-ops-staging`). - **Scheduled Task:** `python import_tickets.py --from-bucket --apply`, cron - `15 7-19 * * *` in **EAT** (Coolify runs tasks in EAT — no UTC conversion). + `*/20 6-20 * * *` in **EAT** (Coolify runs tasks in EAT — no UTC conversion). - **Env vars** (Coolify): `DATABASE_URL` (internal DB host), `RUSTFS_*`, `GEOCODER_*`. - For a plain host/VM, `run_ingest.sh` + a crontab line is the alternative. diff --git a/run_ingest.sh b/run_ingest.sh index 7ba1683..5593219 100755 --- a/run_ingest.sh +++ b/run_ingest.sh @@ -4,8 +4,8 @@ # Loads env from the local .env (DATABASE_URL + RUSTFS_* + GEOCODER_*) and runs the # newest-INC-CSV ingest with --apply (skip-if-unchanged + archive are built in). # -# Install on the instance (ingest at :15, 07:00–19:00 EAT): -# 15 7-19 * * * /opt/fleettickets/run_ingest.sh >> /var/log/fleettickets-inc.log 2>&1 +# Install on the instance (ingest every 20 min, 06:00–20:40 EAT): +# */20 6-20 * * * /opt/fleettickets/run_ingest.sh >> /var/log/fleettickets-inc.log 2>&1 # Ensure the crontab runs in the Africa/Nairobi timezone (CRON_TZ=Africa/Nairobi or # the host/container TZ), since the export filenames and the schedule are EAT. set -euo pipefail