HUB
Sign inSign up

cronouss/cronous

By cronouss

•Updated about 4 hours ago

Self-hosted distributed job scheduler: cron, delayed & queue jobs with retries (API + worker)

Image
Networking
Message queues
API management
0

365

cronouss/cronous repository overview

⁠Chronos

Self-hosted, distributed job scheduler. Run cron and one-time schedules, immediate and delayed background jobs, and queues with retries. Every attempt is tracked durably in PostgreSQL, and crashed workers are recovered.

This image contains the API server, scheduler, worker and database migrations. The optional web dashboard is cronouss/cronous-dashboard⁠.

⁠Tags

TagMeaning
latestNewest release
0.1, 0.1.1, …A minor line, or an exact version (recommended for production)

Images are built for linux/amd64 and linux/arm64.

⁠What it does

  • Schedules: 5-field cron or one-time runAt, time zones and DST, misfire policies, overlap control
  • Queue jobs: run now or after a delay, with priorities, per-queue and per-job concurrency limits, pause/resume, JSON Schema payload validation
  • Three ways to run a job:
    • HTTP webhook: Chronos calls your endpoint, signed and SSRF-protected
    • Agent: your app runs the handler through the SDK over an outbound WebSocket
    • Central worker: this image runs handler modules you mount
  • Reliability: retries with exponential backoff, dead letters and replay, leases with fencing, and recovery from crashes. Delivery is at least once.
  • API: REST API with organizations, projects, roles, revocable credentials, an audit log, statistics and Server-Sent Events

⁠Docker Compose

Save this as compose.yaml. It runs Chronos with PostgreSQL, Redis and the web dashboard:

services:
  postgres:
    image: postgres:17-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: chronos
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
      POSTGRES_DB: chronos
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U chronos -d chronos"]
      interval: 5s
      timeout: 3s
      retries: 20

  redis:
    image: redis:7.4-alpine
    restart: unless-stopped
    command: ["sh", "-c", "exec redis-server --appendonly yes --maxmemory-policy noeviction --requirepass \"$$REDIS_PASSWORD\""]
    environment:
      REDIS_PASSWORD: ${REDIS_PASSWORD:?set REDIS_PASSWORD in .env}
    volumes:
      - redis-data:/data
    healthcheck:
      test: ["CMD-SHELL", "redis-cli -a \"$$REDIS_PASSWORD\" --no-auth-warning ping | grep -q PONG"]
      interval: 5s
      timeout: 3s
      retries: 20

  chronos:
    image: cronouss/cronous:0.1.1
    restart: unless-stopped
    environment:
      DATABASE_URL: postgresql://chronos:${POSTGRES_PASSWORD}@postgres:5432/chronos
      REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
      CHRONOS_MIGRATE_ON_START: "true"
    ports:
      - "127.0.0.1:8080:8080"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy

  dashboard:
    image: cronouss/cronous-dashboard:0.1.1
    restart: unless-stopped
    environment:
      CHRONOS_API_URL: http://chronos:8080
    ports:
      - "127.0.0.1:3000:3000"
    depends_on:
      chronos:
        condition: service_healthy

volumes:
  postgres-data:
  redis-data:

Create a .env file next to it with two passwords (hex is URL-safe), then start the stack:

echo "POSTGRES_PASSWORD=$(openssl rand -hex 32)" >  .env
echo "REDIS_PASSWORD=$(openssl rand -hex 32)"    >> .env

docker compose up -d
docker compose logs chronos | grep -A2 "bootstrap token"
⁠Add Chronos to an existing Compose project

If your compose.yaml already has PostgreSQL and Redis, add only this service. Create a chronos database first, and make sure Redis uses maxmemory-policy noeviction:

  chronos:
    image: cronouss/cronous:0.1.1
    restart: unless-stopped
    environment:
      DATABASE_URL: postgresql://chronos:PASSWORD@postgres:5432/chronos
      REDIS_URL: redis://:PASSWORD@redis:6379/3
      CHRONOS_MIGRATE_ON_START: "true"
    ports:
      - "127.0.0.1:8080:8080"
    depends_on:
      - postgres
      - redis

Your other services reach it at http://chronos:8080.

