views:

132

answers:

2

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?

+1  A: 

What do you think about creating a local git repository in /app/website, and using Git Hooks so that when you commit, it'll commit your website code as well?

The basic answer, from my perspective, is that you'll want a git repository at the website level, not a parent level. Everything from there depends on your point of view -- do you wan the /website to be its own repository with /app using a submodule for /website? (That's the way I'd go)

Jesse Wolgamott
Jesse, it seems from further research that having to create another repo is the only option. You could join the repos using submodules but what would be the point then.If you have an example of using the web hooks option, that may be helpful to many.
Jamie Wright
+4  A: 

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 Rails3MemcacheExample::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
Adam Wiggins
Adam - thanks for your response. I have decided against deploying a full repo to heroku because I do not want to deploy the additional directories but this looks like a clean solution.
Jamie Wright