Hi, I was wondering if it is possible to add an runit service in a plugin? If thats not possible I would be glad to hear about your strategies to deal with this kind of issue: I have a long running cpp program that needs to run next to discourse. It should be restarted automatically and basically behave like a daemon. thaaanks
You can install stuff within app.yml and run system commands within rails to check and execute stuff. You could wrap a despatcher in a regular job?
this is really cumbersome. Ideally everything happens in the plugin.
thank you for your answer.
The pattern seems the correct one to me as the templates are like docker composers.
I use this to clone and make dumb frotz in the Discourse Frotz plugin. It’s rock solid.
For some long running jobs in a plugin I wrote I used the jobs interface to crank up some ansible tasks that can take hours to complete.
But if it’s “next to” then a template in the app.yml seems appropriate ; if it’s “started by Discourse” then a job makes sense.
It is not. Inside the container all plugin code runs as the discourse
user. That user does not have sufficient permissions (inside the container again) to control runit services.
Run the process in another Docker container on the same hardware. It should listen on a local TCP port. Export the URL to connect to the other service in the env:
block in app.yaml
, e.g.:
env:
CUSTOM_SERVICE_URL: 'localhost:5309'
Have the plugin find the connection string via ENV["CUSTOM_SERVICE_URL"]