The full compose file from the releases also includes optional workers and a standalone scheduler: curl -fsSLO https://github.com/mdsharifulislam-r/cronous/releases/latest/download/compose.yaml

⁠Quick start: your own PostgreSQL and Redis

docker run -d --name chronos --restart unless-stopped \
  -p 127.0.0.1:8080:8080 \
  -e DATABASE_URL=postgresql://chronos:PASSWORD@db-host:5432/chronos \
  -e REDIS_URL=redis://:PASSWORD@redis-host:6379/0 \
  -e CHRONOS_MIGRATE_ON_START=true \
  cronouss/cronous:latest

Requirements: PostgreSQL 17 and Redis 7.4 (verified). Redis must use maxmemory-policy noeviction. Chronos prefixes all its Redis keys, so it can share a Redis instance with your applications.

⁠First-time setup

On first start, the server prints a one-time bootstrap token in its log (docker logs chronos). Use it once to create the admin user, organization and first project:

curl -sS -X POST http://127.0.0.1:8080/v1/bootstrap \
  -H "Authorization: Bearer $BOOTSTRAP_TOKEN" -H 'Content-Type: application/json' \
  -d '{"admin":{"email":"[email protected]","name":"You","password":"a-long-passphrase"},
       "organization":{"name":"Acme","slug":"acme"},
       "project":{"name":"Storefront","slug":"storefront","timezone":"UTC"}}'

The response contains a project API key (chr_p_…) and an agent token (chr_a_…). They are shown only once, so store them safely. You can also open the built-in UI at http://127.0.0.1:8080/dashboard/.

⁠Commands

The same image runs every role:

CommandRole
(default) node dist/main.jsAPI server, with the scheduler and webhook worker embedded
node bin/scheduler/main.jsStandalone scheduler (set CHRONOS_EMBEDDED_SCHEDULER=false on the server)
node bin/worker/main.jsCentral worker running your mounted handlers (CHRONOS_WORKER_HANDLERS=/handlers/handlers.js)
/app/bin/migrateApply database migrations and exit

⁠Main environment variables

VariableDefaultDescription
DATABASE_URLrequiredPostgreSQL connection URL
REDIS_URLrequiredRedis connection URL (rediss:// for TLS)
CHRONOS_MIGRATE_ON_STARTfalseApply pending migrations before starting (safe with several replicas)
CHRONOS_BOOTSTRAP_TOKENgeneratedSet your own one-time setup token instead of reading it from the log
CHRONOS_NAMESPACEchronosPrefix for Redis keys and queues
PORT8080Listen port
LOG_LEVELinfofatal … trace
CHRONOS_TRUST_PROXYfalseEnable only behind your own reverse proxy
CHRONOS_CORS_ORIGINSemptyBrowser origins allowed to call the API directly
CHRONOS_EMBEDDED_SCHEDULER / CHRONOS_EMBEDDED_WORKERtrueRun scheduling and webhook delivery inside the server
CHRONOS_WORKER_CONCURRENCY10Parallel executions per worker
CHRONOS_EXECUTION_RETENTION_DAYS30How long finished executions are kept

All variables are listed in the environment reference⁠.

⁠Health checks

  • GET /health/live: the process is up
  • GET /health/ready: PostgreSQL and Redis are reachable (503 otherwise)

The image has a built-in HEALTHCHECK, runs as the unprivileged node user, uses tini as init, and stops gracefully on SIGTERM.

⁠Use it from your application (Node.js)

npm install @cronous/cronous
import { Chronos } from '@cronous/cronous';

const chronos = new Chronos({ server: 'https://chronos.example.com', project: 'storefront' }); // CHRONOS_AGENT_TOKEN
chronos.task('daily-report', { schedule: '0 2 * * *' }, async (ctx) => { /* … */ });
await chronos.start();

await chronos.queue('send-email', { to: '[email protected]' }, { delay: 60_000 });

⁠Production notes

  • Keep the API on 127.0.0.1 or a private network. Put a TLS reverse proxy in front before you expose it.
  • Pin an exact version tag, and back up PostgreSQL: it holds all definitions, history and credentials.
  • See the deployment guide⁠ for topologies, scaling and upgrades.

Tag summary

Content type

Image

Digest

sha256:373871744…

Size

171.5 MB

Last updated

about 4 hours ago

docker pull cronouss/cronous