Archive for the ‘howto’ Category

Phusion Passenger (mod_rails) Now Available! (And Rails 2.3.3!)

Friday, July 31st, 2009

phusion-passenger-collage

Motivation

So, after numerous issues with Mongrel and Mongrel Cluster, as reported in our last Rails-related post, and after following all the buzz, we decided to give Phusion Passenger a try – we were not disappointed!

Don’t get us wrong, we still prefer Mongrel as our development server, and there are instances where Mongrel Cluster makes lots of sense (load balancing, for example), but we wanted to explore the reputed simplicity of Passenger –

..And we wanted to multiplex multiple websites onto one Apache instance, simply and easily!

Simplicity

So, we followed the gem-basedinstallation  instructions here: http://www.modrails.com/install.html

After installation with Gem, the nicely-written text mode installer guided us through the install process for the ‘dev’ packages, and then compiled itself from source – Very nice! A polished touch!

Done!

So after one global include in /etc/apache2/conf.d/passenger:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8

We were able to use multiple files in ‘sites-available’ of the format:

<VirtualHost *:80>
    ServerName www.yourhost.com
    DocumentRoot /somewhere/public
    #                       ^-- be sure to point to 'public' within your rails app!
</VirtualHost>

To easily achieve multiple rails apps, with disparate domains, served by the single instance, reasonably painlessly – Note that you do have to have the domains point to the correct IP address, of course 🙂

The Verdict

Our verdict: All in all pretty painless and professional – and the benchmarks seem to support great performance –

So, if you want us to install Passenger for you, just indicate this in the “Notes” field when you place your order, and we’ll get it done for you.

We will likely soon make it the default, if no objections are heard from you, our customers, in the near future.

Notes

Please note that we can do this on top of either Turnkey rails, or our regular Rails instance.

Rails 2.3.3 now available

Please note that Rails 2.3.3 is also now available from the dropdowns when you place your order!

Nginx

nginx_passenger_eyecatcherNote also that Phusion Passenger also offers an Nginx version – we will be happy to install the highly acclaimed Nginx web server, along with the corresponding version of Phusion Passenger, via custom quote – Please contact us today regarding getting this set up for you!

j

Zimbra 5.0.12 on Ubu 8.04 Now Available

Monday, February 23rd, 2009

zimbra_logoThe Announcement

We are happy to announce that the Zimbra Collaboration Suite v5.0.12 OSE (Open Source Edition) is now available for hosting.

Our qualified & certified vMachine is built with Ubuntu 8.04 LTS (Long Term Support), and this is the configuration we recommend. We can also build it with other available, Zimbra-supported OSes, contact us for your individual needs.

It Looks Good

Zimbra has really matured in this version  – in addition to a polished, good-looking, intuitive interface, it features:

  • Fully ajax webmail, snappy key responses
  • Full IMAP and POP3 support, forwarding, aliases, vacation messages, client-style filtering & foldering, etc
  • Excellent Spam filtering in this version (Much improved over previous versions)
  • Full Outlook-style calendaring and notes / integrated PIM capability
  • Integrated web-based documents – like GoogleDocs, but you control privacy / permisions (and no ads!)
  • “Briefcase”-style file reconciliation and repository
  • Zimlet extension framework, Optional Zimbra Desktop
  • Fully themable – The “Lemongrass” theme is pictured here:
Zimbra 5.0.12 Screenshot

Zimbra 5.0.12 Screenshot

How We Did It

There were several Zimbra prerequisistes, in addition to our basic suite of vMachine standard packages, here is our basic Zimbra install:

# dont forget to set the locale and the timezome before doing apt-get
apt-get update
apt-get install perl libidn11 fetchmail libpcre3 libgmp3c2 libexpat1 libxml2 libstdc++5 openssl libltdl3 libmagic1 cron file

# zcs 5.012 ubu 804 lts 32-bit, extracted directly:
wget -O – http://h.yimg.com/lo/downloads/5.0.12_GA/zcs-5.0.12_GA_2789.UBUNTU8.20090126112326.tgz | tar zx

Then CD  into the directory and run the installer.

Note that some of the required programs and dependencies were not listed, and after a couple of false starts, we found some help here:

http://www.zimbra.com/forums/installation/8626-server-status-data-not-available.html

So we overcame these and other minor issues, and now:

It’s Certified, Getting Formal

We have Certified the combination as

  • Fully bootable on a wide variety of VM and hardware platforms
  • Expandable via added HDs
  • VM-friendly, including JeOS modules and virtio
  • Remote-Desktop / xrdp / VNC-friendly
  • Web-Administrable
  • Puppet-ready
  • Self-signed certificate
  • Script-deploy rating: 7 out of 10

Note that in the future, we are considering what categories we should use as categories for a formal Libre Certification program.  We welcome your thoughts and comments, please post them as comments to this post.

Example ideas:

  • Bootable system-image DVD Backups available?
  • Administrable via various vm-admin tools, OpenQRM? VirtualMin, etc?
  • Usage / Bandwidth stats, RRDTool?
  • NX/NoMachine-ready? Citrix?

