Obsolete: this page refers to the pre-2019 Libravatar service.

Here is a description of François' chroot-based development. These instructions should work on any Debian-based system (yes, this does include Ubuntu).

Prerequisites

You must do the following in your host environment:

  • Install app according to INSTALL.md

  • install a database server:

    apt-get install postgresql
    
  • create a user and a database:

    sudo -u postgres createuser -D -P -R -S djangouser
    sudo -u postgres createdb -O djangouser libravatar
    
  • stop Apache (if running):

    sudo /etc/init.d/apache2 stop
    
  • put the following in your /etc/hosts:

    127.0.0.1 www.localavatar.org cdn.localavatar.org seccdn.localavatar.org
    

Initial setup

To create and initialize your chroot-based environment:

  • create a new chroot:

    mkdir /var/chroot/squeeze-amd64
    debootstrap squeeze /var/chroot/squeeze-amd64 http://ftp.us.debian.org/debian
    
  • add this line to /etc/fstab:

    proc  /var/chroot/squeeze-amd64/proc  proc  defaults  0  0
    
  • mount the necessary filesystems:

    mount -a
    
  • install the schroot package and put this in your /etc/schroot/schroot.conf:

    [squeeze]
    description=Debian Squeeze amd64 (squeeze)
    directory=/var/chroot/squeeze-amd64
    root-groups=root
    personality=linux
    
  • enter the chroot as root:

    sudo schroot -c squeeze
    
  • install the required packages in the chroot:

    apt-get install git make debhelper yui-compressor python-django python-psycopg2 python-gearman.libgearman python-imaging python-openid python-dns pylint pep8 pyflakes
    
  • get a copy of the repo:

    cd /root
    git clone https://git.nzoss.org.nz/libravatar/libravatar.git
    
  • create a config file for your environment:

    cd /root/libravatar/libravatar
    cp libravatar/settings.py.example libravatar/settings.py
    

    (edit settings.py to use localavatar.org as the domain and contain the right database credentials)

  • build the packages:

    cd /root/libravatar
    make package
    
  • install the packages:

    cd /root
    dpkg -i libravatar-{common,cdn,seccdn,www}*deb
    apt-get install -f
    

    (use localavatar.org as the domain name and localhost as the db hostname)

  • create a self-signed SSL certificate:

    make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/libravatar/seccdn.pem
    cp /etc/libravatar/seccdn.{pem,crt}
    cp /etc/libravatar/{seccdn,chain}.pem
    

    (use seccdn.localavatar.org as the common name)

  • start Apache:

    /etc/init.d/apache2 start
    

Entering the chroot to work

The next time you want to get inside the chroot to do some work, simply do the following:

  • stop Apache on the main host:

    sudo /etc/init.d/apache2 stop
    
  • enter the chroot as root:

    sudo schroot -c squeeze
    
  • start apache and gearman in the chroot guest:

    /etc/init.d/apache2 start
    /etc/init.d/gearman-job-server start
    

Updating the codebase

If you want to update the Libravatar codebase you are working from, do this:

  • update the branch:

    cd /root/libravatar
    git pull
    
  • get rid of old packages:

    cd /root
    rm -f libravatar*.deb
    
  • build and install new packages:

    cd /root/libravatar
    make package
    
    cd /root
    dpkg -i libravatar-{common,cdn,seccdn,www}*deb
    
  • restart apache:

    /etc/init.d/apache2 restart