0

I am trying to use Django-RQ with Supervisord on Heroku. I think I need to keep a script in the /etc/systemd/system directory so that it can automatically start at system startup, but I'm not sure how this would translate to Heroku

I'm using Heroku CLI to push my other file within the /app directory.

Changes made via heroku run bash command are not permanent.

How do we go about it? Do I need to build a custom buildpack?

chris
  • 1,915
  • 2
  • 13
  • 18
Ronnie
  • 992
  • 1
  • 9
  • 25
  • Had a quick look and I'm not sure you access it according to https://devcenter.heroku.com/articles/process-model `on Ubuntu, systemd is the built-in process manager. On Heroku, the dyno manager provides an analogous mechanism.`. Which would be understandable, because Heroku is supposed to do everything for you. I don't know what you are looking to do, but try to make use of dynos and buildpacks. – Stéphane Bruckert Jun 22 '19 at 22:29
  • Adding another dyno would be an expensive solution, I guess I need to build a custom buildpack itself. – Ronnie Jun 22 '19 at 22:41
  • 1
    Thank you for clarifying. I'm not familiar with Django-RQ (though I'm quite familiar with Django). Looking at its README I wonder if [Heroku Scheduler](https://devcenter.heroku.com/articles/scheduler) might be a better approach for doing this on Heroku. – ChrisGPT was on strike Jun 23 '19 at 00:15
  • I was trying to keep the post short, so I avoided the details, but your edit looks great. I'm already halfway through coding my buildpack, which I see as an overkill for such a small thing! I would definately like an easier approach. Also I had a quick glance at [Heroku Scheduler](https://devcenter.heroku.com/articles/scheduler) and it looks like, the jobs are scheduled on timely basis, whereas my jobs would be triggered by the users! – Ronnie Jun 23 '19 at 00:26
  • I'm still not clear on why you think you need Supervisor, and to be honest I think focusing on that is causing you to miss good options. I don't see any mention of Supervisor in the README for Django-RQ. Maybe something like [Celery](https://devcenter.heroku.com/articles/celery-heroku) would help if you just need to run async jobs? – ChrisGPT was on strike Jun 23 '19 at 16:17
  • Celery is not a good fit for a small-size project. RQ has a lightweight solution instead, and since its a Django app, I'm using `django-rq` integration module to implement it. Now why, `Supervisord`? To create more number of workers, to handle concurrent async tasks. – Ronnie Jun 23 '19 at 17:06
  • I'm still open to any easier and better approach for handling async tasks in the background, which work easily with Django. – Ronnie Jun 23 '19 at 17:08
  • 4
    Turns out it was quite simple! I finally managed to pull it off. If anyone needs an answer to this, kindly upvote this comment, I'll post an answer. – Ronnie Jun 25 '19 at 02:33

0 Answers0