1

I'm trying to deploy my Ruby on Rails webbapp to Heroku. Locally it works just fine but when I try to run it through Heroku is gives me a H10 error HTTP status 503. I guess it's because of the bash: bundle: command not found. But even running heroku run bundle exec rails server -p $PORT doesn't work.

  2016-04-26T11:35:09.570021+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:35:09.570027+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:36:34.435961+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:36:34.435967+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:06.665673+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:37:06.665682+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:20.446113+00:00 heroku[slug-compiler]: Slug compilation started
    2016-04-26T11:37:20.446119+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Ruby app
    2016-04-26T11:37:26.534228+00:00 heroku[web.1]: State changed from crashed to starting
    2016-04-26T11:37:32.239987+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 48566`
    2016-04-26T11:37:34.485283+00:00 app[web.1]: bash: bundle: command not found
    2016-04-26T11:37:35.145372+00:00 heroku[web.1]: Process exited with status 127
    2016-04-26T11:37:35.160181+00:00 heroku[web.1]: State changed from crashed to starting
    2016-04-26T11:37:35.157438+00:00 heroku[web.1]: State changed from starting to crashed
    2016-04-26T11:37:40.225006+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 57613`
    2016-04-26T11:37:41.536602+00:00 app[web.1]: bash: bundle: command not found
    2016-04-26T11:37:42.254167+00:00 heroku[web.1]: Process exited with status 127
    2016-04-26T11:37:42.273228+00:00 heroku[web.1]: State changed from starting to crashed
    2016-04-26T11:37:43.433890+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=4570bf17-d1d5-46f8-a2fa-9b3903e5f7b8 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:37:43.875014+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=justarandomname-sandbox.herokuapp.com request_id=bef38221-b815-42f0-bff9-a5af6ec9faef fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:37:43.928876+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=justarandomname-sandbox.herokuapp.com request_id=af6d1b23-6fca-4936-831a-8be720931110 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:18.973552+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=bdcbfa80-b930-458c-9838-22d143092149 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:30.012185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=7e6af745-e613-448c-be0e-be6c14c4499e fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:31.797207+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=11006d32-abf4-481e-896e-3da3a9778902 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:33.450964+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=731c163d-73dc-49d8-9334-96621b9afa99 fwd="78.128.33.2" dyno= connect= service= status=503 bytes=
    2016-04-26T11:38:35.451317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=justarandomname-sandbox.herokuapp.com request_id=1bf2c73c-cd8e-4b4a-a9c2-967934186c3f fwd="78.128.33.2" dyno= connect= service= status=503 bytes=

Additional info

Procfile:

web: bundle exec rails server -p $PORT
console: bundle exec rails console

Heroku config vars:

PATH        => bin:vendor/bundle/ruby/2.0.0/bin:qr/qrencode-3.2.0:bin:/.bin:/usr/local/bin:/usr/bin:/bin
GEM_PATH    => vendor/bundle/ruby/2.0.0
RACK_ENV    => production
RAILS_ENV   => production

Heroku buildpacks:

https://github.com/incaztech/heroku-buildpack-qrencode.git

Малъ Скрылевъ
  • 16,187
  • 5
  • 56
  • 69
Kupi
  • 903
  • 1
  • 10
  • 16

1 Answers1

0

I saw you have 3 problem in Gemfile:

  1. You have defined gem 'therubyracer' under ruby clause in assets group, then you've redecrared it for production, and staging environments without clause. That is inconsistence.

  2. You have redefine ruby version for production, and staging environments. That is mistake, thus heroku can't find out bundled gems including bundle executable.

  3. Your log shows some records:

    Your Gemfile lists the gem rails_12factor (>= 0) more than once. You should probably keep only one of them. While it's not a problem now, it could cause errors if you change the version of just one of them later.

    That is incorrect, so to fix it remove gem 'therubyracer', '0.12.1', and gem "qrencoder","~> 1.4.1" from -*production/staging_ group, gem 'rails_12factor' from production group, and then remove ruby "2.3.0" from the same group. Then issue bundle install, next bundle update isn't required, then add resulted Gemfile, and Gemfile.lock to git repo, and commit then, just after that do git push.

