开发者

how to easily run a sinatra/padrino application on rails hoster

开发者 https://www.devze.com 2023-02-12 08:50 出处:网络
is ther开发者_如何学Pythone an easy way to run a sinatra (in particular a padrino) application \"as a\" rails app?

is ther开发者_如何学Pythone an easy way to run a sinatra (in particular a padrino) application "as a" rails app? i guess, there should be some way to translate "rails server" to "padrino start" or something... (the hoster i'm referring too hosts rails with mod_rails.)


If you're using mod_rails (ie. Passenger), you shouldn't have a problem at all - Passenger can host any rack-based app, and I use it for hosting Sinatra, Padrino and Rails apps on my server. A very basic rackup file is all you need for Sinatra, something like:

require 'sinatra_app'
set :run, false
set :environment, ENV['RACK_ENV'] || 'production'
run Sinatra::Application

The basic config.ru file you'll need for a padrino app is even simpler:

require ::File.dirname(__FILE__) + '/config/boot.rb'
run Padrino.application

There's more you can do, like for handling logging, but that should be all you need to get going. Your Apache vhost config for both Sinatra and Padrino apps is also simple, and very similar to what you'd use for Rails, eg.:

<VirtualHost *:80>
  ServerName my.app.com
  DocumentRoot "/var/www/apps/myapp/current/public"
  RackEnv production
</VirtualHost>

That should be all you need to start - the only major difference is that you use RackEnv instead of RailsEnv.


You should run Sinatra as a Rack

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_sinatra

0

精彩评论

暂无评论...
验证码 换一张
取 消