Bazaar¶
Bazaar is an open source distributed version control system.
See also
Installing Bazaar¶
To install Bazaar:
Open an SSH session to your account.
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.
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 an Application for Loggerhead¶
The first step in publishing Bazaar repositories on the web is to create a Custom app.
- Log in to the WebFaction control panel.
- Click Domains / websites ‣ Applications. The Apps list appears.
- Click the Add new (
) button. The Add page
appears. - In the Name field, enter a name for the application.
- In the App category menu, click to select Custom.
- In the App type menu, click to select Custom app (listening on port).
- Click the Create button. The app will be created and the View page appears.
- Make a note of the number provided by the Port field. This number is needed later in the setup process.
Create a Website Entry for Loggerhead¶
Next, create a website entry to direct requests from a domain name to your Custom app.
- Log in to the WebFaction control panel.
- Click Domains / websites ‣ Websites. The Sites page appears.
- Click the Add new button (
). The Add page
appears. - In the Name field, enter a name for the website entry.
- In the Subdomains menu, click to select a domain.
- Click the Add new button (
). An additional row in the
Site apps table appears. - In the App menu, click to select your Custom app.
- in the URL path field, enter a URL path.
- Click the Create button. The View page appears.
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 Static/CGI/PHP application’s directory.
- Open an SSH session to your account.
- Create the repository directory. Enter mkdir ~/directory_name and press Enter. For example, enter mkdir ~/bzr and press Enter.
Install Loggerhead’s Dependencies¶
Next, install Loggerhead’s dependencies. Loggerhead requires SimpleTAL, simplejson, and Paste.
- Install the latest version of SimpleTAL for Python 2. You can find a link to the latest version from Download SimpleTAL for Python 2. For example, enter easy_install-2.5 http://www.owlfish.com/software/simpleTAL/downloads/SimpleTAL-4.2.tar.gz and press Enter.
- Install simplejson. Enter easy_install-2.5 simplejson and press Enter.
- 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.
Open an SSH session into your account.
Switch to the Custom app directory. Enter cd ~/webapps/custom_app_name.
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.
Decompress the Loggerhead archive. Enter tar -zxvf loggerhead-version_number.tar.gz and press Enter. A directory called loggerhead is created.
Switch to the loggerhead directory. Enter cd loggerhead and press Enter.
Open serve-branches in a text editor.
Edit the first line of the file from this:
#!/usr/bin/env pythonto this:
#!/usr/bin/env python2.5Save and close the file
Create a Cron Job to Automatically Start Loggerhead¶
Open an SSH session into your account.
Edit your crontab. Enter crontab -e and press Enter. Your crontab file will open in your text editor.
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 (e.g. /home/username/bzr).
Save and close the file.
Now, every twenty minutes your Loggerhead installation will be automatically restarted. Once the Loggerhead process starts, you can access your repositories on the web at the domain and path you specified previously.
