I have one 'super' repository in GitHub which will contain several applications I would like to deploy to Heroku. Here is an example of my repository.
/app
/.git
/website <-- would like to deploy this to Heroku
When I try to push using the following command:
$ git push heroku master
I get the following error:
Heroku push rejected, no Rails or Rack app detected.
How do I deploy a subdirectory to Heroku?
To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.
Heroku Button is no longer limited to source code hosted in public GitHub repos. It now works with both public and private GitHub repos.
This can be accomplished by putting a config.ru in your root directory that tells Heroku where to find your app. For example, with Rails 3, try a config.ru like this in your root directory:
WEBSITE_SUBDIR = 'website'
require "#{WEBSITE_SUBDIR}/config/environment"
run YourApplicationName::Application
And on Rails 2.x, you'll need something like this:
WEBSITE_SUBDIR = 'website'
require "#{WEBSITE_SUBDIR}/config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With