reddec / trusted-cgi

Lightweight runner for lambda functions/apps in CGI like mode
https://trusted-cgi.reddec.net
MIT License
230 stars 16 forks source link

How to run lambdas periodically? #4

Open biozz opened 3 years ago

biozz commented 3 years ago

Hi!

I would like to run some of my lambdas periodically and it seems there is no straightforward way to do that. What I did was I created a ping action, which curls lambda url and thus invokes it.

ping:
    curl https://my.function.url/

This is a hacky solution, but what is the intended way?

Is it possible to add launcher as an action into the scheduler?

Screenshot 2021-01-10 at 01 25 44

ping action on the screenshot is what I use right now and run is what I would like to have

reddec commented 3 years ago

My apologies for the delay reply.

Create a target in Makefile that will run your script. For example, for python:

run:
    echo '{}' | ./venv/bin/python3 app.py

In echo you may use any payload. Than use run as an action in scheduler. Exact command you may find in a Launcher tab.

It will be nice to have some 'sugar' for the convenience, but right now it's not in a backlog, however, PR will be appreciated.