1

I'm relatively new to a lot of the stack I'm using and have run into a problem deploying to Heroku.

I'm hoping this is a simple thing as I'm not very familiar with Heroku even though I've trawled StackOverflow, Heroku's site, Google and everywhere else I can think of but no joy.

Here's the issue:

  1. I create a local Padrino app
  2. I go through the normal process to deploy straight to Heroku using git
  3. It detects it as a Ruby/Rack app and everything is happy
  4. I add the gem neo4jrb/neo4j
  5. I deploy again
  6. This time it thinks it's a Ruby/Rails app and won't run

From what I can find Heroku uses the config.ru file to detect a Rack app and the use of Rails in the Gemfile.lock to detect a Rails app.

The neo4j gem has a dependency on 'railties' which in turn has a dependency on 'actionpack' which in turn has a dependency on 'rails-dom-testing' and 'rails-html-sanitizer'. So both of these rails sounding gems are in the Gemfile.lock.

My assumption is that the attempt to detect Rails happens first, it sees some rails related items in the Gemfile.lock and then treats it as a Rails app from then on.

Is there a way to tell Heroku to treat it as a Rack app regardless of what the detection thinks?

Thanks, Gav

Gav
  • 13
  • 3
  • I think Brian's solution is the long term fix but I also found a work-around. I forked the buildpack: https://github.com/bunsen/heroku-buildpack-ruby and removed the Rails checks so it only looks for Rack... Effectively forcing it to stick with Rack if it finds it. – Gav Mar 19 '15 at 06:09

1 Answers1

1

Interestingly when I run bundle locally I get a dependency conflict

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    neo4j (>= 0) ruby depends on
      railties (~> 4) ruby depends on
        actionpack (= 4.2.0) ruby depends on
          rack (~> 1.6.0) ruby

    padrino (= 0.12.5) ruby depends on
      padrino-core (= 0.12.5) ruby depends on
        rack (1.5.2)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    neo4j (>= 0) ruby depends on
      railties (~> 4) ruby depends on
        activesupport (= 4.0.0) ruby

    padrino (= 0.12.5) ruby depends on
      padrino-core (= 0.12.5) ruby depends on
        activesupport (4.2.0)

So removing railties as a dependency seemed like a good thing to do. I've just changed it to a development_dependency in the gemspec file for the just released 4.1.5 because it's needed for one of our specs, but it shouldn't affect you. I just tried it and it seemed to work.

It would probably be good to have a separate neo4j-rails gem instead which contains this stuff in addition to having padrino support however that would be accomplished.

Brian Underwood
  • 10,746
  • 1
  • 22
  • 34