Heroku Rails app R11 error - heroku

I'm deploying a Rails 3.2.11 app on Heroku with Thin as my server. When I push to Heroku, it boots Thin just fine, but then it seems to also try to boot WEBrick.
My Procfile is as follows:
web: bundle exec rails server -p $PORT thin -e $RACK_ENV
And my Heroku logs:
2013-04-11T14:52:28.276634+00:00 heroku[api]: Release v21 created by XXXXXX#gmail.com
2013-04-11T14:52:28.331285+00:00 heroku[api]: Deploy 6f63ed4 by XXXXXX#gmail.com
2013-04-11T14:52:28.432372+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-11T14:52:28.965697+00:00 heroku[slugc]: Slug compilation finished
2013-04-11T14:52:30.218480+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 9009 thin -e $RACK_ENV`
2013-04-11T14:52:32.898285+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-11T14:52:32.897830+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-11T14:52:34.350938+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick::HTTPServer#start: pid=2 port=2010
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick 1.3.1
2013-04-11T14:52:34.350707+00:00 app[web.1]: [2013-04-11 14:52:34] WARN TCPServer Error: Address already in use - bind(2)
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-04-11T14:52:34.407830+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-04-11T14:52:34.407675+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 2010, should be 9009 (see environment variable PORT)
2013-04-11T14:52:35.572955+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-11T14:52:35.560772+00:00 heroku[web.1]: Process exited with status 137
Why is it doing this? What am I missing?

Try using Thin instead of WEBrick. You can do this by simply adding this to your gemfile:
gem 'thin'
Then run bundle install, commit the new Gemfile and Gemfile.lock, then push to Heroku.
WEBrick is not meant for production use.

It turns out that a plugin I was using, SyntaxHighlighter, had some files in its test directory that started WEBrick. I just removed those, committed, pushed, and it worked fine.

Related

Heroku won't run their sample sinatra app, error is bundler: failed to load command: rackup

How does one get a "hello world" sinatra app to execute on Heroku? Heroku's own sample app fails:
For a brand new heroku app, following Heroku's 3-file "hello world" Sinatra deployment instructions at:
https://devcenter.heroku.com/articles/rack
the build fails with bundler: failed to load command: rackup
I've tried it with both the default stack (heroku-20) and thinking that might be the issue tried it on the heroku-18 stack. Same error.
#config.ru
require './hello'
run Sinatra::Application
and
#hello.rb
require 'sinatra'
get '/' do
"Hello World!"
end
and
#Gemfile
source 'https://rubygems.org'
gem 'sinatra'
Gives:
heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p ${PORT:-5000}`
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
heroku[web.1]: State changed from crashed to starting
app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/3.0.0/bin/rackup)
app[web.1]: /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/handler.rb:45:in `pick': Couldn't find handler for: puma, thin, falcon, webrick. (LoadError)
Despite what the Heroku docs say, the Gemfile also needs a web server.
Adding gem 'puma' to the Gemfile did the trick.

What to do if "git push heroku master" failed?

I have a working Rails app on my local Windows XP machine. I want to upload it on Heroku. I follow this tutorial https://devcenter.heroku.com/articles/rails3.
When I ran git push heroku master, it failed:
-----> Ruby/Rails app detected
-----> WARNING: Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Received disconnect from 50.19.85.132: 10: user closed connection
fatal: The remote end hung up unexpectedly
What do I have to do now?
I saw the log, there are some issues like these ones:
2013-04-28T21:18:03.384881+00:00 app[web.1]: /app/app/assets/images/cards/resize.rb:23:in `open': No such file or directory -
C:\sbox\ruby\cards2 (Errno::ENOENT)
2013-04-28T21:18:03.385662+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
`wrapped_app'
2013-04-28T21:18:04.689716+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-28T21:18:05.596424+00:00 heroku[web.1]: Process exited with status 1
2013-04-28T21:28:27.556270+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-28T21:28:29.459229+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 3598`
2013-04-28T21:18:03.385424+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
2013-04-28T21:28:34.613321+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
I removed resize.rb:23 file. It is for re-sizing images, app doesn't use, I just left it there on development and forgot to delete when uploaded my app on Heroku. On my local machine it is not run by itself, but Heroku for some reason started it. There was a function call to C:\sbox\ruby\cards2 location and that's why the error happened, I thought. Ok, I removed the file. Do not know, though, about other issues.
But what do I need to do now? How to start the process again? I ran git push heroku master again but got:
C:\sbox\ruby\Sites\Heroku\Cards>git push heroku master
Everything up-to-date
Nothing works but Heroku says that everything is up-to-date.
Is there a way to see all my app files on Heroku server the way you can see your files on shared hosting?
Try adding a commit with some small change, like a Readme change or something. It should force heroku to re-deploy your app.

