Posts by James-Mitchell
  1. Setting up your own trac and subversion ( Counting comments... )
Technology/ Code /

So you've started your game project but you need a few useful tools such as a version control system and a bug tracker, so here are some basic steps for setting up Subversion (SVN) and Trac (A bug tracker).

First things first you need to get your self a server or Virtual Private Server(VPS), for this post I am using a Debian Squeeze VPS. I'm not going to cover how to use linux in this post, or how to setup DNS (if you host DNS on the server, etc).

I'm guessing you want your svn and trac setup as sub domains under your website, so you'll need to first modify your DNS so then trac.yourdomain.com and svn.yourdomain.com both have address records pointing to your servers IP

Now lets login to the server, and install the required files, in this case they are subversion, trac and apache.

On Debian Squeeze this is done with

apt-get install subverison trac apache2 libapache2-svn libapache2-mod-wsgi

Press Y to accept installing of dependencies.

Lets decide how you want to store the files, for this game I will be using.

  • /srv/trac.mygame.tld to store the trac of my game
  • /srv/svn.mygame.tld to store the svn data for my game
  • /srv/passwd.mygame.tld to store the passwords to access both of these (I want my private game stuff only accessible by me and my team)

Lets start by creating our users, so our first user is me (Use -c to create file for first user)

htpasswd -c /srv/passwd.mygame.tld james

Then I type in my password, then I want to create another account for mary

htpasswd /srv/passwd.mygame.tld mary

Then I type in marys password, you can keep going add as many users as you want, or add them later.

Lets start by creating our svn, this is the easy one

svnadmin create /srv/svn.mygame.tld

So thats the repo created now lets make this repo visible so it can be checked out. First things first lets make sure that www-data has permissions to it.

chown -R www-data:www-data /srv/svn.mygame.tld

Next thing is to setup apache with DAV svn, so lets create /etc/apache2/sites-available/svn.mygame.tld with our VirtualHost, if your new to linux, I suggest using nano to edit files (e.g. "nano /etc/apache2/sites-available/svn.mygame.tld"), now here is what the conf file should look like.

<VirtualHost *:80>
        ServerName svn.mygame.tld
 
        <Location />
                DAV svn
                SVNPath /srv/svn.mygame.tld
                AuthType Basic
                AuthName "My Game"
                AuthUserFile /srv/passwd.mygame.tld
                Order deny,allow
                Require valid-user
        </Location>
</VirtualHost>

Now lets symlink this site config file to be enabled.

ln -s ../sites-available/svn.mygame.tld /etc/apache2/sites-enabled/svn.mygame.tld

Finally reload apache so we can test if it works

/etc/init.d/apache2 reload

So do a checkout on http://svn.mygame.tld (or your website, remember because we've used apache its http:// not svn://), hopefully this should work

flawlessly, and you should be able to checkout and commit files to your svn.

SO the next step in the process is setting up trac so we can have some form of bug and task tracker setup.

trac-admin /srv/trac.mygame.tld initenv "My Game" sqlite:db/trac.db svn /srv/svn.mygame.tld

Now we need to add someone as the inital administrator (others can be done via trac web admin), so in this case that will be me

trac-admin /srv/trac.mygame.tld permission add james TRAC_ADMIN

Now in order for trac to integrate with apache you must setup a WSGI wrapper, so lets create a place to store this file. (We want it in its own folder)

mkdir /srv/trac.mygame.tld/cgi-bin

Now the file should be /srv/trac.mygame.tld/cgi-bin/trac.wsgi it will contain a basic WSGI wrapper for example:

import os
 
os.environ['TRAC_ENV'] = '/srv/trac.mygame.tld'
os.environ['PYTHON_EGG_CACHE'] = '/srv/trac.mygame.tld/eggs'
 
import trac.web.main
application = trac.web.main.dispatch_request

Next step now we've got that part setup is to make sure www-data has access to the trac files

chown -R www-data:www-data /srv/trac.mygame.tld

Now lets create our site in apache (/etc/apache2/sites-available/trac.mygame.tld)

<VirtualHost *:80>
        ServerName trac.mygame.tld
        WSGIScriptAlias / /srv/trac.mygame.tld/cgi-bin/trac.wsgi
 
        <Directory /srv/trac.mygame.tld/cgi-bin>
                AuthType Basic
                AuthName "My Game"
                AuthUserFile /srv/passwd.mygame.tld
                Order deny,allow
                Require valid-user
        </Directory>
</VirtualHost>

Next thing is to link it so the site is enabled

ln -s ../sites-available/trac.mygame.tld /etc/apache2/sites-enabled/trac.mygame.tld

Then finally reload apache again

/etc/init.d/apache2 reload

Now that should be trac configured and setup and you should be able to go http://trac.mygame.tld and see your trac,
I'm guessing you want your logo at the top of trac, instead of the broken image link, to update this replace /srv/trac.mygame.tld/htdocs/your_project_logo.png with your logo, or change the logo location in /srv/trac.mygame.tld/conf/trac.ini

Now that this is completed you can keep adding more projects using the same steps (excluding the apt-get part). Now that is half the battle establishing a work flow that works well for your team in trac, and adding any plugins you want is the next.

Have Fun.