Wednesday, May 09, 2007

Virtualization makes another thing easier: complete, bare-metal backups. With this contributed package (vzdump), it is very easy to make backups of complete VE, sometimes with only little distruption.

Features:
  • Can send an e-mail when finished
  • Can compress the resulting tarball
  • Can selectively back up individual VE, or just all of them
  • Can use different method to make sure the snapshot is consistent (stop the VE, suspend the VE, LVM snapshot)
  • Restoring is very easy and the VEID can be different than the original
  • Can do differential backup using xdelta (not tested myself)

Steps to setup my asterisk server in an OpenVZ VE

  • Set the VE up
  • Install asterisk
    • wget ftp://ftp.digium.com/pub/asterisk/asterisk-1.2-current.tar.gz
    • tar -xzf asterisk-1.2-current.tar.gz
    • cd asterisk-1.2.18/
    • yum install glibc-devel ncurses-devel gcc openssl-devel zlib-devel
    • make
    • make mpg123
    • make install
    • make config
    • Edit /usr/sbin/safe_asterisk to comment out the line about TTY 9
  • Start asterisk
  • Copy asterisk config files (/etc/asterisk/*)
  • Copy moh mp3's (/var/lib/asterisk/mohmp3/)
  • Copy custom sounds (IVR)
  • Copy voicemail directory
  • Get french sounds :
    • wget ftp://ftp.digium.com/pub/telephony/sounds/asterisk-core-sounds-fr-wav-current.tar.gz
    • tar -xzf asterisk-core-sounds-fr-wav-current.tar.gz
    • Use the script "install_french.sh" (must be run in /var/lib/asterisk/sounds/fr) (see below for script)
  • Change DNS records
  • Test!
  • Create backups (with vzdump)
install_french script:
#!/bin/bash

# Script creant des liens symboliques permetannt l'utilisation des fichiers audios plus rapidement
#
# Clod Patry (removed e-mail address)
# Version 1.0 05/5/2006 (happy birthday mom)

SOUNDS_ABS=/var/lib/asterisk/sounds
LANGUAGE=fr

#root
if [ ! -e $SOUNDS_ABS ]; then
echo "Le repertoire $SOUNDS_ABS ne semble pas exister. Installez asterisk ou corriger le \$SOUNDS_ABS";
exit;
fi

DIR=dictate
CUR=$PWD/$DIR
if [ ! -e $SOUNDS_ABS/$DIR/$LANGUAGE ]; then
if [ ! -e $CUR ]; then
echo "Le repertoire $CUR ne semble pas exister.";
else
ln -s $CUR $SOUNDS_ABS/$DIR/$LANGUAGE
fi
else
echo "Impossible de creer $SOUNDS_ABS/$DIR/$LANGUAGE , il existe deja."
fi


DIR=digits
CUR=$PWD/$DIR
if [ ! -e $SOUNDS_ABS/$DIR/$LANGUAGE ]; then
if [ ! -e $CUR ]; then
echo "Le repertoire $CUR ne semble pas exister.";
else
ln -s $CUR $SOUNDS_ABS/$DIR/$LANGUAGE
fi
else
echo "Impossible de creer $SOUNDS_ABS/$DIR/$LANGUAGE , il existe deja."
fi


DIR=letters
CUR=$PWD/$DIR
if [ ! -e $SOUNDS_ABS/$DIR/$LANGUAGE ]; then
if [ ! -e $CUR ]; then
echo "Le repertoire $CUR ne semble pas exister.";
else
ln -s $CUR $SOUNDS_ABS/$DIR/$LANGUAGE
fi
else
echo "Impossible de creer $SOUNDS_ABS/$DIR/$LANGUAGE , il existe deja."
fi


DIR=phonetic
CUR=$PWD/$DIR
if [ ! -e $SOUNDS_ABS/$DIR/$LANGUAGE ]; then
if [ ! -e $CUR ]; then
echo "Le repertoire $CUR ne semble pas exister.";
else
ln -s $CUR $SOUNDS_ABS/$DIR/$LANGUAGE
fi
else
echo "Impossible de creer $SOUNDS_ABS/$DIR/$LANGUAGE , il existe deja."
fi