Bazaar

Bazaar is an open source distributed version control system.

See also

Mercurial

Installing Bazaar

To install Bazaar:

  1. Open an SSH session to your account.

  2. Install Bazaar. Enter easy_install bzr and press Enter.

    Note

    You can specify which Python version to use to install Bazaar by entering easy_install-X.Y bzr where X.Y is a Python version number. For example, to use Python 2.5, enter easy_install-2.5 bzr.

  3. Configure the default name and email address to appear by default in commits made from your Bazaar installation. Enter bzr whoami "name <email_address>".

You can now use the command line tool bzr to work with Bazaar repositories. Enter bzr help and press Enter for a list of commands. To learn more about using Bazaar, see Bazaar in five minutes and the Bazaar User Guide.

Publishing Bazaar Repositories with Loggerhead

You can create an application to serve the Loggerhead server on the web.

Create a Website and Application for Loggerhead

First, create a website with an application for Loggerhead:

  1. Log in the WebFaction control panel.

  2. Click Domains / websites ‣ Websites. The list of websites appears.

  3. Click the Add new website button. The Create a new website form appears.

  4. In the Name field, enter a website name.

  5. If applicable, in the Machine menu, click to select the server to host the website.

  6. If applicable, in the IP address menu, click to select the IP address to serve the site.

  7. If you want your site served over an HTTPS connection, click to select Encrypted website (https).

  8. For each domain name you want to use with the website, add it to the list of domains. In the Domains field, enter the domain name. Enter one or more domain names. If the domain has not yet been added to the control panel, click the Create link that appears at the bottom of the list of domains to add it.

  9. Add an application for Loggerhead.

    1. Click Add an application ‣ Create a new application. The Create a new web app form appears.
    2. In the Name field, enter a name for the application.
    3. In the App category menu, click to select Custom.
    4. In the App type menu, click to select Custom app (listening on port).
    5. Click the Save button. The application is installed and added to website’s list of applications.
  10. Click the Add website button. The website is created and added to the list of websites.

  11. Make a note of the port number for the Loggerhead application. This number is required later in the installation process. Click Domains / websites ‣ Applications. The list of applications appears. The application’s port number appears next to the application’s type.

Create a Place to Store Bazaar Repositories

Next, a directory needs to be created where the repositories themselves will be stored. Typically, this will be a directory outside of the custom application’s directory.

  1. Open an SSH session to your account.
  2. Create the repository directory. Enter mkdir path, where path is the path to the new directory, and press Enter. For example, enter mkdir $HOME/bzr and press Enter.

Install Loggerhead’s Dependencies

Next, install Loggerhead’s dependencies. Loggerhead requires SimpleTAL, simplejson, and Paste.

  1. Install the latest version of SimpleTAL for Python 2. Enter easy_install-2.5 url, where url is a URL to the latest version archive (found at Download SimpleTAL for Python 2.), and press Enter.
  2. Install simplejson. Enter easy_install-2.5 simplejson and press Enter.
  3. Install Paste. Enter easy_install-2.5 Paste and press Enter.

Download and Setup Loggerhead

The next step is to download Loggerhead and configure it to use the right version of Python.

  1. Switch to the Custom application directory. Enter cd ~/webapps/custom_app_name.

  2. Download the latest version of Loggerhead. You can find a link to the latest version from the Loggerhead download page. For example, enter wget http://launchpad.net/loggerhead/1.17/1.17/+download/loggerhead-1.17.tar.gz and press Enter. An archive is created in the current directory.

  3. Decompress the Loggerhead archive. Enter tar -zxvf loggerhead-version_number.tar.gz and press Enter. A directory called loggerhead is created.

  4. Switch to the loggerhead directory. Enter cd loggerhead and press Enter.

  5. Open serve-branches in a text editor.

  6. Edit the first line of the file from this:

    #!/usr/bin/env python
    

    to this:

    #!/usr/bin/env python2.5
    
  7. Save and close the file

Create a Cron Job to Automatically Start Loggerhead

  1. Open an SSH session into your account.

  2. Edit your crontab. Enter crontab -e and press Enter. Your crontab file will open in your text editor.

  3. Add this line to your crontab:

    10,30,50 * * * * /home/<username>/webapps/<custom_app_name>/loggerhead/serve-branches --port=<number> <bzr_directory> &> /home/<username>/webapps/<custom_app_name>/loggerhead.log

    where

    • <username> is your username,
    • <custom_app_name> is the name of your Custom app,
    • <number> is the port number assigned to your Custom app,
    • and <bzr_directory> is the full path to the directory you created to store repositories (for example, /home/username/bzr).
  4. Save and close the file.

Every twenty minutes your Loggerhead installation is automatically restarted. Once the Loggerhead process starts, access your repositories on the web at the domain and path you specified previously.