Can't Launch Simple Sinatra App Using Rackup and Jruby (No Response from Web Server)

Can't launch simple Sinatra app using rackup and jRuby (no response from web server)

Well, this is hardly sufficient to explain what is going on, but I can make it work if in config.ru I replace

run Sinatra::Application

with

Sinatra::Application.run!

In fact, knowing that makes me even more confused. Some sort of bug in Rack?

Error when running rackup with Sinatra

You just miss a =

IMAGES = [
{ title: "Utopia", url: "http://www.techno-utopia.com/techno-utopia.jpg" },
{ title: "Alaska", url: "http://www.cruisebrothers.com/images/Destinations/Alaska.jpg" },
{ title: "The Unknown", url: "http://www.tasospagakis.com/wp-content/uploads/2012/11/fear_of_the_unknown_by_ilhaman-d4cukmg1.jpg" }
]

Variables are declared and assigned values by placing the variable name and the value either side of the assignment operator (=). Source

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

Despite what the Heroku docs say, the Gemfile also needs a web server.

Adding gem 'puma' to the Gemfile did the trick.

Cannot access local Sinatra server from another computer on same network

There was a recent commit to Sinatra that changed the default listen address to localhost from 0.0.0.0 in development mode due to security concerns.

In order to explicitly allow access from the network, you need to either run your app in another mode (e.g. production), or set the bind option to 0.0.0.0.

You can do this from the command line using the built in server using the -o option:

$ ./my_sinatra_file.rb -o 0.0.0.0

Passing options to rackup via a Sinatra application

You're actully going to pass options to thin on the command line directly or via a configuration file. See all options:

$ thin -h

For production, use a configuration file:

$ thin -C thin-production.yml -R config.ru start

Here is an example thin-production.yml file:

---
address: localhost
port: 3020
servers: 4
max_conns: 1024
max_persistent_conns: 512
timeout: 30
environment: production
pid: tmp/pids/thin-production.pid
log: log/thin-production.log
daemonize: true

How to start a Sinatra app using run

You should launch the application with:

rackup config.ru

Cannot Preview my Sinatra App in Codio at Port 9292 (I can at 4567)

Kenia

Hi.. saw your message to us and replied but seems you haven't picked it up yet? That message though wasn't clear you were talking about the Codio forum :) You need to register separately there - the forum is not associated with your Codio account credentials



Related Topics



Leave a reply



Submit