Deploy a subdirectory to Heroku

前端 未结 3 518
小鲜肉
小鲜肉 2020-12-05 14:39

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         


        
相关标签:
3条回答
  • 2020-12-05 14:54

    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)

    0 讨论(0)
  • 2020-12-05 14:55

    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
    
    0 讨论(0)
  • 2020-12-05 15:06

    I recently encountered this same problem on a project using the AppGyver Supersonic framework and a Heroku app.

    Our Supersonic app lived in root so it wasn't an option to have Heroku living there too. In the end we moved our Heroku app to a subdirectory named web/. We now deploy to Heroku using:

    git subtree push --prefix web heroku master
    
    0 讨论(0)
提交回复
热议问题