An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# ๐Ÿš€ Invoke

![Invoke Logo](https://i.imgur.com/HfXxZso.png)

**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.