Малъ Скрылевъ
  • 16,187
  • 5
  • 56
  • 69
  • Could you specify or post how I have to edit them to make it work, I'm not so familiar with Ruby :s – Kupi Apr 26 '16 at 12:56
  • @Kupi have you also rebundle locally and then updated the `Gemfile.lock`? – Малъ Скрылевъ Apr 26 '16 at 13:16
  • i did all that `bundle install`, `bundle update`, committed, pushed to heroku, still same error occurs – Kupi Apr 26 '16 at 13:37
  • @Kupi can you provide full log heroku after commit? – Малъ Скрылевъ Apr 26 '16 at 13:41
  • @Kupi I haven't seen the `git commit Gemfile.lock` after `bundle install`, `bundle update` isn't required after it. Also I updated post – Малъ Скрылевъ Apr 27 '16 at 06:48
  • @Kupi and I havent seen the error shown in thq question – Малъ Скрылевъ Apr 27 '16 at 06:52
  • I tried all the modifications you sent, but still with no result. The reason why the error of my question wasn't in my previous comment is because the error only occurs when you try to connect to the app thus in the server logs. I included the server logs and the log of my deployment with your fixes in the following link http://pastebin.com/UXraZ3H3 – Kupi Apr 27 '16 at 07:23
  • @Kupi `git commit Gemfile.lock Gemfile` both, as I noted in answer – Малъ Скрылевъ Apr 27 '16 at 07:26
  • @МалъСкрылевъ in his first 'log' at line 297 you can see he used `git commit -am "heroku fix1 27/04/2016"` which would have added the modified Gemfile (line 283) to the commit, after which he pushed those changes to Heroku – Edito Apr 27 '16 at 07:52
  • @Edward that was first, I need to be in last – Малъ Скрылевъ Apr 27 '16 at 07:53
  • @МалъСкрылевъ I referred to the link he posted 4 comments above, if you open the link and go to the first url in his paste `modifications; bundle install; commit; push: http://pastebin.com/mT618LBB` and then to the lines I said, you'll see he did it. – Edito Apr 27 '16 at 07:59
  • @Edward is right, I did commit those like he said, but just to confirm here I do it again http://pastebin.com/kzvTZB2Y – Kupi Apr 27 '16 at 08:13
  • @Kupi no, I saw you staged only the lock file `git commit Gemfile.lock On branch master Your branch is ahead of 'origin/master' by 8 commits. (use "git push" to publish your local commits) Changes not staged for commit: modified: Gemfile` resting the Gemifle itself – Малъ Скрылевъ Apr 27 '16 at 08:14
  • @Kupi well, try access the app. And question: how did you setup PATH variable, I my heroku app I didn't setup it explicitly – Малъ Скрылевъ Apr 27 '16 at 08:19
  • @МалъСкрылевъ `origin\master` is not my heroku repo it is from bitbucket, I don't know how to tell you I use JetBrain RubyMine and all the changes have been committed and pushed to heroku repo `heroku\master` I'm 110% sure. Accessing the app gives the same H10 error in the server logs, as seen in my question. I set the path variables through the web interface on heroku, but it is possible through the terminal. – Kupi Apr 27 '16 at 08:31
  • @Kupi can you drop the PATH value? – Малъ Скрылевъ Apr 27 '16 at 08:38
  • I dropped the PATH variable but still no result – Kupi Apr 27 '16 at 08:59
  • it has only worked locally running `rails server`, I never got it working on heroku – Kupi Apr 27 '16 at 09:18
  • @Kupi well, try to rollback to earlier version and push them to heroku, im seeing the only way. – Малъ Скрылевъ Apr 27 '16 at 09:27