TruePERSPECTIVES_logo.png

Simple setup of Subversion and Trac repositories

Posted by Mattias Norlander on Sep 25, 2015 8:49:52 PM

Have you many times thought about setting up your own version control and issue management server but have not yet found enough time? Getting these services up and running on a server is probably not your core competency. And if you are a consultant, setting up the server environment is not something you can easily charge your customer for. Yet not having these tools available will probably effect your product time-to-market, system quality and the overall project costs.

This is a dilemma for start-up companies, individual consultants, small companies, or anyone who does not have an IT-department supporting the project with serverconfigurations.

In this blog-post we are going to teach you how to get your subversion and trac server stack setup and running in less than one hour. The stack is running inside a virtualised environment simplifying backups and enabling it to run on many different host operating systems.

All components are open-source and free to use for anyone. This setup is going to run in a virtualized environment using Virtualbox and Bitnami stacks. As you probably are aware of, Atollic TrueSTUDIO integrates both version control clients and issue management clients. So let's make all these tools play together.


Introduction

In order to get up and running as easy as possible with Subversion and Trac on a server computer, we are going to use Bitnami stacks running inside a virtual machine on your server computer. Another option is to install all services and depending libraries from scratch in a native or virtualized machine. But the sole purpose of this blog post is to provide a quick path to a version control and issue management server  environment, and therefore Bitnami is a good solution.

What is Bitnami?

"Bitnami is a library of popular server applications and development environments that can be installed with one click, either in your laptop, in a virtual machine or hosted in the cloud. We take care of compiling and configuring the applications and all of their dependencies (third-party libraries, language runtimes, databases) so they work out-of-the-box. The resulting packaged software (a 'stack') is then made available as native installers, virtual machines and cloud images. These Bitnami application packages provide a consistent, secure and optimized end-user experience when deploying any app, on any platform.", see Bitnami webpage for more info.

Bitnami provides their application stacks both as native Windows/Linux/OS X installers and as virtualized machines which can be imported by VirtualBox or VMWare. The choice is of course yours, but from I prefer using virtualized environments for maintenance reasons amongst many others.

Bitnami Trac virtual machine?

In this tutorial we are going to make a ready-made Trac/Subversion stack hosted on a Ubuntu 14.04 system. This means that knowledge about Ubuntu may come in handy, but is not a requirement. For more information about the stack go here: https://bitnami.com/stack/trac/README.txt

System requirements

If you are going to use the virtualized machine approach with VirtualBox, then the following system requirements apply on your (host) server computer:

  • Reasonably powerful x86 hardware. Any recent Intel or AMD processor should do.
  • Memory. Minimum 512 MB of RAM, 1 GB is recommended for Trac/Subversion stack.
  • Hard disk space. While VirtualBox itself is very lean (a typical installation will only need about 30 MB of hard disk space), the virtual machines will require fairly huge files on disk to represent their own hard disk storage. Make sure that you have at least 4 GB of available disc space.
  • A supported host operating system. Presently, supporting Windows (XP and later), many Linux distributions, Mac OS X, Solaris and OpenSolaris
  • The guest machine are by default going to use port 3690 for subversion and 80 for trac
  • Your development team (dev-laptops and servers) are located on the same LAN, hidden behind a 

In this tutorial we are using the following software versions:

Bitnami Trac virtual machine "Trac 1.0.9-0 (64-bit)"
https://bitnami.com/stack/trac/virtual-machine

VirtualBox 4.2.12 for Windows hosts, current official version is 5.0.4 https://www.virtualbox.org/wiki/Downloads

Disclaimer

Since this topic is a guide on how you can version control and maintain your data a disclaimer may actually be a good idea.

All content provided in this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. 

The owner of this blog post will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.

Step 1: Download and install

  1. First you need to double-check in the server computer BIOS that "Virtualization technologies" or "VT-x" is enabled. This setting is probably found in system configuration or device configuration category of BIOS. If this setting is enabled, neither your 32 nor your 64-bit host computer will be able to run the 64-bit guest machine.
  2. Download VirtualBox from here: https://www.virtualbox.org/wiki/Downloads
  3. Download the Bitnami Trac/Subversion virtual machine from here: https://bitnami.com/stack/trac/virtual-machine
  4. Run the installer for VirtualBox, to install the virtualization environment. The installation should be straight-forward.
  5. Open VirtualBox
  6. Importing the Bitnami trac/subversion virtual machine is done this way:
    1. Un-zip the downloaded package: bitnami-trac-1.0.9-0-ubuntu-14.04.zip
    2. In VirtualBox Menu: Machine > New
      1. Name and operating system
        1. Give the machine a Name (i.e. Bitnami_trac_svn)
        2. Type: Linux
        3. Version: Ubuntu (64-bit)
        4. Click Next
      2. Memory size
        1. Choose the amount of RAM that is dedicated to the virtual machine, 1GB of RAM is recommended, but 512 MB is probably sufficient in most cases.
        2. Click Next
      3. Hard disk
        1. Choose Use an exisisting virtual hard disk file
        2. Browse, choose the unzipped file bitnami-trac-1.0.9-0-ubuntu-14.04.vmdk, yes there are several...
        3. Click Create

