Product Introduction
- Definition: Cronhq is a distributed, self-hostable cron job scheduler and monitoring platform. Technically, it is a webhook-based job orchestration service built with Rust and PostgreSQL, designed to replace traditional Unix
crontaband unreliable cloud cron services. - Core Value Proposition: Cronhq exists to guarantee exactly-once execution for scheduled tasks across multiple servers, eliminating silent failures, duplicate executions, and missed jobs that plague traditional cron. Its primary value is providing reliable distributed cron with built-in observability, automatic retries, and intelligent alerting.
Main Features
- Exactly-Once Execution via Postgres Advisory Locks: This is the foundational feature. Instead of relying on best-effort coordination, Cronhq uses PostgreSQL's robust advisory locking mechanism. When a job is due, a worker acquires a unique, time-bound lock for that specific execution. This prevents any other worker in the cluster from running the same job, solving the critical problem of duplicate job execution in distributed systems. If a worker crashes mid-execution, the lock eventually expires, allowing another worker to retry.
- HMAC-Signed Webhooks with Per-Job Secrets: Every HTTP request Cronhq sends to your endpoint includes
X-Cronhq-SignatureandX-Cronhq-Timestampheaders. The signature is an HMAC-SHA256 hash of thetimestamp.bodypayload, signed with a unique secret key for each job. This allows you to cryptographically verify that the webhook originated from Cronhq and hasn't been tampered with, a crucial security practice for automated backend calls. - Heartbeat Monitors (Dead-Man's Switch): This inverts the standard cron model. Instead of just monitoring jobs it runs, Cronhq can monitor any periodic process. You configure a URL to ping on a schedule (e.g., every 5 minutes). If the ping is missed within a configured grace period, Cronhq marks the monitor as DOWN and triggers an alert. This is essential for monitoring long-running scripts, worker queues, or external services that Cronhq doesn't directly trigger.
- Intelligent, Deduplicated Alerting: Cronhq implements alerting logic to reduce noise. A failure alert is triggered not on the first failure, but on the third failure within a rolling hour. Conversely, a recovery alert is sent on the first successful run after a failure streak. This "alert once on failure, once on recovery" logic prevents alert fatigue while ensuring engineers are notified of persistent issues and their resolution.
- Cron-as-Code & CLI Tool: Infrastructure is managed declaratively via a
cronhq.yamlfile. Thenpx cronhq synccommand reconciles this file with the Cronhq platform, creating, updating, or pruning jobs. The CLI also allows live-tailing execution logs (npx cronhq jobs tail), enabling developers to integrate job management and monitoring directly into their version control and CI/CD workflows.
Problems Solved
- Pain Point: Silent Cron Failures. Traditional cron provides no native mechanism for alerting on job failure or success. Jobs can fail for weeks without notice. Cronhq solves this with mandatory execution logging, configurable alert channels (Slack, Email), and heartbeat monitoring.
- Pain Point: Duplicate Execution in Distributed Environments. When the same crontab is deployed across multiple servers for redundancy, scheduled jobs can fire simultaneously, leading to critical issues like double billing or data corruption. Cronhq's Postgres lock-based coordination guarantees exactly-once execution, making it safe to run multiple scheduler workers.
- Target Audience: DevOps Engineers and Platform Teams who need reliable orchestration for data pipelines, billing jobs, and database maintenance. Backend and Full-Stack Developers building applications that require scheduled tasks (e.g., sending newsletters, generating reports, cache warming). Startup and SRE Teams that lack the resources to build and maintain a robust internal scheduler but cannot afford job failures.
- Use Cases: Financial Operations: Running nightly invoicing or payroll with a guarantee against duplicates. Data Engineering: Orchestrating ETL (Extract, Transform, Load) pipelines where each batch must run exactly once. System Maintenance: Scheduling database backups, log rotation, or cache purges with failure alerts. Application Health: Using heartbeat monitors to ensure background workers, message queues, or internal APIs remain available.
Unique Advantages
- Differentiation: Unlike basic cloud cron services (e.g., AWS CloudWatch Events, simple cron SaaS) which offer "at-least-once" delivery and minimal observability, Cronhq is built around the exactly-once execution guarantee as a core primitive. Unlike DIY solutions using Redis locks or database flags, it provides a complete, batteries-included product with retries, signing, alerting, and a UI out of the box. Its MIT license and self-hostable single Docker image contrast with purely proprietary SaaS solutions, offering deployment flexibility.
- Key Innovation: The architectural decision to use PostgreSQL advisory locks as the sole coordination primitive is its key innovation. This leverages a battle-tested database's transactional integrity to enforce global consensus, avoiding the complexity and potential failure modes of distributed coordination systems like ZooKeeper or etcd for this specific use case. This results in a simpler, more reliable, and easier-to-self-host system.
Frequently Asked Questions (FAQ)
- How does Cronhq guarantee exactly-once execution? Cronhq uses PostgreSQL advisory locks. When a job's schedule is due, the scheduler attempts to acquire a unique lock for that specific job execution. Only the worker that successfully acquires the lock will execute the webhook. This prevents any other concurrent worker from running the same job, ensuring exactly-once semantics across a distributed fleet of scheduler instances.
- Is Cronhq better than a traditional Unix crontab? For single-server, simple tasks,
crontabmay suffice. However, Cronhq is superior for distributed systems, mission-critical jobs, and when observability is required. It provides centralized logging, failure alerts, retry logic, webhook signing, and a dashboard—features completely absent from standard cron, making it essential for modern, reliable application infrastructure. - Can I self-host Cronhq, and what are the requirements? Yes, Cronhq is MIT-licensed and designed for self-hosting using the same Docker image used by its SaaS offering. The primary requirement is a PostgreSQL database (version 13 or higher). The setup is documented for deployment on any platform that can run Docker containers, such as a private server, AWS EC2, or Google Cloud Run.
- How does Cronhq's pricing and free tier work? Cronhq offers a generous free tier that includes up to 5 jobs with access to all core features: exactly-once execution, retries, signed webhooks, heartbeat monitors, and alerts. This allows small projects or teams to evaluate the platform fully. Paid plans (Developer, Pro) increase job limits, concurrency, and include priority support.
- What happens if the Cronhq service or my self-hosted instance goes down? For the SaaS offering, Cronhq operates with high availability. For self-hosted deployments, high availability is achieved by running multiple instances of the Cronhq worker connected to the same PostgreSQL database. The advisory lock system ensures jobs are still executed exactly once even with multiple workers. If all instances are down, scheduled jobs will be missed until the service is restored, which is why heartbeat monitors for the Cronhq service itself are recommended.
