Wednesday, March 12, 2008

My Spanish4.us web portal

My Spanish4.us web portal is a simple 1 page fits all study center for a Spanish class that my wife and I are taking.

This is something that I love about Ruby on Rails: I had a simple idea and in less than 2 hours I had prototyped the application and deployed it to one of my leased servers. I will add more phrases to the popup translation tool and more general information over the next few weeks.

Labels:


Friday, February 15, 2008

My DevX article "Real-Life Rails: Develop with NetBeans, Deploy on Linux"

My most recent DevX article has just been published. This was fun material to write about because after some experimentation I feel like I have my Ruby on Rails development environment and server deployment strategy just right, at least for my needs. I should mention that although I have been professionally writing Ruby on Rails applications for a few years, I have not yet written an application that will not run nicely on a single server using nginx, memcache, and a few mongrels. I set my development.rb environment for my MacBook and my production.rb environment for the Linux server I am deploying to, and svn is the glue that holds everything together. If you are interested in deploying very large scale applications, my article will not be very useful to you.

Labels: , ,


Friday, September 21, 2007

Great combination: nginx, Mongrel, and Rails for secure HTTPS

I had to set up a customer's Rails application to run using SSL+HTTPS this morning. Based on a few positive web blog articles I decided to try Igor Sysoev's nginx web server. If you first build and install OpenSSL and the Perl regular expression library, then build nginx with
--with-http_ssl_module
--with-openssl=/OPENSSL_SOURCE_DIR
--with-pcre=/PCRE_SOURCE_DIR
you should be all set to use HTTPS. Clustering mongrel is also simple; I used this nginx.conf file from Brainspl.at as an example and I was set up and running very quickly. Good stuff!

Labels: , , , ,


Saturday, January 20, 2007

Using the Dojo Javascript library in Ruby Rails

I have been using the fine Dojo Javascript library in a web app written in Common Lisp and this morning added Dojo to the code base for a current Rails project. The easiest way to get started using Dojo and Rails is to simply install the developer's version (non-compacted) of dojo.js and the src directory directly in your Rail project's public/javascripts directory, so it looks like this:
public/
javascripts/
dojo.js
src/
Again, the "src" directory contains the dojo source files (besides the dojo.js loader). Dojo will complain about rendered Rails web pages withot HTML and HEAD tags, so I added the following HTML with Dojo setup to the view for my main application controller:
<html>
 <head>
  <title>KBSportal KnowledgeManagement</title>
  <script type="text/javascript">
  djConfig = {isDebug: true};
 </script>
 <script src="/javascripts/dojo.js" type="text/javascript"></script>
 <script type="text/javascript">
  dojo.require("dojo.io.*");
  dojo.require("dojo.event.*");
  dojo.require("dojo.widget.TabContainer");
  dojo.require("dojo.widget.LinkPane");
  dojo.require("dojo.widget.ContentPane");
  dojo.require("dojo.widget.LayoutContainer");
  dojo.require("dojo.widget.Checkbox");
 </script>
 <style type="text/css">
  body {
   font-family : sans-serif;
  }
  .dojoTabPaneWrapper {
   padding : 10px 10px 10px 10px;
  }
 </style>
</head>
Dojo is definitely "heavier weight" than the prototype.js Javascript library that is provided with Rails so you may not want to use Dojo for very high traffic sites.

Labels: , , ,


Friday, September 08, 2006

JRuby

There has been a lot of buzz over Sun hiring Charles Oliver Nutter and Thomas Enebo (two core JRuby developers). Certainly a fine thing for people who use both Java and Ruby. My hope is that they do a lot of work on Tomcat/WEBrick/Rails integration for hybrid JSP/Rails web apps.

I have been using both Ruby and Rails a lot in the last year, and have not missed Java too much. That said, an efficient Rails platform on top of a Hotspot JVM sounds good. My quick experiments with JRuby have not been totally without problems, but with Sun's obvious motivation to get a first rate Ruby environment running on the JVM, I expect things to get better. The smooth integration of Java classes in an interactive Ruby IRB shell environment is fun.

Labels: ,


Sunday, February 05, 2006

Apache vs. lighttpd vs. WEBrick

While Apache has the advantage of coming pre-installed on leased servers and virtual servers, I am way more enthusiastic about using lighttpd as the front end for Rails applications. For one thing, all you need to do is install the Perl Compatible Regular Expression and then lighttpd, and then Rails will automatically and painlessly use lighttpd in development mode. Installing lighttpd and Rails in production mode is also easier than dealing with Apache (here are good directions).

Although what I am going to say next goes against common Rails wisdom, I would also like to add that it sometimes makes sense to deploy in production mode with WEBrick. Here are a few application specific details that might make you decide, at least for a long while, to just use WEBrick:If I run a small web application in production mode on WEBrick + Rails it takes about 22MB. If I run the same web application using lighttpd + Rails (using two FCGI processes), I use a total of about 60 MB, but obviously with better performance. (This is a moot point for me because I lease two virtual servers with 192MB and 224 MB of allocated physical memory.)

For a lot of reasons I like to not use a shared server (i.e., share Apache, get a unique port for Rails, etc.): ability to customize the OS, what services to run, choose lighttpd instead of Apache, secondary uses like backup and subversion services, etc. It has been my experience that I get better service (automated backups, restarts after hardware replacements, etc.) using Xen based virtual servers rather than cheap leased servers. You can also usually buy just what you need and reconfigure as needed; one scenario is setting up a low volume web portal using WEBrick + Rails and an inexpensive low memory virtual server. If necessary for either reducing server latency or handling many more concurrent users, just order more allocated memory and switch to using lighttpd + Rails with very little trouble.

I have not tried SwitchTower yet, but the documentation looks good and I am looking forward to trying it out.

Labels:


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]