Vhgen 1.1

Here’s the latest update to my vhgen script for apache2 vhost templating.

The importance of being up-to-date

Since I started working in the web development business the release of Rails 3 has been the first time I really felt I had to understand what was going on because otherwise I would be left behind.

There were simpler times where just reading the feeds of the most important blogs allowed me to be up-to-date, but either I’m getting old or the information has become too fractioned, because this time the only reason for me (and everyone in MIKAMAI) to get started with Rails 3 was to resume a practice that unfortunately we left behind in the past year: the internal presentations.

Starting last thursday, and hopefully never stopping, thursday afternoons aren’t about working for others, but are about everyone sharing his knoweledge with the others.

Last thursday was obviously all about Rails 3, so a couple of us connected their macs to the big screen and demoed new features of Rails 3.

It was nice, interesting questions were asked during the demos, and the overall mood was pretty good. I look forward to the next session.

Continous Integration with RunCodeRun

Last thursday MIKAMAI hosted a Ruby Social Club meeting. Here’s the slides for my presentation.

Wordpress + Lighttpd + WP-Supercache + Mobile Support

Last year I made some work on lighttpd support for wp-supercache. It instantly became very popular and basically anyone running wordpress on lighttpd uses it, even if it lacks support for wp-supercache newest features.

The amazing Jean Pierre Wenzel has recently released an updated version that adds a much needed mobile support.

You can check it out here.

Thanks Jean Pierre!

Updated Language Redirect Extension for Radiant

Thanks to the great work of netzpirat, the good old Language Redirect Extension has been updated to work with Radiant 0.8.0.

Thanks netzpirat!

Deploy Drupal with Capistrano, a year later

Here’s the slides for the presentation I gave at the latest Ruby Social Club in Milano.

Stacktrace and FB Garage

For those of you who understand Italian, Stacktrace has published one article of mine, regarding the planning of FB Garage Milano.

It was a fun event both to plan, execute and attend, I hope the article transmits the action that happened behind the lines.

Apache Vhost Templating

In Mikamai our deployment platform of choice is Ubuntu Linux. I like a lot the way Apache is set up on Debian based distributions, with the sites-available directory, but nonetheless creating new virtual hosts is a royal PITA.

Today I finally solved the problem once and for all via a super simple ruby templating script. Here it is, it uses a nice gem, optiflags, to parse the commandline arguments:

#!/usr/bin/env ruby
 
require 'rubygems'
require 'optiflag'
 
module MyOptions extend OptiFlagSet
  flag "d" do
    description "The domain name the vhost should serve"
    long_form "domain"
  end
 
  optional_flag "a" do
    description "Email of the admin. If not specified defaults to info@domain"
    long_form "admin"
  end
 
  optional_switch_flag "w" do
    description "Adds www to non www redirection"
    long_form "www_redirect"
  end
 
  and_process!
end
 
flags = MyOptions.flags
 
admin = flags.a ? flags.a : "info@#{flags.d}"
domain = flags.d
quoted_domain = flags.d.gsub(/\./, "\\.")
 
TEMPLATE=<<-EOT
<VirtualHost *:80>
        ServerName #{domain}
        ServerAdmin #{admin} 
 
        DocumentRoot /var/apps/#{domain}
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/apps/#{domain}>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All 
                Order allow,deny
                allow from all
        </Directory>
 
        ErrorLog /var/log/apache2/#{domain}.log
 
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
 
        CustomLog /var/log/apache2/#{domain}.log combined
 
</VirtualHost>
EOT
 
REDIRECTION=<<-EOT
<VirtualHost *:80>
  ServerName www.#{domain}
  ServerAdmin #{admin} 
 
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^www\\.#{quoted_domain}
  RewriteRule (.*) http://#{domain}/$1 [R=301,L]
</VirtualHost>
EOT
 
puts TEMPLATE
puts REDIRECTION if flags.w?

I use it like this:

$ vhgen -d domain.com -w > /etc/apache2/sites-available/my_vhost
$ a2ensite my_vhost

The unrestful programmer

Yesterday in Mikamai we had a Ruby Social Club meeting. I did a small presentation about the need to never stop learning. Here’s the slides:

Betrayed by Xerox

I seldom post complaints on my blog (maybe this is the first time), but I’ve never been treated so bad by a name company like Xerox.

Last year in Mikamai we needed a printer. I made my research on the net for a color laser printer and we ended up choosing Xerox, after all you can’t go wrong with Xerox, right? We were so wrong.

Our Xerox Phaser 6110MFP started malfunctioning almost immediately, getting paper jams every second page we printed. After a while it completely stopped working and we had to call tech support (Xerox Italy), and that’s where the pain started.

The first time they sent a technician quite soon, and he said he fixed the printer, then he went away. Obviously he didn’t do anything that really fixed it since after half a day it started malfunctioning again.

We called again the tech support and when the technician came again he said we had to buy a new printer, because we “used up” this one. I almost a year we printed less than 1000 pages. How’s that too much?

We kept calling tech support and the guy didn’t even come anymore. After calling support every day for a week he came again, and said the printer is no more covered by warranty and as long as it’s able to print one page it’s fine for him. He strongly suggested again to buy a new printer.

We followed his suggestions, and bought a Samsung printer, this time spending less than 15% of what we spent for the Xerox one.

I hope this post will go around the net, as a warning to customers. Don’t buy Xerox.

This is an English rewrite of an Italian article posted on the Mikamai blog: “problemi con stampanti xerox

Update: Xerox contacted us and solved the problem.