By completing these steps you hopefully have a virtual machine running Trac and Subversion. What you currently don't have is a way to access these servers from outside the virtual machine itself, e.g. from TrueSTUDIO on your dev-laptop.

 

Step 3: Configure server-side

Guest machine network connection

CAUTION! Make sure that your repository data (your guest machine) is only accessible to the intended users

Providing access for Atollic TrueSTUDIO to the guest machine can be accomplished in several different ways. In this guide I am assuming that your dev-laptop and your server machine are on the same LAN, and DHCP is used to obtain IP-addresses. What about security? Solving potential security issues is up to you, but as a recommendation make sure that no unintended ports are forwarded to the guest machine IP-address.

The easiest way of obtaining a DHCP IP-address for the guest machine and thereby make it available to any computer in your LAN is to configure the network connection to bridge the network adapter used to connect to your LAN. Bridging an adapter basically means that the guest machine is allowed to use one of your network adapters (ethernet card or wi-fi, or both if multiple adapters are configured) to access your LAN. The adapter will be shared between the host and the guest, but the host and guest will have different IP-addresses. 

  1. In VirtualBox make sure that your guest machine (Bitnami_trac_svn or whatever name you gave it) is not running. If it is running all menus will be greyed out as seen in the screenshot above.
  2. Select your guest machine and click on the menu: Machine > Settings 
    1. Choose Network
    2. Choose Adapter 1
      1. Choose Attached to: Bridged Adapter
      2. Name: Choose the network interface from the host PC that you wish to bridge for the virtual guest machine.
      3. Choose Promiscous mode: Deny
      4. The MAC-address may be worth noting if you wish to make sure that your DHCP-server/internet router statically assigns a certain IP-address to this MAC-address. In this way we can make sure that the server has a static IP-address even though DHCP manages the addresses.
      5. Click OK

It is now time to start your guest machine for the first time. Select the guest machine (in my example Bitnami_trac_svn) and click Machine > Show.

The guest machine now boots. The username and password is shown in the console (u: bitnami, p: bitnami). On the first login attempt you will be prompted to change the password for the bitnami user. Do so!

To find out the IP-address of your server type: ifconfig

In my case the IP-address to this guest machine is 192.168.108.185.
It is a good idea to try to see if you can ping the guest machine from your development laptop.

Port-forwarding for Subversion

By default the TCP port 3690 is not forwarded making it impossible to access the Subversion repository. We therefore need to add a rule to the firewall iptables in Ubuntu. This can be done in various ways. The simplest way is by entering the following command:

sudo ufw allow 3690

If you want to change the rules for how this port is exposed to the network then the following forum thread may be of interest: http://ubuntuforums.org/showthread.php?t=823741

After changing the iptables configuration one must restart the subversion service in order for the port rule to take effect, this is done using a Bitnami script:

sudo /opt/bitnami/ctlscript.sh restart

Subversion should now be available using the svn-protocol. We will verify this from inside of TrueSTUDIO using the integrated subversion client during the next step when we setup TrueSTUDIO.

Verify Trac access

In order to verify that you now have access to Trac, open your web-browser and navigate to <IP-ADDRESS/Project/>. So in my case as seen above, the address to access trac would be http://192.168.108.185/Project/

Trac is now ready to be configured according to your own company project management processes. Using the web interface you can define users, milestone, categories, severity levels, etc...

Congratulations your server is now up and running, let us connect to it with the integrated clients in Atollic TrueSTUDIO!

 

Step 4: Setup TrueSTUDIO

Let us now take a look at how TrueSTUDIO is connected to the Trac and subversion repositories.

Connect to Subversion repo

In TrueSTUDIO use the toolbar menu: Window > Show View > Other

    1. In the Show View dialog, type SVN in the filter.
    2. Select and open the SVN Repositories view.
    3. In the upper right-corner fof this view click on the button New repository location.
Bitnami_Trac_SVN_trac_svn_client_connect.png
  1. Fill in the necessary details:
    1. URL: svn://<IP-ADDRESS>/opt/bitnami/apps/trac/trac_repositories/repository
    2. User: bitnami
    3. Password: the password you changed to (default is bitnami)
    4. For convenience, check the Save authentication check-box
    5. Click Finish

The SVN Repositories view should now show a connection to your repository as seen below:

