background preloader

RoRails

Facebook Twitter

BuildingWebApps. How-To Setup a Linux Server for Ruby on Rails - with Phusion Passenger and GitHub - Hack'd. How-To Setup a Linux Server for Ruby on Rails - with Phusion Passenger and GitHub This document serves as a comprehensive how-to to setup and deploy your typical Ruby on Rails application on a blank new *nix (Unix, Linux, etc.) server. Rails deployment is hard, but it shouldn’t be. This how-to assumes you’ll want to use Phusion Passenger to serve your Ruby on Rails application, and that your application’s source code repository is in GitHub. Most of the defaults are targeted towards those using Ubuntu Linux on their server, but the same setup should be able to be applied to ’nix systems.

Much of this setup has been stolen from the wonderful articles on Slicehost ( articles.slicehost.com ), and some tweaks from various forums around the web. We’d like to keep it as comprehensive as possible, and actually use it as a reference guide internally at ThriveSmart Please feel free to add comments with any clarifications or additions. Web Application Software Setup: Apache, Rails, MySQL, and Git. Rails Logging Tips. RVM in Rails3. Here are the simple (?) Steps to get Rails 3 running with the above technologies. Install Rails You know, this is pretty obvious, but before you get into any other hoo ha you are going to have to get a version of Rails installed into your system gems so that you will have access to the rails command. So: $ gem install rails --version "3.0.0.beta3" Successfully installed i18n-0.3.7 Successfully installed tzinfo-0.3.20 Successfully installed builder-2.1.2 Successfully installed memcache-client-1.8.3 Successfully installed activesupport-3.0.0.beta3 Successfully installed activemodel-3.0.0.beta3 ....

Should do the trick. Setup the Rails app Now we have Rails install our app using the standard rails g command. $ rails my_app -JT create create README create .gitignore create Rakefile create config.ru create Gemfile .... The -J parameter, tells Rails not to install the Prototype Javascript libraries. Setting up RVM $ echo "rvm ruby-1.8.7@my_app" > .rvmrc But we need to create the gemset first: Nice. <! Thin - Fast Ruby web server. What Thin is a Ruby web server that glues together 3 of the best Ruby libraries in web history: the Mongrel parser, the root of Mongrel speed and securityEvent Machine, a network I/O library with extremely high scalability, performance and stabilityRack, a minimal interface between webservers and Ruby frameworks Which makes it, with all humility, the most secure, stable, fast and extensible Ruby web server bundled in an easy to use gem for your own pleasure.

Why Request / seconds comparison c req. = Concurrency Level (number of simultaneous requests) How Add thin to your Gemfile gem 'thin' Start Thin bundle exec thin start.