1

I have a rails app running on Heroku. I have it set to watch a branch on Github so that it automatically 'builds' and updates when I push a commit to that branch. Awesome.

I have a file in my repo scripts/dostuff.rb.

I want Heroku to fire off that script each time it 'builds' my rails app.

Google is not my friend with this one. How can I have my dostuff.rb script automatically run each time Heroku re-deploys my app?

2 Answers 2

3

Release Phase is the thing you want.
You'll be able to specify the process you want to run as a release process type in your procfile.

Then, that process will be executed automatically by heroku with every new release (build, config var changes, rollbacks, ...).
The new release will not be used on the app until the script has successfully exited.

Sign up to request clarification or add additional context in comments.

Comments

1

Have you seen this library before? https://github.com/weibeld/heroku-buildpack-run

You should be able to get this to fire the script on each compile.

Another option is to tweak your push command to something like:

$ git push heroku master && heroku run rake 'dostuff:run'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.