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 |
- It's pure Rust and lightweight.
- Uses PostgreSQL as database to persist the tasks.
- Has multiple task types, currently it supports
commandanddockertasks. - By leveraging traits, it's a joy to extend StewardX.
- Supports both Dockerfiles and pre-built Docker images.
- Has multiple task frequencies, currently it supports
cronandhook. - Stores outputs of tasks.
- Docker (optional)
- Rust
- git
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 stewardxIf 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.shWhen your instance is up and running, you'll need to state some environment variables.
- STEWARDX_DATABASE_URL
- DATABASE_URL - this one won't be required when prebuilt binaries are released. It's required for now because of SQLx.
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/postgresAwesome! Now we just run:
# Note: This may take a while!
cargo build --releaseIf you get this error:
error: linker `cc` not foundThen install this package (Debian/Ubuntu), then issue the previous command.
sudo apt install build-essentialAnd while you're at it, you may want to install these packages too:
sudo apt install libssl-dev pkg-configWhen to compilation is finished, now you can start StewardX with:
./target/release/stewardxNow 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/tasksThis 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-80691ca86e17You 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#/reportsAnd you'll get your execution report :)
- Build a minimal control panel
- Cover errors
- Test coverage
- Write documentation - StewardX Docs
- Use features to make panel and docker features optional
- Precompiled binaries (Currently linux only)
- Create distributed worker system
- Add websocket support
- Add one or more task types
- Create a CLI app - 🥳
- Create a cute logo - 🥳
- Create examples
- Create a landing page
- Create a GUI controller
- Ability to delay tasks' execution?
Licensed under
- Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)