Cron for a load balanced system without appengine

90 views
Skip to first unread message

Gary Fusani

unread,
Mar 21, 2018, 6:53:27 PM3/21/18
to gce-discussion
Hi,

I currently have one vm instance running debian for an apache webserver. I'm eventually going to add another vm, instance group, and load balancer for a website I run.

I want to have a cron job that runs a php script once for all instances, not once per instance. I know that appengine has ways to do it, but was wondering if there's a preferred method when not using appengine.

I'm considering the following workarounds

- a webhook in my site and a completely separate vm with a normal cron job to curl the webhook. I don't like this from a security standpoint.
- setting up a normal cron job on only one of my instances to run the php script. I don't like this because if that instance is down, the script doesn't get run. Defeats the purpose of a load balancer.


Fady (Google Cloud Platform)

unread,
Mar 22, 2018, 1:22:13 PM3/22/18
to gce-discussion

Hello Gary,


At the moment, you can reliably schedule tasks on Google Compute Engine through App Engine Cron. You may check this document for further details. However, Is it possible to explain your use case? As in a default setup, load balancers are often used with identical frontend instances running the web app, while having a separate dedicated database instance (and replicas) as a backend. You may check these documents [1] [2] if you are considering a robust system.


Reply all
Reply to author
Forward
0 new messages