Report this

What is the reason for this report?

Cronjob component on the app platform

Posted on March 8, 2021

The pricing of the app platform starts with $5. And I do need a cronjob component for my Laravel apps, though each cronjob component is $5. To set up my (D)TAP envs (3 envs) I need 3x this component. Is this the only way to go, or is there a way to share this component on all my apps or only the (D)TAP envs?



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!

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.

Just to clarify, we don’t have a cronjob type of component available on App Platform yet, so I assume you are using a worker and orchestrating the cron job yourself.

As far as supporting your various environments in the cron job, you would need to create a separate component and modify the environment variables accordingly for each component. We don’t have any concept like environments to accomplish what you described above.

The only other option I can think of would be to pass in all relevant environment variables (possibly with a prefix like STAGING_...) and then orchestrate your cronjob to be able to handle of the various types of environment variables based on the prefix.

Also, same dilemma!

I think using Docker and setting cronjobs in the yaml configuration is the best alternative.

Hi,

We recently launched Scheduled Functions (it’s in beta currently) which accomplishes what you’re looking to do. Scheduled Functions are not yet supported via App Platform Function components, so you would need to create a stand-alone Cloud Function which calls the API of your App Platform Service. Alternatively, you can do whatever work you need to do inside the function as long as it is within the runtime length limits of Functions (15 min max).

https://docs.digitalocean.com/products/functions/how-to/schedule-functions/

Hope this helps,

Elan

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.