• 1 min read
  • I'm going to be upgrading this blog to D7 soon so I can experiment a bit with a live install... Sorry if there's some (brief) unexpected downtime!

    Edit 2011-02-26: It's up and running! Not the most pleasant upgrade experience, but then again I can't complain too much for a point-zero release. Most of the issues were caused by third-party modules (namely Fivestart Comment and CKEditor). Also, as a reminder to those who are using custom color styles on a Drupal theme: changes in the theme's CSS will only take effect *after* you save the theme settings to re-generate the theme CSS! I spent about 50 minutes trying to figure out why any CSS changes were not being applied until it hit me and /facepalm ensued...

    Edit 2011-03-01: Just realized that the howto indexes (which use Views) were completely broken until now. Sorry about that! It's been fixed now, although the formatting (mostly page breaks) are rather broken on the howto pages themselves, I'll have to clean that up next week.

  • 1 min read
  • I was in the metro today and the train arrived at the stop as usual, but as it came to a complete stop the doors didn't open. The conductor was obviously trying repeatedly to open the doors because the red lights at the top of the cars kept flickering on and off (they usually stay on when the metro doors are open).

    After about 2 minutes trying to get the doors open, the conductor shut down the metro train, so the air vents stopped and lights when out for a brief moment as she/he restarted the engines. It's perfectly logical that this is possible as after all, they have got to start the trains at the beginning of the day to get them moving along the metro lines but it was just bizarre to see a train in its powered down state.

    The good news is whatever restarting the engines does fixed the problem - the doors opened immediately after the conductor "reset" the metro train.

  • 2 min read
  • Sometimes the brain just amazes me. On the way home a few days ago I was listening to Paul van Dyk - Complicated from his album In Between. I couldn't pinpoint it, but for some reason something about the song suddenly seemed very familiar... The best way I can describe it was like audio déja-vu. I knew that the familiarness wasn't just because I had heard the song a bunch of times before (I had, after all, bought the album).

    Today I was thinking about it again but I still couldn't find out what made it seem so familiar. So I forgot about it, and then suddenly David Guetta vs The Egg - Love Don't Let Me Go got stuck in my head. Almost immediately, I realized "hey, that's the song!"

    I think Paul Van Dyk has used a sample from it. Check it out:

    Paul van Dyk - Complicated (In Between, 2007) -- sample appears throughout

    David Guetta vs The Egg - Love Don't Let Me Go (Single, 2006) -- sample appears at 0:39

    (Disclaimer: I didn't upload the videos, nor do I own the copyright. Sorry if the embeds break.)

    I found it incredibly cool that just by thinking about a song, the brain can recognize a pattern and match it up with similar bits from other songs without you even consciously trying to do it.

  • 6 min read
  • As I mentioned in my last post, I've been playing with the Darwin Calendar Server (DCS) on Linux... Today I was able to re-test my setup notes to see if they worked properly, so below I've written a tutorial on how to get your own DCS server going on Fedora 13 or 14.

    Installing Dependencies

    Since we will be installing CalendarServer directly from the 2.4 branch subversion repository, the first thing to do is to install subversion and the dependencies for DCS:

    su -
    # Required to check out the source code from the repository
    yum install subversion
    # Dependencies
    yum install patch memcached krb5-devel python-zope-interface PyXML pyOpenSSL python-kerberos
    # Requirements for compiling xattr
    yum install python-setuptools gcc gcc-c++ python-devel

    Enable extended file attributes (xattrs)

    DCS requires user extended file attributes so the user_xattr mount option must be enabled for the partition on which CalendarServer will be storing its documents and data (in this case, /srv). If you have not already enabled this option (it is disabled by default), edit /etc/fstab and add the user_xattr mount option after defaults, for example:

    /dev/mapper/VolGroup-lv_root /                       ext4    defaults,user_xattr        1 1

    Grab DCS from SVN and run auto-setup

    Once these packages have been installed and extended file attributes have been enabled, we will begin setting up the CalendarServer as your regular, non-root user.

    # Directory to hold CalendarServer checkout and its dependencies
    mkdir CalendarServer
    cd CalendarServer
    # Checkout the code from the repo
    svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/tags/release/CalendarServer-2.4 CalendarServer-2.4
    cd CalendarServer-2.4
    # Start auto-setup
    ./run -s

    Auto-setup will now attempt to grab any missing dependencies for CalendarServer an will unpack and patch them accordingly. You may find that the download for PyDirector stalls - if so, hit to abort setup and download it manually:

    pushd ..
    wget http://downloads.sourceforge.net/pythondirector/pydirector-1.0.0.tar.gz
    tar xfz pydirector-1.0.0.tar.gz
    popd
    # Resume unpacking
    ./run -s

    Prepare for installation

    Since DCS bundles a modified version of Twisted as well as a few other projects (such as pydirector), we will now prepare an installation root folder to avoid conflicts with system libraries (i.e., Twisted if it has been installed from the Fedora repos). This code will be run as root.

    su -
    # setup data & document roots
    mkdir -p /srv/CalendarServer/{Data,Documents}
    chown -R daemon:daemon /srv/CalendarServer/
    # setup installation root
    mkdir -p /opt/CalendarServer/etc/caldavd
    mkdir -p /opt/CalendarServer/var/run/caldavd
    mkdir -p /opt/CalendarServer/var/log/caldavd

    Install DCS and configure the server instance

    The last step is to install DCS from the Subversion checkout we made earlier into the installation root. Replace /home/regularuser with the actual path to the home directory of your regular user.

    # install DCS to installation root
    cd /home/regularuser/CalendarServer/CalendarServer-2.4
    ./run -i /opt/CalendarServer
    rm -rf /opt/CalendarServer/usr/caldavd/caldavd.plist
    # copy sample configuration files
    cp conf/servertoserver-test.xml /opt/CalendarServer/etc/caldavd/servertoserver.xml
    cp conf/auth/accounts.xml /opt/CalendarServer/etc/caldavd/accounts.xml
    cp conf/caldavd-test.plist /opt/CalendarServer/etc/caldavd/caldavd.plist
    cp conf/sudoers.plist /opt/CalendarServer/etc/caldavd/sudoers.plist
    # change permissions; passwords are stored plaintext!
    chmod 600 /opt/CalendarServer/etc/caldavd/*

    I have reported bugs #390 and #391 about problems with the setup script on 64-bit machines as well as a problem if a custom destination installation directory is used (which we did). This bit of code works around both of the bugs:

    # 64-bit fix - see https://trac.calendarserver.org/ticket/391
    sitelib="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
    sitearch="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(1))')"
    if [ "$sitelib" != "$sitearch" ];then
      mv /opt/CalendarServer"${sitelib}"/twisted/plugins/caldav.py* /opt/CalendarServer"${sitearch}"/twisted/plugins
      # PYTHONPATH fix for 64-bit - see https://trac.calendarserver.org/ticket/390
      sed -i.orig 's|PYTHONPATH="'"${sitelib}"'|DESTDIR=/opt/CalendarServer\nPYTHONPATH="${DESTDIR}'"${sitelib}"':${DESTDIR}'"${sitearch}"':|' /opt/CalendarServer/usr/bin/caldavd
    else
      # PYTHONPATH fix for 32-bit - see https://trac.calendarserver.org/ticket/390
      sed -i.orig 's|PYTHONPATH="'"${sitelib}"'|DESTDIR=/opt/CalendarServer\nPYTHONPATH="${DESTDIR}'"${sitelib}"':|' /opt/CalendarServer/usr/bin/caldavd
    fi

    If you would like your server to use SSL (highly recommended), you will need to generate a certificate. If you have a certificate and key ready to install, place it in /opt/CalendarServer/etc/tls. If not, you can easily generate a free self-signed one:

    # Generate SSL keys
    mkdir /opt/CalendarServer/etc/tls
    openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout www.example.com.key -out www.example.com.crt

    Now, edit /opt/CalendarServer/etc/caldavd/caldavd.plist in your favorite editor and configure the server as follows:

       
       ServerHostName
       example.com

    # Data roots
       
       DataRoot
       /srv/CalendarServer/Data/
            
       
       DocumentRoot
       /srv/CalendarServer/Documents/

    # Test accounts configuration
       
       DirectoryService
       
         type
         twistedcaldav.directory.xmlfile.XMLDirectoryService
             
         params
         
           xmlFile
           /opt/CalendarServer/etc/caldavd/accounts.xml
         

       

    # Sudoers configuration
       
       SudoersFile
       /opt/CalendarServer/etc/caldavd/sudoers.plist

    # Delete this section

         Wiki
         
           Enabled
           
           Cookie
           sessionID
           URL
           http://127.0.0.1/RPC2
           UserMethod
           userForSession
           WikiMethod
           accessLevelForUserWikiCalendar
         

    # logging
       

       
       AccessLogFile
       /opt/CalendarServer/var/log/caldavd/access.log
       RotateAccessLog
       

       
       ErrorLogFile
       /opt/CalendarServer/var/log/caldavd/error.log

       
       DefaultLogLevel
       info
    # a bit further down…
       
       GlobalStatsSocket
       /opt/CalendarServer/var/run/caldavd/caldavd-stats.sock
    #
       
       ServerStatsFile
       /opt/CalendarServer/var/log/caldavd/stats.plist
           
       
       PIDFile
       /opt/CalendarServer/var/run/caldavd/caldavd.pid

    # SSL 
       
       SSLCertificate
       /opt/CalendarServer/etc/tls/www.example.com.crt
               
       
       SSLPrivateKey 
       /opt/CalendarServer/etc/tls/www.example.com.key

    # Privilege drop
       
       
       UserName
       daemon
       
       GroupName
       daemon
           
       ProcessType
       Combined

    # iSchedule server-to-server settings
         
         iSchedule
         
           Enabled
           
           AddressPatterns
           
           

           Servers
           /opt/CalendarServer/etc/caldavd/servertoserver.xml
         

    # Communication socket
       
       ControlSocket
       /opt/CalendarServer/var/run/caldavd/caldavd.sock

    # Twisted
       
            
       Twisted
       
         twistd
         /opt/CalendarServer/usr/bin/twistd
       

    # Load balancer
       

       PythonDirector
       
         pydir
         /opt/CalendarServer/usr/bin/pydir.py

         ConfigFile
         /opt/CalendarServer/etc/pydir.xml

         ControlSocket
         /opt/CalendarServer/var/run/caldavd/caldavd-pydir.sock
       

    ...Profit!

    Try starting the server!

    /opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /opt/CalendarServer/etc/caldavd/caldavd.plist -X

    If all goes well, press to kill the process and then daemonize it:

    /opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /opt/CalendarServer/etc/caldavd/caldavd.plist
  • 2 min read
  • Sorry for the lack of posts lately, I've been caught up with school and updating my FOSS on the side whenever I have some spare time.

    The server that runs this site as well as diffingo.com and a few others is almost always idle - the load averages rarely exceed 0.5, and are most often sitting somewhere around 0.2 (it's a 1U/Core 2 Quad Q9550@2.83GHz/8GB RAM/2x1TB RAID 1). I have bigger plans for it in the future, but at the moment there just isn't a great deal for it to do since it handles everything so quickly.

    I have been wanting to see how KVM VMs perform on it as well as try out the Darwin Calendar Server (DCS)... Seeing as DCS requires Python 2.5 and I didn't want to mess around with the live server's configuration (CentOS 5.x ships with Python 2.4), I installed Fedora 13 in a virtual machine so I could test the calendar server safely.

    To my surprise, KVM works really, really well... I wasn't expecting that seeing as the versions I had used in Fedora were so much more recent. The performance is good - I haven't performed any stress-testing yet (which obviously will show a gap between the VM and running natively) but the DCS is running very smoothly and feels very responsive, so I'm confident that the difference in performance is not so large.

    How I got the DCS running on Linux is a whole other story... I'll save that another post (F13/F14 DCS installation guides coming soon) but is it ever handy to have a CalDAV server! Previously, I was only able to sync calendars manually (with the USB cable) which made checking for homework assignments extremely annoying, as half of the information was always my iPod and the other half on iCal and I had to sync all the time. Now it's all over-the-air, so as long as there's Internet connectivity the calendar events can be pulled in or pushed out.