I am not going to describe how to work with the Subversion client in this tutorial since the blog is not the best format for learning to use the client. Instead I recommend taking a look at our youtube channel where there are a number of videos on basic and advanced usage of the Subversion client in TrueSTUDIO, here are links to these playlists: 

Basic playlist:
https://www.youtube.com/playlist?list=PL9R62iP19vfyHFFYh-sETKABOYxXNOOBj

Advanced playlist:
https://www.youtube.com/playlist?list=PL9R62iP19vfxFObQEo10p-sjmDToWMPvB

 

Connect to Trac repo

 In TrueSTUDIO use the toolbar menu: Window > Show View > Other

    1. In the Show View dialog, type Task repositories in the filter.
    2. Select and open the Task Repositories view.
    3. In the upper right-corner fof this view click on the button Add Task Repository...

  1. Select Trac (...)
  2. Click Next
  3. Enter the necessary connection details
    1. URL: http://<IP-ADDRESS>/Project
    2. Username: user
    3. Password: bitnami
    4. Check Save password
    5. Click Validate settings
    6. Click Finish

The validate settings button will tell you wheter a repository exists on the specified URL and whether username/password authentication works. Click Finish and your repository is connected to TrueSTUDIO. The connection details for Subversion and Trac is stored as workspace metadata. Therefore the connection will need to be re-established in any new workspace.

Unfortunately XML-RPC protocol is not part of this stack, therefore the Additional Settings > Acces type, must be Automatic or Web. Personally I think XML-RPC supports dramatically improves the IDE integration and would recommend installing this protocol into the guest machine. Perhaps there will be an article later covering this procedure.

General instructions on how to isntall XML-RPC are available here:
https://trac-hacks.org/wiki/XmlRpcPlugin

 

Step 5: Short introduction to listing and creating/modifying tickets

For a user completely new to Trac getting started is quite simple. In this blog post I will however only describe what I believe to be the two most elemntary use cases when working with issue management, bug reports, feature quest, etc... The use cases are:

  • Listing tickets
  • Creating/modifying ticket

Working with tickets in general is done from the Task List view. Open this view, by default it is hidden behind the Outline view in TrueSTUDIO C/C++ perspective.

Listing tickets

Provided that you are connected to your trac repository you should be able to create a Query which generates a list of tickets matching a certain set of user-defined criterions.

  1. In the Task List view click on the downwards pointin arrow just to the right of the New Task button. 
    1. Choose New Query...
  2. Select the name of your recently added Trac repository in my case above Bitnami trac.
    1. Click Next
  3. Next step in the wizard will show you the query parameters available depending on how you have setup the project in Trac. These can be modified by logging into Trac as a user with administrator permissions. We will not do this now, but when you wish to do that, then use the default username: user, which has TRAC_ADMIN permissions. This 
    1. Query wizard allows us to specify a query that only lists tickets matching a certain set of criterions. If we are interested in listing all unresolved bug report tied to version 1.0 with priority blocker, we can do so by selecting:
      1. TitleOpen Blocker Bug Reports. Version 1.0
      2. Version1.0
      3. Status: accepted, new, assigned, reopened
      4. Type: defect
      5. Priority: Blocker
      6. Click Finish

By clicking finish, the trac client (Task List view) will query the trac repository for tickets matching the specified query parameters. After adding two example tickets (matching the query parameters) the result could look like this:

Add additionalt queries to filter down tickets you wish to view in different categories.

 

Adding tickets

To add a ticket, write a bug repo, a feature request, or a general to-do item, the New Task... button is used.

  1. In the Task List view click on the New Task button.
  2. Select the name of your recently added Trac repository in my case above Bitnami trac.
    1. Click Next
    2. Click Finish (with XML-RPC support this works a lot better) to open an integrated web browser to access the New Ticket page.
    3. You may optionally choose to attach files.
    4. Fill in details and click Create ticket.

The ticket is now submitted into the trac repo. You can right-click on the recently created query/list (Open Blocker Bug Reports. Version 1.0) and click Synchronize in order to refresh the information from the repo into the client. But by default the synchronization should happen automatically on a periodic basis.

That is basically it, double-click on any ticket to open/modify it.

Step 6: Learn more

Interested in learning more about Subversion and Trac? Our youtube-channel contains Subversion video tutorials (see links earlier in this post).

If requested I may write an article on installing XML-RPC into the server for more convenient ticket/issue management. You can request that by leaving a comment below. Some of the key benefits are that you are able to access tickets even when you are offline since the clients stores the latest information locally. Additionally it becomes easy to take and attach screenshots to your bug reports and to use context awareness.

We also have a white paper that provides an excellent introduction to version control with details on how to use Subversion inside the TrueSTUDIO IDE.

New Call-to-action


 

Topics: Subversion, trac, version control, virtualbox, bitnami, issue management, virtualised machines