We will be launching the “Libre-Certified” program as we finalize these and other details.  The program will also be available to 3rd parties (Both system and hosting providers), and add value to the community, and to FLOSS “Best-practices” configurations.

All Versions Available

This featured vMachine in this announcement is the Zimbra ZCS OSE (Open Source Edition) – because we believe in FLOSSing regularly (FLOSS: Free/Libre Open Source Software, although proper  dental maintenance practices are also of course important!).

For those who require the features found in the ZCS paid/Network Editions, (Exchange-interoperability, etc), we are an authorized Zimbra partner, and we are happy to host the Zimbra paid versions as well.

Contact us for details and how to get started.

Django Admin and TinyMCE HowTo

Monday, December 22nd, 2008

We’ve just rolled out TinyMCE to use with our Django Admin interface.

As we encountered several gotchas along the way, we felt it would be instructive to the community to illustrate the steps here, in true cookbook (aka “HowTo”) fashion.

Here we go…

The Cookbook

Step 1: Add your js to your Model’s Admin definition:

class MyBoffoModelAdmin (admin.ModelAdmin):
    fieldsets  = (
        ... yada yada yada...
        (None, {'classes': ['edit'], 'fields': ('content',)}),
    )
    class Media:
        js = ['/tiny_mce/tiny_mce.js', '/js/textareas.js']

Note:

  • The classes : [‘edit’] which tells the code below to set the class for the mcEditor
  • That after the standard include of tiny_mce.js, the second javascript reference in the js list, is your custom init code that you will be writing next.
  • The nested “Class Media” tells the Django Admin interface to include the references to these .js files in the header of the Admin page.

Step 2: Write your initializer Javascript code:

This is the contents of /js/textarea.js:

function mce_setup()
{ tinymce.DOM.addClass (tinymce.DOM.select('.edit .vLargeTextField'), 'mcEdit');

  tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : "mcEdit",  // doesn't support selectors, only classes, despite the name
    height: "480",
    width: "90%",
    element_format : "html",
    plugins : "preview,fullscreen",
    theme_advanced_buttons3_add : "preview,fullscreen",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    //theme_advanced_resizing : true,
  });
};

Notes:

  • This Javascript is executed in the header – and it does NOT initialize the editor yet, it merely defines a function to do so, which is called when the user clicks on a link, which we’ll see next.
  • The “addClass” call at the top is necessary to work properly with Django – despite the ‘editor_selector’ setting in the tinyMCE.init paraeters, this does NOT accept a css selector, only a class – so we have to manually set up a new, unique class, using the tinymce.DOM.select call at the top.
  • The selector of  “.edit .vLargeTextField” pinpoints the actual textarea under the fieldset with the “edit” css class.

Step 3: Add your HTML to the model:

We turn it on using the Django Model Fields’ help_text option, thusly:

content = models.TextField (blank=True, help_text='''HTML Content -
    <a href="javascript:mce_setup();">Click Here</a> to edit - see
    <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Configuration">TinyMCE Configuration</a>
    for more options.''')

That’s it!

When you restart and load the page, you should see

“HTML Content – Click Here to edit – see TinyMCE Configuration for more options.”

at the bottom of the textarea in question that you set the ‘edit’ css class on –  and note that the other javascript isn’t loaded until you actually click on it, speeding load time of the page.

Clicking should quickly load the TinyMCE editor and buttons, resize the text area appropriately, render any HTML with WYSIWIG, and follow page resizes.

The Gotchas

  1. Django doesn’t let you get at the actual textarea class, so you have to do the above selector
  2. TinyMCE’s editor_selector parameter doesn’t use, or work with, selectors (!)
  3. You could use the Django form id, but then this whle precedure wouldn’t be generic, you’d need one init js per field.
  4. You would also need to set up the tinyMCE.init parameters to use ids rather than classes, too.
  5. Setting  “theme_advanced_resizing : true” actually takes away functionality if you have setup up height and width as percentages – which accomplish the same thing with no extra js.
  6. If you’re getting gibberish like “<br mce_bogus />” added to your empty text areas, there are a few things you can do – write us for details – you may need to set up an
    editor_deselector : "mcNoEdit"
  7. and use the appropriate code to add the class at the top of the setup function:
    tinymce.DOM.addClass (tinymce.DOM.select('.vLargeTextField'), 'mcNoEdit');

Useful References

Django Admin Media – Using extra js & css with the Django Admin interface

TinyMCE API – Core API, DOM API including how to find elemnts by selector, and add a class

TinyMCE Examples – Examples with source code including click-to-load, dual/partial textareas, plugin activation, fullscreen, etc

Django Model Documentation – including the help_text option which allows HTML!

Honorable Mention

An Honorable Mention goes to the WYMeditor – an up-and-coming WYSIWYM editor – What You See Is What You Mean – and it’s been getting rave reviews.

It uses a class-based approach, which is intriguing and feel right – it just doesn’t have the polish and full feature set that TinyMCE does right now – but we’ll be exploring this further in a future post, as we’ve already implemented it for a client in Django Admin already :-), and it works well –

j