Wednesday, February 22, 2012

ReviewBoard on Ubuntu 10.04 LTS


Code Review

Code review is considered complimentary to testing and has been shown to be effective at improving software quality. We use the excellent ReviewBoard code review application.

We'll install ReviewBoard with support LDAP. The source code for this package is available here.

Installation

Ensure that you have the fimero package repository configured.

$ sudo apt-get install bbreviewboard

You'll be asked a series of questions e.g. MySQL password or the hostname you'd like to use for your self-signed certificate. The installation will then complete. Once finished, point your browser to https://{reviewboard-server}

LDAP Configuration

Log in as admin.

Click on the Admin button on the upper right.

Click on Settings.

Click on Authentication.

Select LDAP.

Enter your settings.

Note that your cn must contain a givenName and a surname separated by a space. This is an issue with the way Reviewboard generates a user and should be considered a bug.

You can now log in via your LDAP username and credentials.

Note that if you're installing ReviewBoard on a machine that hosts Mindtouch, you'll need to update your /etc/apache2/ports.conf


There is a good example of ReviewBoard work flow with Mercurial available here.

With additional documentation available here.

Mercurial Integration

You'll need to download the source for the Mercurial integration for ReviewBoard.

$ mkdir -p hgdev/com.googlecode
$ cd hgdev/com.googlecode
$ hg clone https://code.google.com/p/mercurial-reviewboard/

Now update your Mercurial $HOME/.hgrc file to include the following:


Workflow

We had to experiment with several approaches before we came up with a usable workflow for Mercurial. It seems that ReviewBoard was designed for pre-commit reviews although with a little tweaking, a usable Mercurial workflow is possible.

We'll assume your username is asmith.

  1. Create a master repository e.g. acme on Bitbucket. This should be under a user that holds the golden copies of your source code. Let's call this user kroboto. Give asmith read access to this repository.
  2. Create a repository on ReviewBoard that points to this golden repository.
  3. Clone this repository locally into $HOME/hgdev/org.bitbucket/kroboto/acme with hg clone https://asmith@bitbucket.org/kroboto/acme. This serves as your baseline.
  4. User asmith then creates a personal acme repo on BitBucket. She then clones the golden acme into $HOME/hgdev/org.bitbucket/asmith/acme. Finally, she edits .hg/hgrc to point to her personal acme repository.
  5. asmith begins working on her code base committing and push as needed until she is ready for a code review.
  6. She first does an hg pull -u on her golden copy. She then pulls her changes from $HOME/org.bitbucket/asmith/acme into $HOME/org.bitbucket/kroboto/acme and performs any necessary merges.
  7. She submits a code review with hg postreview tip. This produces a code review id (e.g. 17). She submit subsequent reviews with hg postreview -l -e 17 tip until her code is accepted.
  8. Her code is then merged with the kroboto repository.

Backup And Restore

To backup ReviewBoard, dump the MySQL database. You can automate this process with one of several options for MySQL.



Wednesday, February 15, 2012

Mindtouch Wiki on Ubuntu 10.04

Introduction

We use the open source core version of the Mindtouch wiki for internal collaboration. Mindtouch has several attractive features including:

Prerequisites

Mono Runtime from Badgerports

You'll need the Badgerports backports repository to get the latest Mono runtime. Add the following to your /etc/apt/sources.list:

deb http://badgerports.org lucid main

Next, add the key for the repository:

$ sudo gpg --keyserver pgpkeys.mit.edu --recv-key  C90F9CB90E1FAD0C
$ sudo gpg -a --export C90F9CB90E1FAD0C | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install mono-runtime

Installing Mindtouch

You'll need the fimero repository enabled.

Ensure the Mindtouch repository has been added to your /etc/apt/sources.list:

deb http://repo.mindtouch.com xUbuntu_10.04/

Finally, install Mindtouch with

$ sudo apt-get install bbmindtouch

When the install process completes, point your browser to http://<your wikihost> and complete the installation process. Finally run sudo /usr/local/bin/finalize-mindtouch.sh to complete the installation.

Backup and Restore

The source for the backup script is available here:

https://svn.mindtouch.com/source/public/dekiwiki/10.1/src/scripts/dataWiki.sh

The bbmindtouch package installs a copy at /usr/local/bin/dataWiki.sh. This generates a backup file in /tmp

Add the following crontab entry for backup:

# m h  dom mon dow   command
0 2 * * * /usr/local/bin/dataWiki.sh -b
30 2 * * * /bin/cp /tmp/backupWiki-10.1.3.tar.gz ${BACKUP_FOLDER}

Change ${BACKUP_FOLDER} to an appropriate path.

To restore your wiki, simply run

$ sudo /usr/local/bin/dataWiki.sh -r ${BACKUP_FILE}


Wednesday, February 8, 2012

WKS Server


We outline the process to create a core WKS server for a private subnet.

Ubuntu 10.04 LTS Server

Download and install the 64-bit Ubuntu 10.04 LTS server ISO from Ubuntu.

Common Packages

We have a collection of packages that are deployed on all machines:

SSH

Both Ubuntu server and desktop provide an option to install an SSH server. We use the default configuration.

Mercurial (via bbpython2)

Mercurial is included via pip when bbpython2 is installed. bbpython2 is installed on all machines.

LDAP client

bbldapclient is used to authenticate against a bbopendj LDAP server.

Well-Known Services (WKS)

Our servers run in one of two environments: bare metal and virtualized. Bare metal servers act as hosts for both virtualized guests and for well-known services. We define well-known services as stable, standards-based core services that don't change very much:

  • DNS+
  • DHCP+
  • SMTP
  • LDAP server+
  • Samba
  • Cups
  • NFS
  • VirtualBox
  • Webmin
  • CFEngine

(+) Indicate that these services need regular backups.

Creating a WKS Server

Any subnet needs at least one WKS server to host DNS, DHCP, SMTP, LDAP server, Samba, NFS and Webmin (optional).

  1. Install apt-cacher-ng and its client.
  2. Install the bbpython2 libraries
  3. Install an SMTP server
  4. Install a Bind9 server
  5. Install a DHCP3 server
  6. Install an LDAP server
  7. Install an LDAP client
  8. Install a Samba server
  9. Install a CUPS server

You now have a server that can provide all of the basic services (eg authentication, file sharing, printing) for Windows, Mac and Linux machines on your network.