Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/openfaas/cron-connector
Invoke functions on a schedule.
https://github.com/openfaas/cron-connector
Last synced: about 1 month ago
JSON representation
Invoke functions on a schedule.
- Host: GitHub
- URL: https://github.com/openfaas/cron-connector
- Owner: openfaas
- License: mit
- Created: 2019-12-02T20:14:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-02T15:45:57.000Z (over 2 years ago)
- Last Synced: 2024-08-04T01:19:59.787Z (4 months ago)
- Language: Go
- Homepage:
- Size: 271 KB
- Stars: 39
- Watchers: 2
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Invoke your functions on a cron schedule
This is a cron event connector for OpenFaaS. This was built to provide a timer interface to trigger OpenFaaS functions. Also checkout [OpenFaaS docs on cron](https://docs.openfaas.com/reference/cron/) for other methods on how you can run functions triggered by cron.
This project was forked from [zeerorg/cron-connector](https://github.com/openfaas/cron-connector) to enable prompt updates and patches for end-users.
## How to Use
First, [deploy OpenFaaS with faasd or Kubernetes](https://docs.openfaas.com/deployment/)
### Deploy the connector for Kubernetes
For Kubernetes, see: [Scheduling function runs](https://docs.openfaas.com/reference/cron/)
### Deploy the connector for faasd
For faasd, see [Serverless For Everyone Else](https://gumroad.com/l/serverless-for-everyone-else).
### Trigger a function from Cron
The function should have 2 annotations:
1. `topic` annotation should be `cron-function`.
2. `schedule` annotation should be the cron schedule on which to invoke functionFor example, we may have a function "nodeinfo" which we want to invoke every 5 minutes:
Deploy via the CLI:
```bash
faas-cli store deploy nodeinfo \
--annotation schedule="*/5 * * * *" \
--annotation topic=cron-function
```Or via `stack.yml`:
```yaml
functions:
nodeinfo:
image: functions/nodeinfo
annotations:
topic: cron-function
schedule: "*/5 * * * *"
```You can learn how to create and test the [Cron syntax here](https://crontab.guru/every-5-minutes).