I have simple Sinatra app.
web.rb:
require 'sinatra'
get '/' do
"Hello"
end
Gemfile:*
source :rubygems
gem 'sinatra', '1.1.0'
gem 'thin', '1.2.7'
config.ru:
require './web'
run Sinatra::Application
But when I deploy my app on Heroku I'll get the error on logs:
2012-03-27T19:17:48+00:00 heroku[router]: Error H14 (No web processes running) -> GET furious-waterfall-6586.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
How can I fix it?
Free Services on Heroku Heroku offers a free plan to help you learn and get started on the platform. Heroku Buttons and Buildpacks are free, and many Heroku Add-ons also offer a free plan.
Heroku is so easy to use that it's a top choice for many development projects. With a special focus on supporting customer-focused apps, it enables simple application development and deployment.
Here's how to create a minimal sinatra app that deploys to heroku:
app.rb:
require 'sinatra'
get '/' do
"hello world"
end
Gemfile:
source 'https://rubygems.org'
gem 'heroku'
gem 'sinatra'
gem 'thin'
config.ru:
require './app'
run Sinatra::Application
Type these commands in your command line to deploy (without the $
signs):
$ bundle install
$ git init
$ git add -f app.rb Gemfile Gemfile.lock config.ru
$ git commit -am "initial commit"
$ heroku create <my-app-name>
$ git push heroku master
Then test your app:
$ curl <my-app-name>.heroku.com
and you should see:
hello world
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With