Jekyll on Heroku: bundler: command not found: thin

Working from a tutorial at http://mwmanning.com/2011/11/29/Run-Your-Jekyll-Site-On-Heroku.html. When I try to push to heroku I get a "build failed" message in the output.
Heroku logs shows
2013-01-30T05:29:54+00:00 heroku[slugc]: Slug compilation started
2013-01-30T05:31:36+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rack app
2013-01-30T05:31:38+00:00 heroku[web.1]: State changed from crashed to starting
2013-01-30T05:31:51+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 14276 -e $RACK_ENV`
2013-01-30T05:31:53+00:00 app[web.1]: bundler: command not found: thin
2013-01-30T05:31:53+00:00 app[web.1]: Install missing gem executables with `bundle install`
2013-01-30T05:31:54+00:00 heroku[web.1]: Process exited with status 1272013-01-30T05:31:54+00:00 heroku[web.1]: State changed from starting to crashed
Gemfile and Gemfile.lock both show that thin is installed.
source :rubygems
gem 'jekyll'
gem 'rdiscount'
gem 'rack-jekyll'
gem 'thin'
gem 'RedCloth'
Command bundle exec thin start works locally and bundle show thin shows that thin is installed specifically for the current gemset.
I can't understand why heroku still says that thin is missing?
For me a local bundle update fixed that problem.
Sorry, not a direct answer. But this method worked for me.
http://chriscontinanza.com/2011/06/15/Jekyll-to-heroku.html

Heroku: bash: bundle: command not found

My heroku deployment is crashing with following errors.
2012-12-12T17:16:18+00:00 app[web.1]: bash: bundle: command not found
2012-12-12T17:16:19+00:00 heroku[web.1]: Process exited with status 127
2012-12-12T17:16:19+00:00 heroku[web.1]: State changed from starting to crashed
The Heroku documentation for this error is to set PATH and GEM variables as described in https://devcenter.heroku.com/articles/changing-ruby-version-breaks-path I tried that, however that too is not helping.
→ heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
→ heroku config:add GEM_PATH=vendor/bundle/ruby/1.9.1
→ heroku run rake db:migrate
Running rake db:migrate attached to terminal... up, run.7130
bash: bundle: command not found
Next, I tried setting Ruby version in my Heroku app. This increased the slugsize. But app was still not up.
Gemfile
ruby "1.9.2"
Pushed to Heroku
-----> Using Ruby version: ruby-1.9.2
-----> Installing dependencies using Bundler version 1.2.2
heroku run "ruby -v"
Running `ruby -v` attached to terminal... up, run.4483
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
Can someone please advice
The error is because your path is incorrect.
If you're trying to use Ruby 1.9.3 you don't need to do anything,
it's the default Ruby so you can remove those config vars.
If you're using
1.8.7 or 1.9.2, then upgrade to 1.9.3 as it's current.
If you're looking at using Ruby 2.0.0.p3 - you're on your own ;)

How to deploy JRuby Rails 3.1.x on Heroku?

I want to be able to deply a jruby rails 3.1 app to Heroku.
Heroku now suports Java: http://blog.heroku.com/archives/2011/08/25/java/
Supposedly, it should be possible to deploy a JRuby rails application.
There's a tutorial here for plain java: http://devcenter.heroku.com/articles/java and another here: http://devcenter.heroku.com/articles/spring-mvc-hibernate
Here's a tutorial for a JRuby Sinatra app on Heroku: http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/
In order to get this to work, I had use non-jruby ruby when running heroku, as heroku crashes if rvm uses jruby.
In order to run the command
mvn package
I had to run this:
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile install temple
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile update
I created the app:
heroku create jg1-sinatra --stack cedar
I pushed the file to heroku, but when the app started, it crashed. :(
Any advice? I'm guessing that it won't be long before Heroku has a tutorial on this.
Log file from Heroku:
2011-11-21T08:30:40+00:00 heroku[slugc]: Slug compilation started
2011-11-21T08:31:17+00:00 heroku[api]: Deploy 3bccec5 by justin.gordon#gmail.com
2011-11-21T08:31:17+00:00 heroku[api]: Release v7 created by justin.gordon#gmail.com
2011-11-21T08:31:18+00:00 heroku[web.1]: State changed from crashed to created
2011-11-21T08:31:18+00:00 heroku[slugc]: Slug compilation finished
2011-11-21T08:31:20+00:00 heroku[web.1]: Starting process with command `sh script/jruby -S trinidad -p 17687`
2011-11-21T08:31:20+00:00 app[web.1]: Classpath is: :/app/etc:/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar
2011-11-21T08:31:20+00:00 app[web.1]: Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main
2011-11-21T08:31:20+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: org.jruby.Main
2011-11-21T08:31:20+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
2011-11-21T08:31:20+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2011-11-21T08:31:20+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
2011-11-21T08:31:20+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
2011-11-21T08:31:20+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
2011-11-21T08:31:20+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
2011-11-21T08:31:20+00:00 app[web.1]: Could not find the main class: org.jruby.Main. Program will exit.
2011-11-21T08:31:20+00:00 heroku[web.1]: Process exited
2011-11-21T08:31:21+00:00 heroku[web.1]: State changed from starting to crashed
As of Bundler 1.2 you are now able to specify the Ruby implementation and version in your Gemfile. The nice thing about this is that Heroku will understand these settings and prepare the your Heroku application for your environment.
Take this Gemfile for example:
source "https://rubygems.org"
ruby "1.9.3"
gem "rails"
gem "puma"
What's cool about this is that by default Celadon Cedar uses Ruby 1.9.2. However, when you specify ruby "1.9.3" in the Gemfile it'll actually compile Ruby 1.9.3 for your Heroku environment.
Now, if you want to add a different Ruby implementation to your Heroku environment, you can do so like this:
source "https://rubygems.org"
ruby "1.9.3", :engine => "jruby", :engine_version => "1.7.0.preview1"
gem "rails"
gem "puma"
Now it'll install and use JRuby 1.7.0.preview1 in Ruby 1.9 mode for your Heroku application upon deployment. It'll also even define the proper JVM options in the Heroku environment variables.
Best of all is that this comes with the official Heroku buildpack, so there is no need to switch to a 3rd party buildpack to get the JRuby/JVM going on Heroku. Although I haven't gotten it to work yet, this should also work with Rubinius, but I believe it's currently bugged. Either that, or I'm doing it wrong.
This is in my opinion an awesome and scalable feature. Just define the Ruby implementation/version/mode you're using in your Gemfile along with your other dependencies and Heroku will ensure the environment is prepared.
You have this line :
Classpath is: :/app/etc:/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar
Seams you have reference to your locale repository somewhere and Heroku of corse don't have it.
I dunno so much about packaging, but may be this reference appear here ?
Check all ref and see packaging options could be a good start ...
Previous hacks for getting JRuby and other non-supported runtimes on Heroku are now obsolete with the availability of third-party buildpacks:
https://devcenter.heroku.com/articles/buildpacks
https://github.com/jruby/heroku-buildpack-jruby

Resources