4dauby/schedyt
Schedyt is a simple service for scheduling events.
75
Schedyt schedules events based on the provided time zone, ensuring that scheduled tasks are executed according to the specified region's time. You can find the complete list of frequently used short time-zone names here.
Schedyt is a simple service for scheduling events. An event can be a task, a note, a message, or other types of activities. Events can be scheduled:
Once: For a single occurrence.
At a fixed rate: Repeated at regular intervals.
Over a period: Within a defined time range.
Indefinitely: For ongoing, never-ending repetitions.
Additionally, Schedyt supports RabbitMQ Direct Exchange, enabling precise message routing to specific queues based on routing keys. This feature ensures efficient communication and integration with other services.
To run Schedyt, ensure you have the following tools installed:
Schedyt requires MariaDB and RabbitMQ to operate. Follow these steps to set up and run Schedyt:
docker network create schedyt-network
docker run -d --network schedyt-network --hostname schedyt-db --name schedyt-db --env MYSQL_ROOT_PASSWORD=ro0tPas5wr.d --env MYSQL_DATABASE=schedyt_db mariadb:10.4.4
docker run -d --network schedyt-network --hostname schedyt-broker --name schedyt-broker -p 5672:5672 -p 15672:15672 --env RABBITMQ_DEFAULT_USER=schedyt --env RABBITMQ_DEFAULT_PASS=Pas5wr.d rabbitmq:3.12.4-management-alpine
docker run -d --network schedyt-network --name schedyt-app --env JAVA_OPTS=-Dspring.profiles.active=quick-start -p 8080:8080 4dauby/schedyt:latest
Now schedyt is running follow the steps below to schedule an event.
To schedule for a short time (example: One minute) set the value of the field "triggerDate"
Register Application [Public]
Schedule Event [Client]
curl --location 'http://localhost:8080/v1/applications' \ --header 'Content-Type: application/json' \ --data '{ "name":"foo", "description":"foo description", "exchangeName":"foo.direct", "secret": "myPass", "zoneId":"Asia/Abidjan" }'
"id": "9779548b335c470096c6bc6863348af9"
in the response of the request above. curl --location 'http://localhost:8080/v1/applications/application_id/schedules' \
--header 'Content-Type: application/json' \
--data '{
"eventName":"foo bar",
"triggerDate":"",
"triggerFirstAt":"",
"zoneId":"Africa/Abidjan",
"frequency":1,
"duration":10,
"event":{
"content":"new event successfully scheduled"
},
"routingKey":"event"
}'
docker logs schedyt-app
When the event is triggered on the set date, you'll see a line containing the following text:
[QUICK START][INFO] Event received: {"content":"foo event triggered successfully"}
Schedyt is not run as root. this container has a Non-Root User called kageyama and his directory is /home/kageyama
Schedyt uses two log files to record activities:
access.log
: Logs all HTTP requests.schedyt.log
: Logs all application-related events and messages.Both log files are stored in the directory: /home/kageyama/logs
Example: Mapping Logs to a Host Directory
docker run -d --network schedyt-network --name schedyt-app --env JAVA_OPTS=-Dspring.profiles.active=quick-start \
-v /host/directory:/home/kageyama/logs \
-p 8080:8080 schedyt:latest
Ensure your host directory
/host/directory
has the correct permissions for Docker to write files:sudo chmod -R 777 /host/directory
services:
schedyt-db:
container_name: schedyt-db
image: mariadb:10.4.4
environment:
MYSQL_ROOT_PASSWORD: Pas5wr.d
MYSQL_USER: dbUser
MYSQL_PASSWORD: Pas5wr.d
MYSQL_DATABASE: schedyt_db
ports:
- "3307:3306"
schedyt-broker:
container_name: schedyt-broker
image: rabbitmq:3.12.4-management-alpine
environment:
RABBITMQ_DEFAULT_USER: brokerUser
RABBITMQ_DEFAULT_PASS: Pas5wr.d
ports:
- "5672:5672"
- "15672:15672"
schedyt-app:
container_name: schedyt-app
image: 4dauby/schedyt:latest
restart: on-failure
environment:
JAVA_OPTS: -Dspring.profiles.active=prod-api-key
DB_HOST: schedyt-db
SCHEDYT_DB_USER: dbUser
SCHEDYT_DB_PASSWORD: Pas5wr.d
BROKER_HOST: schedyt-broker
BROKER_USER: brokerUser
BROKER_PASSWORD: Pas5wr.d
BROKER_PORT: 5672
ports:
- "8080:8080"
depends_on:
- schedyt-db
- schedyt-broker
networks:
default:
name: schedyt-net
VARIABLE | DESCRIPTION |
---|---|
DB_HOST | Database host |
SCHEDYT_DB_USER | Database username |
SCHEDYT_DB_PASSWORD | Database user password |
BROKER_HOST | Message broker host |
BROKER_USER | Message broker username |
BROKER_PASSWORD | Message broker user password |
BROKER_PORT | Message broker port |
ADMIN_SECRET | Application admin password. The default value is Pas5w.rd |
Once the application is deployed, the API documentation is available at:
This documentation provides detailed information about all available APIs, including endpoints, request parameters, and response formats.
Schedyt supports multiple Spring profiles to cater to different use cases and environments. Each profile configures the application differently, enabling flexible deployment and feature activation.
1. quick-start:
2. prod-http-basic:
3. prod-api-key:
Set JAVA_OPTS environment
Example: Using HTTP Basic authentication in compose configuration file
...
schedyt-app:
container_name: schedyt-app
image: 4dauby/schedyt:latest
restart: on-failure
environment:
JAVA_OPTS: -Dspring.profiles.active=prod-api-key
...
Schedyt defines two primary roles for applications:
CLIENT:
ADMIN:
GitLab repository
Where to file issues:
This project is licensed under Apache License Version 2.0. See https://gitlab.com/adauby/schedyt/-/blob/main/LICENSE?ref_type=heads for reference.
docker pull 4dauby/schedyt