Continuously Running API Code

We have built a set of continuously running processes that extend Discourse behavior using the Ruby API, observing various conditions and taking actions such as sending PMs, adding users to groups, etc. In hindsight, it may have been better to build this logic as a plugin. Now we are wondering:

  1. Would it be ok / advisable to run this continuously looping set of processes on our DigitalOcean Droplet, say by cloning the repo into a directory under /var, installing Ruby, and running it there?

  2. If not, any other suggestions for a production server to run such a set of processes against a Discourse instance?

  3. Is there any advice, best practice to simplify migrating endpoint-oriented API code to a Plugin?

A plugin would be a lot simpler here, you have access to regular jobs in plugins.

My recommendation would be to read the source of some plugins to get a good picture of what can be done and some of the guides on meta.

4 Likes

Will take that approach, @sam. Thanks for the review. :cowboy_hat_face: