Pragmatic Technology Solutions

Installing and creating your first Merb Application sohel Merchant   Thursday, October 23, 2008

#Install Merb
>sudo gem install merb
# Create your first application merb-gen app demo TROUBLESHOOTING: If you get the following error: /usr/local/lib/site_ruby/1.8/rubygems.rb:578:in `report_activate_error': Could not find RubyGem spicycode-rcov (>= 0.8.1.3) (Gem::LoadError) from /usr/local/lib/site_ruby/1.8/rubygems.rb:134:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:158:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `each' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:158:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `each' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:158:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `each' from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `activate' from /usr/local/lib/site_ruby/1.8/rubygems.rb:49:in `gem' from /usr/bin/merb-gen:18 #Run the following commands gem sources -a http://gems.github.com
sudo gem install spicycode-rcov syntax hoe mongrel #cd demo >cd demo #Craete a resource >merb-gen resource article title:string #Start thhe application >merb #Go to your application http://localhost:4000/articles


Configuring Capistrano on Dreamhost with Fusion Passenger (mod_rails) sohel Merchant   Thursday, September 25, 2008

* Create a domain /subdomian and make it to point the root directory to /current/public/
* Go to the server and delete the current/public directory inside the application folder
* Run the following command to add capistrano config file to your application

capify .

* Add the Capifile and config/deploy.rb to the subversion repository
*Use the following Recipe for deploy.rb

set :user, 'apprunner'  # Your dreamhost account's username
set :domain, 'test.scorepluslcms.mustafaco.com'  # Dreamhost servername where your account is located 
set :project, 'scorepluslcms'  # Your application as its called in the repository
set :application, 'test.scorepluslcms.mustafaco.com'  # Your app's location (domain or sub-domain name as setup in panel)
set :applicationdir, "/home/#{user}/#{application}"  # The standard Dreamhost setup

# version control config
set :scm_username, 'sohel'
set :scm_password, 'pwd'
set :repository, "http://svn.scorepluslcms.mustafaco.com/#{project}/"

# roles (servers)
role :web, domain
role :app, domain
role :db,  domain, :primary => true

# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export

# additional settings
default_run_options[:pty] = true  # Forgo errors when deploying from windows
#ssh_options[:keys] = %w(/Path/To/id_rsa)            # If you are using ssh_keys
set :chmod755, "app config db lib public vendor script script/* public/disp*"
set :use_sudo, false


namespace :mod_rails do
       desc <<-DESC
       Restart the application altering tmp/restart.txt for mod_rails.
      DESC
       task :restart, :roles => :app do
         run "touch  #{release_path}/tmp/restart.txt"
       end
end
    
namespace :deploy do
    %w(start restart).each { |name| task name, :roles => :app do mod_rails.restart end }
end


* Run the following command to deploy code for the first time
cap deploy:cold 
To deploy later versions use
cap deploy


Ruby on Rails Hosting India sohel Merchant   Friday, July 25, 2008

Ruby on Rails Hosting India I was looking for affordable ROR hosting for some of our clients in India. I got a list of hosting companies based in India from various blogs and deiced to get further information about their ROR hosting options. The following describes my experiences.

  • Traffic Pullz: This is the only company I found which are providing ROR hosting, but they suport Rails 1.1.6 and it is not included by default. It is a separate add on for Rs. 1000. You can check their ruby offerings at http://www.trafficpullz.com/web-hosting-ruby.html
  • SGD Networks: This company has also removed the ROR supported server from their server series due to less customer base and huge maintenance this February.
  • Web Server India: They are also not offering Ruby on Rails hosting. But they recommended www.site5.com for your RoR hosting requirements.
  • ZNET INDIA: They also does not suppport Rails.
  • Web Hosting Delhi: I never got a reply to my communication from them.


RailsConf 2008 Portland, OR USA sohel Merchant   Sunday, June 15, 2008

I recently attended the RailsConf 2008 held in Portland OR. I have been an attendee on all the past 3 Rails conferences and I thought this years conference was as exciting as the previous ones. I got a an opportunity to network and learn from professional working on rails across the globe. I have seen a trend that more and more people from large enterprises such as Cisco, Motorola are using Rails inside their organizations. YELLOWPAGES.COM is the 33rd-largest website in the U.S., handling millions of searches per day recently switched from Java to Rails. In four months, four developers turned 125,000 lines of Java into 14,000 lines of Ruby. I think this is enough to demonstrate people the scalability of Rails.

At the conference, I really enjoyed Ken Back's talk describing history of XP and design patterns. Also, I was impressed by how easy is to setup Passenger (mod_rails) compared to other options. I think it has made deployment much easier from matter of days to hours and will serve as a serious alternative to Apache+Mongrel and Nginx+Mongrel. Another session which I thought was very interesting was Neil Ford's talk on Design Patterns in Ruby. REST is fast becoming the standard way to code Rails application, but there are always some outliers which are difficult to fit in the Rails RESTful actions. Ben Scofield's talk on Advanced RESTful Rails covered some of them very nicely.