Is Sinatra multi threaded?

tl;dr Sinatra works well with Threads, but you will probably have to use a different web server. Sinatra itself does not impose any concurrency model, it does not even handle concurrency. This is done by the Rack handler (web server), like Thin, WEBrick or Passenger. Sinatra itself is thread-safe, meaning that if your Rack handler … Read more

Logging in Sinatra?

Sinatra 1.3 will ship with such a logger object, exactly usable as above. You can use edge Sinatra as described in “The Bleeding Edge”. Won’t be that long until we’ll release 1.3, I guess. To use it with Sinatra 1.2, do something like this: require ‘sinatra’ use Rack::Logger helpers do def logger request.logger end end

Sinatra – API – Authentication

Sinatra has no built-in authentication support. There are some gems available, but most are designed for user authentication (i.e. for a website). For an API, they seem like overkill. It’s easy enough to make your own. Simply check the request params in each of your routes to see if they contain a valid API key, … Read more

Sinatra vs. Rails

For Sinatra, it’s really almost like a wrapper around Rack. So you first need to ask what the point of Rack is. Rack is basically a specification for how a framework should return a result, it can use what’s returned with any web server that Rack supports. So it’s really a compatibility layer that allows … Read more

Why is this RMagick call generating a segmentation fault?

To expand on Matthew Savage’s comment, do this: brew install imagemagick –disable-openmp and it starts working again. No need to edit the files. (I’m not sure if thats what he’s actually saying or if he’s saying remove the flag, but the above homebrew command works for me on OSX 10.6) If you already have imagemagick … Read more

Foreman: Use different Procfile in development and production

You could use two Procfiles (e.g. Procfile and Procfile.dev) and use foremans -f option to select a different one to use in dev: In dev (Procfile.dev contains your shotgun web process): foreman start -f Procfile.dev In production, foreman start will pick up the normal Procfile. Alternatively you could create a bin directory in your app … Read more

EventSource / Server-Sent Events through Nginx

Your Nginx config is correct, you just miss few lines. Here is a “magic trio” making EventSource working through Nginx: proxy_set_header Connection ”; proxy_http_version 1.1; chunked_transfer_encoding off; Place them into location section and it should work. You may also need to add proxy_buffering off; proxy_cache off; That’s not an official way of doing it. I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)