https://github.com/farzammadani/invoke
Lightweight, YAML-based cronjob runner built with Symfony and Docker.
https://github.com/farzammadani/invoke
automation cron cronjob cronjob-scheduler php8 symfony yaml
Last synced: about 2 months ago
JSON representation
Lightweight, YAML-based cronjob runner built with Symfony and Docker.
- Host: GitHub
- URL: https://github.com/farzammadani/invoke
- Owner: farzammadani
- Created: 2025-05-14T17:19:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-17T07:28:30.000Z (about 1 year ago)
- Last Synced: 2025-06-22T11:32:48.492Z (about 1 year ago)
- Topics: automation, cron, cronjob, cronjob-scheduler, php8, symfony, yaml
- Language: PHP
- Homepage:
- Size: 176 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ๐ Invoke

**Invoke** is a lightweight, YAML-driven cronjob runner built with Symfony and Docker.
It allows developers to define HTTP-based jobs as simple `.yaml` files, and have them executed on schedule โ with minimal dependencies, no dashboard, and no database configuration overhead (except for tracking execution history).
---
## โจ Features
- ๐งพ Jobs defined in `config/cronjobs/*.yaml`
- ๐ Cron-style scheduling (via `dragonmantank/cron-expression`)
- ๐ Runs jobs every minute using Symfony console command
- ๐พ Stores run history (UUID, timestamp, status, duration, message) in PostgreSQL
- ๐งช Includes a local stub server for testing HTTP behavior
- ๐ณ Docker-based with clean separation of app + database + cron
---
## ๐ YAML Job Format Example
```yaml
name: "Notify"
schedule: "53 11 * * *"
url: "http://localhost:9999"
method: POST
payload:
keep_days: 30
headers:
env:
valueFrom: "CronValueProviders\\ApiEndpointTokenProvider"
enabled: true
````
---
## ๐ Usage
### 1. Clone & boot
```bash
git clone https://github.com/your-org/invoke.git
cd invoke
cp .env .env.local
make up
make composer-install
```
### 2. Run the stub server (for local testing)
```bash
make stub-server
```
Then test a real HTTP job via:
```bash
php bin/console dev:job:run
```
### 3. Apply database migration
```bash
make doctrine-create-db
make doctrine-make-migration
make doctrine-migrate
```
### 4. Run scheduled jobs manually
```bash
php bin/console app:perform-due
```
---
## โฑ Automate: Run Jobs Every Minute via Docker
Add a cron container in `docker-compose.yml` that runs:
```bash
php bin/console app:perform-due
```
Or use host cron to call it into the container:
```bash
* * * * * docker exec invoke_app php /var/www/bin/console app:perform-due
```
---
## ๐ง Architecture Summary
* `YamlJobParser` โ parses all `.yaml` files
* `DueTimeEvaluator` โ checks if job is due
* `JobRunner` โ executes via HTTP
* `PerformedJobsRepository` โ tracks if job ran, stores run metadata
* `PerformDueJobsCommand` โ the orchestrator
---
## ๐งช Testing
```bash
make test-integration GROUP=kiwi
```
You can also run stubbed `dev:job:run` commands against a local stub server.
---
## ๐งฐ Tools
* PHP 8.2
* Symfony 6+
* PostgreSQL 16
* Docker / Docker Compose
* Codeception (for integration tests)
---
## ๐งโ๐ป Contributing
This project is meant to be simple by design. Please keep contributions lightweight and config-first wherever possible.