Deploy Sinatra app on Heroku

前端 未结 5 706
后悔当初
后悔当初 2020-12-23 14:58

I have simple Sinatra app.

web.rb:

require \'sinatra\'

get \'/\' do 
    \"Hello\" 
end

Gemfile:*

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 15:54

    You need a Procfile file alongside your config.ru to tell Heroku how to run your app. Here is the content of an example Procfile:

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

    Heroku Ruby docs on Procfiles

    EDIT: Here's a sample config.ru from one of my sinatra/Heroku apps:

    $:.unshift File.expand_path("../", __FILE__)
    require 'rubygems'
    require 'sinatra'
    require './web'
    run Sinatra::Application
    

    You may need to require sinatra and rubygems for it to work.

提交回复
热议问题