Scheduled Task Executor With Asynchronous Runtime and Database X
Scheduled Task Executor With Asynchronous Runtime and Database X
Because all the cool stuff have an X…
StewardX is a task scheduler written in pure Rust. By leveraging tokio, it is asynchronous and blazing-fast!
This project is under heavy development, it can (and probably will) break. Please do not use in production yet
Repository | Description |
---|---|
Panel | Proof of concept control panel |
Documentation | Documentation repository |
CLI | StewardX CLI |
command
and docker
tasks.cron
and hook
.Until the prebuilt binaries are released, (Linux x64 binaries are released WOOT 🥳) you can build StewardX on your own.
First install the Rust itself by following the instructions on: Rustup
Then clone the repository
git clone https://github.com/gokayokyay/stewardx
cd stewardx
If you don’t want to use Docker, then please disable the docker
feature in Cargo.toml in the root of repository. To disable it, just remove the “docker” item from the default
key of [features]
. So it’ll look like
default = ["panel", "cmd"]
You’ll need a running Postgres instance. If you got one, you can skip this step. But if you don’t, there’re some utility scripts in scripts folder located in the root of the repository. For simplicity’s sake, let’s just use the temporary one, docker-postgres-temp.sh
.
chmod +x ./scripts/docker-postgres-temp.sh
./scripts/docker-postgres-temp.sh
When your instance is up and running, you’ll need to state some environment variables.
Let’s define those variables:
# Replace the db url with your own if you skipped previos step
export DATABASE_URL=postgresql://postgres:1234@localhost:5432/postgres
export STEWARDX_DATABASE_URL=postgresql://postgres:1234@localhost:5432/postgres
Awesome! Now we just run:
# Note: This may take a while!
cargo build --release
If you get this error:
error: linker `cc` not found
Then install this package (Debian/Ubuntu), then issue the previous command.
sudo apt install build-essential
And while you’re at it, you may want to install these packages too:
sudo apt install libssl-dev pkg-config
When to compilation is finished, now you can start StewardX with:
./target/release/stewardx
Now add your first CmdTask
with frequency of Hook
(Basically a webhook). From another terminal run:
curl --header "Content-Type: application/json" -X POST --data '{"task_name": "My test task", "frequency": "Hook", "task_type": "CmdTask", "task_props": {"command":"echo Hello StewardX!"}}' http://localhost:3000/tasks
This command will output an id, save it somewhere, mine was “08234e0c-63b8-420a-a4fc-80691ca86e17”. To execute your previous task, run:
# curl --header "Content-Type: application/json" -X POST http://localhost:3000/#id from previous step
curl --header "Content-Type: application/json" -X POST http://localhost:3000/execute/08234e0c-63b8-420a-a4fc-80691ca86e17
You should get this response:
{"status":"success"}
Awesome! You may be wondering, where’s the output of the task? It’s easy! In the database. Just run:
curl --header "Content-Type: application/json" http://localhost:3000/task/#your task id#/reports
And you’ll get your execution report :)
Licensed under