kronos/README.md
2026-03-16 21:06:33 +01:00

79 lines
4.6 KiB
Markdown

# kronos
Share events between services.
## Setup
Nix is required.
- Set up environment.
```bash
direnv allow
```
- Set up pre-commit hooks.
```bash
pre-commit install
```
- Install as editable package.
```bash
pip install -e .
```
## Run
Once installed, run:
```bash
kronos
```
TODO: add parameters.
TODO: add info on how to run as a Podman service.
## High level design
`kronos` is an application able to sync events from a single source of truth to multiple consumer services.
E.g., an event defined by Mobilizon is modified -> Discord, Meetup, any other, are updated.
It is deployed as a Docker container, running as a service.
Persistent storage is required for SQLite database.
Secrets management is used to handle credentials.
`systemd` timer is configured to trigger the app.
E.g., `kronos` is being run every three hours to perform events update.
Each app run performs the following:
- Request event data from source of truth service (e.g., Mobilizon).
- Compare event data between received and stored in the database.
- Update if new data available (last change date is later than known).
- Stop execution otherwise.
- Send updates event data to consumers.
```plain
┌───────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ CONTAINER │
│ │
│ ┌───────────────┐ ┌────────┐ │
│ │ │ │ │ │
│ │ systemd timer │ │ volume │ │
│ │ │ │ │ │
│ └───────┬───────┘ └────┬───┘ │
│ │ │ │
│ ┌────────────────────┴────────────────────────────┼─────────────────────────────────────────┐ │
│ │ │ │ │
│ │ APP │ │ │
│ │ ┌───────────────┐ ┌────┴─────┐ ┌────────────────┐ │ │
│ │ trigger │ │ event data │ │ event data │ │ │ │
│ │ ──────────►│ data provider ├──────────────►│ database ├───────────────►│ data consumers │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ └───────────────┘ └──────────┘ └────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
```