Posts tagged ‘subversion’

February 8th, 2009

Repository Backups

With the repository now housing the most important parts of the project, the documentation and the source code, it is very important that this resource be backed up.

In Subverion there are two types of backup methods:

  • Full - a full backup gathers all the information in the repository required to fully reconstruct the repository should a disaster occur.
  • Incremental - an incremental backup gathers the information that has changed in the repository since the previous backup.

The Moge repository uses the FSFS filesystem implementation and to keep things simple I will use a full backup. A full backup can be performed using the svnadmin subcommand hotcopy.


This just takes a copy of the respository at REPOS_PATH and puts it at REPOS_BACKUP_PATH.

I created a little script to do the hotcopy and create a bzip2 archive with today’s date appended to the name. The script then emails the archive to a gmail account so I have a backup offsite. Archives remain in the backup folder for 30 days after which the script will remove them.

Next thing to do is to automate the backup to happen on a nightly basis, the Unix scheduler cron can be used for this very task. To tell cron to do jobs for you it requires a crontab which is a file that is read by cron and contains lines that define a job or task to be run with attributes defining when the job is to run. This file can be edited with the following command:

$ crontab -e

This will open the file in the default editor. There are 6 fields in a line to define a task, these are shown below:

# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
  *  *  *  *  *  command

I want to run the backup daily at 3am, so I’d add a line as follows:
0 3 * * * /usr/local/bin/php /home/amorey/backup/mogeBackup.php

Once you save and exit the editor the crontab will be set.

February 4th, 2009

Version Control System

At a very basic level, a version control system, is like having a big undo feature for the entire project. Versions of a file can be reverted back to a previous version or even the entire project can be rolled back to a previous state. As changes are made and checked into the repository a log message is written to describe it, so later it is easy to generate a Changelog that shows the changes from release to release. While this project has only one developer, me, in general multiple developers would be involved in a project and having a VCS can help support collaboration while also providing accountability for each change made by each user.

I’ve used CVS and Subversion on other projects, so I have experience with both and know the benefits of both first hand. CVS is now an old version control system which lacks some features of newer version control systems. Knowing that there are many other systems available I’ve decided to use Subversion for my project as I know it has the features I need and I don’t have the time to invest into any other system.

Project Repository: