If a ruby app is running on Heroku, is it possible to pull changes from Github and run a rake task? I’ve added some code to call exec git pull when an endpoint is requested, however the Heroku logs just tell me that the “App has crashed”. Perhaps Heroku doesn’t allow apps to do this?
Here is my setup:
- An Octopress blog running on Heroku
- A Heroku cedar stack with a heroku-buildpack-ruby-octopress
What I’m attempting to do is expose an endpoint via Sinatra to run the following process:
- Github receives blog post changes
- Github executes the post-receive hook to hit an URL
- App on Heroku receives URL request and does a
git pullandrake generate
You won’t be able to do this because the application you have running on a dyno and the Git repo are two different things.
When you push to Heroku, you’re pushing into Git. This repo is then used to generate a ‘slug’ which is then deployed to dynos. This slug contains your application and all it’s dependencies, not the entire git repo.
Therefore, running any Git commands from your application code will not work.