2016-12-27 122 views
0

我想尽我的 Ruby/Sinatra deploy(yay!),一个"to do list" app网站到Heroku。代码运行在Windows罚款和Ubuntu环境如何将此Ruby/Sinatra应用程序部署到Heroku?

My humble app

,但我无法真正成功部署。

我用我自己的代码试过this tutorial。当我执行sudo git push heroku master时,我被告知该应用程序已部署到Heroku,但是当我转到它提供的URL时,该程序未运行。我可能需要帮助my (one-line) Procfile。此外,“警告”(这是否意味着部署没有发生?)说我没有声明我的Ruby版本。我尝试使用rvm 2.2.5并将gem 'ruby', '2.2.5'放入我的Gemfile中,但如果我声明Ruby版本(它表示我没有安装该版本的Ruby,我确实认为),则捆绑器将不会安装。

sudo git push heroku master 
Counting objects: 5, done. 
Compressing objects: 100% (4/4), done. 
Writing objects: 100% (5/5), 419 bytes | 0 bytes/s, done. 
Total 5 (delta 3), reused 1 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Ruby app detected 
remote: -----> Compiling Ruby/Rack 
remote: -----> Using Ruby version: ruby-2.2.6 
remote: -----> Installing dependencies using bundler 1.13.6 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 
remote:  Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
remote:  Fetching gem metadata from https://rubygems.org/......... 
remote:  Fetching version metadata from https://rubygems.org/. 
remote:  Using diff-lcs 1.2.5 
remote:  Using rack 1.6.5 
remote:  Using rspec-support 3.5.0 
remote:  Using ruby 0.1.0 
remote:  Using tilt 2.0.5 
remote:  Using bundler 1.13.6 
remote:  Using rspec-core 3.5.4 
remote:  Using rspec-expectations 3.5.0 
remote:  Using rspec-mocks 3.5.0 
remote:  Using rack-protection 1.5.3 
remote:  Using sinatra 1.4.7 
remote:  Bundle complete! 7 Gemfile dependencies, 11 gems now installed. 
remote:  Gems in the groups development and test were not installed. 
remote:  Bundled gems are installed into ./vendor/bundle. 
remote:  Bundle completed (1.79s) 
remote:  Cleaning up the bundler cache. 
remote:  Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. 
remote:  Removing dbm (0.5) 
remote: -----> Detecting rake tasks 
remote: 
remote: ###### WARNING: 
remote:  You have not declared a Ruby version in your Gemfile. 
remote:  To set your Ruby version add this line to your Gemfile: 
remote:  ruby '2.2.6' 
remote:  # See https://devcenter.heroku.com/articles/ruby-versions for more information. 
remote: 
remote: -----> Discovering process types 
remote:  Procfile declares types  -> web 
remote:  Default types for buildpack -> console, rake 
remote: 
remote: -----> Compressing... 
remote:  Done: 17.3M 
remote: -----> Launching... 
remote:  Released v5 
remote:  https://gentle-sea-73583.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy... done. 
To https://git.heroku.com/gentle-sea-73583.git 
    995b763..014acd8 master -> master 

我也试过执行sudo heroku run ruby todo.rbtodo.rb是我的服务器应用程序),我得到这个:

sudo heroku run ruby todo.rb 
Running ruby todo.rb on ⬢ gentle-sea-73583... up, run.3103 (Free) 
/app/vendor/ruby-2.2.6/lib/ruby/2.2.0/yaml/dbm.rb:2:in `require': cannot load such file -- dbm (LoadError) 
    from /app/vendor/ruby-2.2.6/lib/ruby/2.2.0/yaml/dbm.rb:2:in `<top (required)>' 
    from /app/lib/task_store.rb:2:in `require' 
    from /app/lib/task_store.rb:2:in `<top (required)>' 
    from todo.rb:7:in `require' 
    from todo.rb:7:in `<main>' 

也许我需要建立YAML在Heroku不知何故?我不知道如何...

回答

1

从您的Gemfile删除gem 'dbm'

dbm gem只适用于jruby,并且因为您使用yaml/dbm而不需要它。

+0

那么,我已经把gem'dbm'取出了我的Gemfile。但你给了我一个主意。事实上,我只是从我在网上找到的东西中复制了yaml/dbm依赖项,并且不知道为什么我可能需要它。所以我将它从task_store.rb中移除并重新部署,现在它可以工作!请参阅http://simple-to-do.herokuapp.com/ – globewalldesk

相关问题