将子目录部署到Heroku

我在GitHub中有一个“超级”存储库,它将包含我想要部署到Heroku的几个应用程序。 这是我的存储库的一个例子。

/app /.git /website <-- would like to deploy this to Heroku 

当我尝试使用以下命令推送时:

 $ git push heroku master 

我收到以下错误:

 Heroku push rejected, no Rails or Rack app detected. 

如何将子目录部署到Heroku?

这可以通过在您的根目录中放置一个config.ru来告知Heroku在哪里找到您的应用程序。 例如,使用Rails 3,在根目录中尝试这样的config.ru:

 WEBSITE_SUBDIR = 'website' require "#{WEBSITE_SUBDIR}/config/environment" run YourApplicationName::Application 

在Rails 2.x上,你需要这样的东西:

 WEBSITE_SUBDIR = 'website' require "#{WEBSITE_SUBDIR}/config/environment" use Rails::Rack::LogTailer use Rails::Rack::Static run ActionController::Dispatcher.new 

你怎么看待在/ app / website中创建一个本地git存储库,并使用Git Hooks,这样当你提交时,它也会提交你的网站代码?

从我的角度来看,基本答案是你需要一个网站级别的git存储库,而不是父级别。 那里的一切都取决于你的观点 – 你是否使用/ website的子模块将/ website作为自己的存储库/ app? (这就是我的方式)

我最近在使用AppGyver Supersonic框架和Heroku应用程序的项目中遇到了同样的问题。

我们的超级应用程序生活在root中,因此也不能让Heroku生活在那里。 最后,我们将Heroku应用程序移动到名为web/的子目录中。 我们现在使用以下方式部署到Heroku:

 git subtree push --prefix web heroku master