Wednesday, December 28, 2011

Machine Names

Fully Qualified Machine Name

Machines on our network obtain their fully qualified domain names from a DHCP server. But where does the DHCP server obtain its name? To configure a machine to return a fully qualified domain name (horn.example.com), you need to edit /etc/hosts

127.0.0.1   horn.example.com horn localhost
127.0.1.1   horn

Order matters. This will ensure that your fqdn can be queried by Python's socket.getfqdn().



Tuesday, December 27, 2011

Vim Setup

Please install Dropbox before continuing.

Installation

Install vim with

$ sudo apt-get install vim

I like to have access to same vim configuration on every machine I use. I created the following structure in my DropBox folder (Note trailing slashes indicate folders):

Dropbox/
    config/
        vim/
            .vimrc
            .vim/

Next, I created symlinks from my home folder to my Dropbox vim files:

$ ln -s ~/Dropbox/config/vim/.vimrc .
$ ln -s ~/Dropbox/config/vim/.vim

When I make changes to my vim configuration, it immediately synchronizes to all of my other machines.

SnipMate

SnipMate is a plugin that provides sophisticated snippet capabilities in vim. It utilizes vim’s file type detection and wires the appropriate snippets in insert mode.

Download the plugin and follow the installation instructions:

$ unzip snipMate.zip -d ~/.vim

Be sure that set paste is not enabled in your .vimrc file.

Study the included snippets in $HOME/.vim/snippets. To add a new file type, open the file e.g. myfile.md and query vim

:set filetype?

It returns a type (in this case mkd). Create a new file called mkd.snippets in $HOME/.vim/snippets and add your file type specific snippets.

Since you’ve configured this with Dropbox, your snippets will be available everywhere.

Thursday, December 22, 2011

Developer Documentation


We used to store all of our documentation on one wiki but soon realized that we were serving two different audiences: end users and developers. We discovered a nice wiki feature in BitBucket and we now separate end user and developer documentation between Mindtouch and BitBucket respectively.

BitBucket also has convenient REST APIs that make it easy to integrate command line scripts with their source repository, issue tracker and wiki.

BitBucket Wiki

The BitBucket wiki uses the Creole syntax. It is a convenient place to store documentation for source code. I was not aware that it's possible to nest Mercurial repositories. Nesting allows us to conveniently layout our projects as follows (assume our project is called myproj):

$ hg clone https://bitbucket.org/alice/myproj
$ cd myproj
$ hg clone https://bitbucket.org/alice/myproj/wiki

This produces an independent wiki Mercurial repository at the root of myproj. You can now edit these files without switching to your browser.

BitBucket Issue Tracker

Although it's not as sophisticated as Bugzilla, the issue tracker in BitBucket is sufficient for small teams. And the REST APIs make automation relatively easy.



Tuesday, December 13, 2011

Postfix with Amazon SES on Ubuntu 10.04 LTS

We use Postfix as our MTA. However, most ISPs do not allow mail relay so we needed an alternate transport mechanism. Although we use Google Apps, there were restrictions on the from address and hard message limits that we wanted to avoid. This article describes how to integrate Postfix and Amazon's SES.

Create an AWS Account

At the upper right corner of the Amazon SES page, you'll see a link to Create an AWS Account.

Once you've created your account, go to your Security Credentials page and create an Access Key. You'll need your Access Key ID and Secret Access Key. Please make a note of these two values.

Verify Addresses

Next, go the SES Management Console and verify addresses that you intend to use with SES. For example, we use Google Apps to host our domain. We've created groups that we use for various alerts. We added those addresses here.

Install Postfix

Be sure that you've added the fimero repository to your apt list.

Next, install the bbpostfix

$ sudo apt-get install bbpostfix

Just go with the defaults for the Postfix configuration. Once the Postfix configuration completes, you'll be asked for your MX domain. This should be the registered domain that you want to use for your outgoing email.

Package Source

The package sources are available here: