Code Monkey home page Code Monkey logo

kronos's Introduction

Kronos

Kronos allows you to periodically invoke your webhooks using cron expressions.

Features:

  • โšก Easy to use REST API to schedule your webhooks;
  • โฐ Complex scheduling using cron expressions;
  • ๐Ÿ“ฌ Prometheus integration for getting failures notifications.

Build (Go 1.9+)

Run the following command

foo@bar$ make build

to build an executable which will be output to the bin subfolder.

Yaml file configuration

logging:
  level: INFO
  format: JSON

port: 9175

store:
  path: "/path/to/db/file" # default is kronos.bolt

Docker compose configuration

services:
  kronos:
    image: ghcr.io/ostafen/kronos
    ports:
      - '9175:9175'
    environment:
      - PORT=9175 # configuration properties can be overridden through environment variables
      - STORE_PATH=/data/kronos.bolt
    volumes:
      - ./data:/data

Registering a periodic schedule

To start getting some webhook notifications, let's add a new schedule which will be notified every minute:

curl -X POST localhost:9175/schedules -H 'Content-Type: application/json' -d \
'{
    "title": "sample-schedule",
    "description": "a sample schedule description",
    "cronExpr": "0/1 * * * *",
    "url": "your-webhook-address",
    "isRecurring": true,
    "startAt": "2023-02-19T11:34:00Z",
    "endAt": "2023-02-19T11:38:00Z"
}'

On success, the response of the server will be similar to the following:

{
    "id": "1e6d146b-e3b7-4e5c-b7ce-b7b2860f461b",
    "title": "sample-schedule",
    "status": "not_started",
    "description": "a sample schedule description",
    "cronExpr": "0/1 * * * *",
    "url": "your-webhook-address",
    "metadata": null,
    "isRecurring": true,
    "createdAt": "2023-02-19T12:32:30.788562107+01:00",
    "runAt": "0001-01-01T00:00:00Z",
    "startAt": "2023-02-19T11:34:00Z",
    "endAt": "2023-02-19T11:38:00Z",
    "nextScheduleAt": "2023-02-19T11:34:00Z",
}

The above table contains the full list of supported fields:

Parameter Required Description
title true the name of your schedule. It must be unique.
description false an optional description of your schedule.
isRecurring false whether the schedule is recurring or not.
cronExpr if isRecurring = true cron expression for recurring schedules.
url true webhook notification endpoint.
runAt if isRecurring = false for non-recurring schedules, it indicates the instant the schedule will be triggered at.
startAt false UTC start date of the schedule. Must be equal to runAt if isRecurring = false.
endAt false UTC end date of the schedule. Must be equal to runAt if isRecurring = false.
metadata false optional metadata which will be sent when triggering a webhook.

REST API

  • POST /schedules - Register a new schedule
  • GET /schedules/{id} - Get details about an already existing schedule
  • DELETE /schedules/{id} - Delete a schedule
  • POST /schedules/{id}/pause - Pause an active schedule
  • POST /schedules/{id}/resume - Resume a paused schedule
  • POST /schedules/{id}/trigger - Immediately trigger a notification for a given schedule

Contact

Stefano Scafiti @ostafen

License

Kronos source code is available under the MIT License.

kronos's People

Contributors

amarchese96 avatar ostafen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.