Question

Are you able to schedule Functions?

I’m interested in using App Platform to deploy my project back-end. This will include a Web Service and Managed Dbs. In addition, I also want to run daily processing jobs and it looks like I could tap into Functions for this.

It’s my understanding that DigitalOcean functions can be run on a schedule so, for example, a Go program to process and collect data runs every day at 2AM. However, when I look at DigitalOcean documentation for scheduling functions it says under Limits:

“Scheduled triggers are not yet available for function components deployed through App Platform.”

Does this mean if I have a Web Service deployed via App Platform and I want to add a Function to it, then I won’t be able to schedule it? Or am I not understanding the documentation correctly?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Greg M
DigitalOcean Employee
DigitalOcean Employee badge
November 30, 2022

So I think this has two parts to answer your question:

  • App Platform <> functions currently support HTTP ingress activation, meaning that if you were to request the function at the App’s domain for the function component’s route, you will be able to run your function through HTTP. (https://mycoolapp.digitalocean.app/my-function/path/to/function)
  • At this time there isn’t a DigitalOcean provided mechanism to schedule something to run a function a particular time.

That isn’t to say that you can’t build this behavior yourself.

For example, if you had a subroutine in a web service or worker component that simply watched the time in a loop and reached out to the function component’s URI at a specific time, you can achieve what you’re trying to implement for the most part.

This isn’t a fault-tolerant approach, and it wouldn’t be idempotent by default. Things that go wrong could be:

  • If you had multiple replicas of your worker/service, it would hit the function url ${num replicas} times.
  • If your worker/service restarts around the time that you’re looking to schedule your function, it may not be scheduled.

These are problems that can be solved with a more robust design, and probably should be designed in such a manner when in a production context, but is currently how functions can be scheduled at specific times through App Platform.