1 unstable release
Uses new Rust 2024
new 0.1.0 | Apr 25, 2025 |
---|
#8 in #echo
14KB
174 lines
Onqueue
Onqueue is a lightweight, multithreaded task queue runner built in Rust using Axum. It supports REST API and CLI-based task management, making it ideal for automating shell commands, deployment tasks, and lightweight job queues.
๐ฆ Features
- โ Queue tasks with names and commands
- โ Web server using Axum with endpoints to add/list tasks
- โ
CLI support:
onqueue add
,onqueue list
- โ Multithreaded task runner with retry support
- โ
Persistent queue file via
queue.yml
- โ JSON API output
- โ Automatic retries on failure
- โ
Configurable apps via
queue-app.yml
๐งฐ Usage
โถ๏ธ Running the Server
onqueue serve
Server starts on http://localhost:8080
๐ API Endpoints
- GET / โ Show welcome message
- GET /list โ Return current tasks as JSON
- GET /add?name=app1&cmd=echo+Hello โ Queue a new task
๐ฅ๏ธ CLI Usage
Add from queue-app.yml
# queue-app.yml
name: deploy
command: ansible-playbook deploy.yml
onqueue add .
List tasks
onqueue list
๐ Directory Structure
.
โโโ src/
โโโ queue.yml # Stores all queued tasks
โโโ queue-app.yml # CLI-based task configuration
โโโ logs/ # (planned) Directory for task execution logs
โโโ Cargo.toml
โโโ README.md
๐ Example
curl "http://localhost:8080/add?name=build&cmd=echo+Building"
curl "http://localhost:8080/list"
Output:
[
{
"name": "build",
"command": "echo Building",
"status": "completed",
"start_time": "2025-04-07T10:00:00Z",
"end_time": "2025-04-07T10:00:01Z",
"retries": 0
}
]
๐ฃ Roadmap
See FEATURE-TODO-LIST.md for upcoming improvements:
- Logging
- CLI formatting
- Cron-like scheduling
- Persistent task results
- PM2 integration
๐งช Development
Install dependencies:
cargo install --path .
Run in dev mode:
cargo run
โ๏ธ License
MIT ยฉ [Your Name or Org]
Dependencies
~10โ18MB
~241K SLoC