Backup Xen virtual machines with LVM snapshots and ftplicity/duplicity

Some time ago, I updated the backup system on a Server running multiple Xen VM instances (DomUs). Before changing the system, each virtual machine ran its own backup scripts to backup data to an external FTP server. Now, VMs are centrally backed up to FTP from the Dom0 using LVM (Logical Volume Manager) snapshots. As a backup solution I chose duplicity and ftplicity in combination with a shellscript to create automated LVM snapshots. Duplicity is a tool to create GPG-encrypted (this way you can store your backups at remote servers without having to worry about who has access to your data) incremental backups to remote servers, ftplicity is a wrapper script for duplicity which allows running duplicity without interaction (e.g. without the need to type any passwords). Ftplicity was originally published by the German computer magazine c’t, but has been undergone further development and is now hosted at SourceForge.

You can find tutorials on ftplicity/duplicity here (Note: they use the original c’t version of ftplicity):

Basically you can use this setup for any kind of LVM snapshot based system, but I’m focusing on backing up Xen VMs here. I assume you got your LVM and Xen system up and running so far. I did this on a Debian Lenny system, but it should be similar on other distros. I did all steps as root.

read more »

MySQL backup user

To create a backup user for MySQL you need at least the following privileges (to use mysqldump):

GRANT SELECT, SHOW VIEW, LOCK TABLES ON *.* TO 'backup'@'localhost';

Repack a .deb-archive with dpkg-deb

I just needed to repack a Debian package to solve this problem. After a quick spin to #debian I got this solution:

$ mkdir -p extract/DEBIAN
$ dpkg-deb -x package.deb extract/
$ dpkg-deb -e package.deb extract/DEBIAN
[...do something, e.g. edit the control file...]
$ mkdir build
$ dpkg-deb -b extract/ build/
  • -x extracts the package contents
  • -e extracts the control files
  • -b builds the new package

Done.

FH Raumbelegung: iCal Support für Wochenübersicht

FH Raumbelegung: iCal Support für Wochenübersicht

Ab sofort gibt es in meinem Raumbelegung-Webservice die Möglichkeit, die Wochenübersicht via iCal abzurufen. Dadurch lässt sich der Service komfortabel in Kalenderapplikationen (z.B. der Thunderbird-Extension Lightning) verwenden. Verwendung: einfach an eine Wochenübersicht den Parameter format/ical anhängen oder die entsprechenden Links am Ende der Übersicht verwenden.

Um zum Beispiel immer die aktuelle Woche des Studiengangs WI07 als Kalender in meinem Thunderbird anzeigen zu können, habe ich dort folgende URL als iCal-Quelle angegeben:

http://raumbelegung.stud.ailoo.net/week/show/class/wi07-vz/format/ical

Vorschläge sind wie üblich willkommen :)

Build a FlashMessenger system in ASP.NET MVC

Build a FlashMessenger system in ASP.NET MVC

Usually, I’m using PHP for web projects, but currently I’m working on an application using ASP.NET’s MVC framework. In many frameworks (e.g. Zend Framework or CakePHP) there is some kind of messaging system (flash messages), which allows to save a message to the session and to display it on the next request. This is useful in many situations, but mostly used after saving forms. So for example you recieve a POST request to create a new record, you save the record, redirect the user to the overview page and inform him about successful creation through a flash message which you saved before doing the redirect. As I didn’t find a way how to achieve this in ASP.NET MVC, I started to build an own solution. The result is a combination of a base controller, an action filter and a flashmessenger object which is stored in the session. Please note that I’m not too familiar neither with ASP.NET nor with C#/.NET in general, so if there are things to improve please feel free to correct me.

read more »

Set up a Zend Framework application using Zend_Application (including PHPUnit setup)

Today I spent some time setting up a new Zend Framework application using ZF 1.8.0 Beta 1 and the new component Zend_Application. Using that component, all bootstrapping is done by Zend_Application_Bootstrap and so-called resource plugins. Such resource plugins are responsible for initialization of single components such as front controller, database or the view. This way, the whole bootstrapping is nicely modularized and keeps some headache away. In addition, the majority of settings can be set in the application config file. As I ran into some issues, I’d like to note the required steps and hope that it’s useful so someone. I won’t explain the files in detail, you can find enough information about components and parameters on the manual and the quickstart, but you should get to a working setup with just copy&pasting the code here ;)

Basically a big part of this setup can be done using the new Zend_Tool CLI, however I had some problems setting it up, so I’ve done it manually (however most of the code is the one generated by Zend_Tool).

read more »

Upgrade from Debian Etch/Xen 3.0 to Debian Lenny/Xen 3.2 (AMD64)

I was running a Xen server with Debian Etch as dom0 (Linux 2.6.18-6 with Xen 3.0.3-1 on AMD64) for some time now. Today, I decided to upgrade the dom0 to Debian Lenny (Linux 2.6.26-2 with Xen 3.2.1-2). The domUs are all running a Debian-based OS (3x Lenny, 1x Ubuntu Hardy). The upgrade was quite straightforward, however there were some pitfalls you can avoid in advance.

read more »

Authenticate Apache against Redmine with AuthMySQL

For a student project we needed to authenticate an apache host against a MySQL database, in this a case we wanted to handle authentication for a Subversion repository with a Redmine database. I know that Redmine has its own solution for this problem using Redmine.pm, but for some reason that approach didn’t work and we didn’t have the time to bug around with it. This howto is written for the use with Redmine (especially the database view), but you should get the point how to set it up on other environments. The howto was done on an Ubuntu 8.10 box but should work on any other distro as well (except for the module installation). I assume that you got all the other stuff (apache, mysql, …) up and running.

read more »

gitosis-create-repo

A simple script to create a new gitosis-repository on the fly. I’m not really familiar with bash scripting so don’t expect too much ;)

#!/bin/bash
if [ -z $1 ]; then
    echo "Please specify a repository."
    exit 1
fi

if [ -z $2 ]; then
    echo "Please specify a remote url."
    exit 1
fi

if [ -d $1 ]; then
    echo "Repository already exists."
    exit 1
fi

mkdir $1
cd $1
git init
touch .gitignore
git add .gitignore
git commit -a -m "Initial commit."
git remote add origin $2:$1.git
git push origin master:refs/heads/master

Please make sure you set the correct permissions in gitosis.conf. Example:

[group me]
members = me@example.com
writable = test</pre>

Then you can run the script to create a new repository test on myhost.example.org:

$ gitosis-create-repo test git@myhost.example.org