Bazaar is an open source distributed version control system.
To install Bazaar:
Open an SSH session to your account.
Install Bazaar. Enter easy_install bzr and press Enter.
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 a Website and Application for Loggerhead¶
First, create a website with an application for Loggerhead:
Log in the WebFaction control panel.
Click Domains / websites ‣ Websites. The list of websites appears.
Click the Add new website button. The Create a new website form appears.
In the Name field, enter a website name.
If applicable, in the Machine menu, click to select the server to host the website.
If applicable, in the IP address menu, click to select the IP address to serve the site.
If you want your site served over an HTTPS connection, click to select Encrypted website (https).
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.
Don’t forget to point new domains to the WebFaction name servers.
Add an application for Loggerhead.
- Click Add an application ‣ Create a new application. The Create a new web app form 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 Save button. The application is installed and added to website’s list of applications.
Click the Add website button. The website is created and added to the list of websites.
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.
- Open an SSH session to your account.
- 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¶
- 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.
- 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.
Switch to the Custom application 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:
Save 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
- <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).
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.