简体   繁体   中英

How to use delayed_job with Rails on Google App Engine?

This may be more of an App Engine question than a delayed_job question. But generally, how can I keep a long-lived process running to handling the scheduling of notifications and the sending of scheduled notifications on Google App Engine?

The maintainers of active_job https://github.com/collectiveidea/delayed_job include a script for production deploys, but this seems to stop after a few hours. Trying to figure out the best approach to ensure that the script stays running, and also that the script is able to access the logs for debugging purposes.

I believe that Google Pub/Sub is also a possibility, but I would ideally like to avoid setting up additional infrastructure for such a small project.

For running long processes that last for hours, App Engine will not be the ideal solution, since the requests are cap to 60 s (GAE Standard) and 60 m (GAE Flex).

The best would be to use a Compute Engine based solution, since the you would be able to keep the GCE VM up for long periods.

Once you have deployed on your GCE VM a RESTful application you can use Cloud Scheduler to create an scheduled job with this command:

gcloud scheduler jobs create http JOB --schedule=SCHEDULE --uri=APP_PATH

You can find more about this solution in this article

If App Engine is required take into consideration the mentioned maximum request times. And additionally you can give a look to Cloud Tasks , since those fit pretty much into your requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM