- Make sure you've got the right gems: delayed_job, delayed_job_active_record, workless, heroku
- Make sure you've configured delayed job to use your workless process scaler, and your scaler matches the heroku stack you are running
- Create a Procfile with your worker definition (see gist above)
- Set all required environment variables: APP_NAME, HEROKU_PASSWORD, HEROKU_USER
- I usually use the heroku scheduler app add-on to run my rake task that adds stuff to my jobs table.
I've seen the following HTTP errors when running misconfigured apps:
- 404. This is what you'll get if you are missing the APP_NAME because if you look at the ps_scale method in the heroku gem, it is using that name to build a URL so without it your URL will be broken.
- 401. This is what you'll get if you forget to set the username and password environment variables because the ps_scale method of the heroku api requires authentication.
- 422 (Unprocessable Entity). This is what you'll get if you forget the procfile. It is a shitty error message that is trying to tell you that heroku doesn't know how to create a worker process if you don't define it. Ick.
Allright. Best of luck future me, and whoever else finds this useful.
No comments:
Post a Comment