简体   繁体   中英

Bundle and Gem Errors when deploying Sinatra app to heroku

UPDATE

I did the following and this is the callstack I am still getting in the logs:

2012-08-06T12:30:57+00:00 heroku[slugc]: Slug compilation finished
2012-08-06T12:30:58+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RACK_ENV -p 56970`
2012-08-06T12:30:59+00:00 app[web.1]: bash: bundle: command not found
2012-08-06T12:31:00+00:00 heroku[web.1]: Process exited with status 127
2012-08-06T12:31:00+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-06T12:31:08+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:08+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:09+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:10+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=

My Procfile file now looks like this:

root: = ::File.dirname(__FILE__)
require: ::File.join( root, 'app' )
web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT
run: WPL.new

Gemfile looks like this:

source :rubygems
gem 'thin'
gem 'sinatra'
gem 'shotgun'
gem 'sinatra'
gem 'mongo'
gem 'json'

My app.rb looks like this now: require 'shotgun' require 'sinatra' require 'mongo' require 'json/pure'

class WPL < Sinatra::Application 
  db = Mongo::Connection.new.db('docs')


  get '/' do
    File.read(File.join('public', 'index.html'))
  end
end

And config.ru looks like this:

require './app'
run WPL.new

So I'm trying to deploy my app and I've run into several issues. Everything works fine locally. I push the app to heroku and everything seems to be ok but when I check the logs it says it cant find command 'bundle'.

This is what my Procfile looks like.

web: bundle exec ruby app.rb -p $PORT

I tried removing bundle exec and just went with ruby app.rb -p $POST got further in the process but more errors.

The next set of errors I get are all gem related. It simply can't find any of the gems that are required. This is what my app.rb looks like.

require 'shotgun'
require 'sinatra'
require 'mongo'
require 'json/pure'


db = Mongo::Connection.new.db('docs')


get '/' do
  File.read(File.join('public', 'index.html'))
end

My Gemfile looks like this.

source :rubygems
gem 'sinatra'
gem 'shotgun'
gem 'sinatra'
gem 'mongo'
gem 'json'

My config.ru looks like this.

require './app'
run Sinatra::Application

Running heroku run console also results in this error bundle: command not found

What am I missing?

Your Procfile is not using your config.ru.

For a Sinatra application, I would use a Procfile that looks something like this:

web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT

This similar question might be some help too.

Not sure what happened but I just deleted my app on heroku and created a new one. Then it worked. I think when I created the app originally, heroku thought the app was a node app because I was missing my Procfile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM