3

For my PHP Web App I am using the PHP Buildpack. Now I would like to schedule a Tasks that should be triggered every month. Normally I would use CronJobs for that. How can I achieve that within the Swisscom Application Cloud?

Sybil
  • 2,503
  • 3
  • 25
  • 36
Nattha K
  • 103
  • 8

2 Answers2

1

Swisscom App Cloud is based on Open Source Cloud Foundry

Upstream Cloud Foundry doesn’t have a feature equivalent to cron jobs (task scheduler). Stay tuned, I guess this feature will be soon implemented, because lots of people migrating from Heroku to CF. Heroku offers a cron job feature. Subscribe to Swisscom App Cloud Newsletter to read announcements.

There are workarounds for scheduling tasks, see Scheduling tasks on Cloud Foundry on blog.pivotal.io for a Ruby/Rake based example. Sorry for PHP I didn't found example code. There is no elegant solution! You need to implement yourself some kind of workaround. Would be great if you publish your code to GitHub.

If you need cron jobs only in data store, for example MariaDB offers Events.

Events are named database objects containing SQL statements that are to be executed at a later stage, either once off, or at regular intervals.

They function very similarly to the Windows Task Scheduler or Unix cron jobs.

Sybil
  • 2,503
  • 3
  • 25
  • 36
1

We had a simular issue. As written by @Fyodor, there is no native solution in Cloud Foundry. We did some research and found vendors like https://www.iron.io/.

Finally, we ended up with a very simple solution.

  • We expose all our background jobs via an https interface.
  • As we anyhow use Jenkins for CI/CD and it has lots of scheduling capabilities, we use our existing Jenkins to trigger these jobs via a simple cURL call to the HTTP endpoints.
delixfe
  • 2,471
  • 1
  • 21
  • 35