SVN COPY 502 Bad Gateway error

Our developers were experiencing a weird problem recently with our SVN installation where they couldn’t copy any files in SVN, they would always get the following error

<br /> svn: COPY of /project/!svn/bc/5121/trunk/path/file.gif: 502 Bad Gateway (https://svn)<br />

A quick fix of course would have been to just create a new file and copy the contents but this wouldn’t have kept the file history. A quick google lead to this page and a solution!

Our specific problem was we had tried to be lean and set up a default https config that all our SSL sites used which specified the SSL parameters in, but we hadn’t explicitly enabled SSL in the svn vhost, so although SSL was working fine, Apache and mod_ssl actually thought the request was coming through on port 80, and thus http, instead of port 443, https, so the request was being translated to technically copy a file from one svn repository to a completely different one.

The solution was to put the SSL engine and cerficiate options back in to the svn vhost so Apache would pick up that the connect was indeed https and not http!

Version Control with Subversion

For more SVN advice, I recommend Version Control with Subversion by O’Reilly. It contains everything you need to know when using or managing SVN repositories.

New Years Resolutions

A lot of people hate the idea of new year resolutions, but if you want to make some changes and the fact it’s the start of a year will give you motivation, then so be it! Lets see how many I keep in 2009!

  • Give up smoking
  • Give up caffeine
  • Stick to diet and gym
  • Less red meat and fatty meats
  • No takeaway pizza, McDonalds or Burger King
  • Attend martial arts classes more regularly
  • Join a yoga/pilates class to improve posture/flexibility
  • Visit another contenant

Last year my resolution was to give up McDonalds, I only wavered once when stranded at Liverpool St. Station!

Resize Xen Filesystem

We run a lot of Xen instances for our development and test servers and a few were starting to get full. Fortunately the disks in the real servers were very large and the xenlet partitions were made using LVM so resizing them to add more space was possible!

root@dev-myfiles0:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.0G  3.8G  200M  95% /
varrun                257M   48K  257M   1% /var/run
varlock               257M     0  257M   0% /var/lock
udev                  257M   40K  257M   1% /dev
devshm                257M     0  257M   0% /dev/shm

Basically we just have to shut down the xenlet, resize the partition and then restart the xenlet again, simple!

root@brandy:~# xm shutdown dev-myfiles0
root@brandy:~# lvextend -L40G /dev/vg0/dev-myfiles0-disk
  Extending logical volume dev-myfiles0-disk to 40.00 GB
  Logical volume dev-myfiles0-disk successfully resized
root@brandy:~# e2fsck -f /dev/vg0/dev-myfiles0-disk
e2fsck 1.40.2 (12-Jul-2007)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg0/dev-myfiles0-disk: 16541/524288 files (0.9% non-contiguous), 138346/1048576 blocks
root@brandy:~# resize2fs /dev/vg0/dev-myfiles0-disk
resize2fs 1.40.2 (12-Jul-2007)
Resizing the filesystem on /dev/vg0/dev-myfiles0-disk to 10485760 (4k) blocks.
The filesystem on /dev/vg0/dev-myfiles0-disk is now 10485760 blocks long.
root@brandy:~# cd /etc/xen
root@brandy:/etc/xen# xm create dev-myfiles0.cfg
Using config file "./dev-myfiles0.cfg".
Started domain dev-myfiles0

Wee, lots of free space now!

root@dev-myfiles0:~# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1              40G  3.8G   37G  10% /
varrun                257M   40K  257M   1% /var/run
varlock               257M     0  257M   0% /var/lock
udev                  257M   40K  257M   1% /dev
devshm                257M     0  257M   0% /dev/shm