Running Parley with fastcgi

Today I hope to show you how to run Parley under fastcgi.

If all goes well I’ll have a publically visible message board by the end of the post.

I’m assuming you’ve already installed Parley.

For this entry you’ll need to have acess to a user with sudo superpowers.

Create a new site

First we’ll add a new site to the apache configuration:

sudo vim /etc/apache2/sites-available/parley.named_vhost

and add the following:

<VirtualHost *:80>
  ServerName              parley.pl

  DocumentRoot            /home/parley/perl5/lib/perl5/Parley/root
  Alias           /static /home/parley/perl5/lib/perl5/Parley/root/static
  Alias           /       /home/parley/perl5/bin/parley_fastcgi.pl/

  FastCgiServer           /home/parley/perl5/bin/parley_fastcgi.pl -processes 3

  # stuff that's good to have
  ServerAdmin         carer@parley.pl
  ErrorLog            /home/parley/parley/parley.pl/log/error.log
  CustomLog           /home/parley/parley/parley.pl/log/access.log common
</VirtualHost>

Save the file, and create a folder we’ll need:

sudo install -d -o parley -g parley /home/parley/parley/parley.pl/log/

Enable the site:

sudo a2ensite parley.named_vhost
sudo /etc/init.d/apache2 reload

Start the Email Engine

If you want activation emails to be processed you’ll need to start the email processing daemon:

# as 'parley' user
parley_email_engine.pl

A Quick Hack

For a reason I’ve yet to determine, I was seeing an error in the logs when I reloaded apache:

[Fri Aug 13 16:37:53 2010] [warn] FastCGI: server "/home/parley/perl5/bin/parley_fastcgi.pl" restarted (pid 4758)
Can't locate Parley.pm in @INC (@INC contains:
    /home/parley/perl5/bin/../lib /etc/perl ...)
    at /home/parley/perl5/bin/parley_fastcgi.pl line 15.

I hacked this by editing /home/parley/perl5/bin/parley_fastcgi.pl and adding the perl5 line:

use FindBin;
use lib "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../lib/perl5";
use Parley;

I’m sure I’ve done something stupid, but for now … it’ll do.

Allowing User Avatars

Until I find a better way of doing this (i.e. using gravatar like I did with cleavag.es) you’ll need to make a writable directory for user avatars:

sudo install -o www-data -g parley -m 0770 -d ~parley/parley/parley.pl/user_files
ln -s $HOME/parley/parley.pl/user_files /home/parley/perl5/lib/perl5/Parley/root/static/user_file

Not Perfect

I know there are still areas where Parley needs some work. It’s been left, neglected, in a box for a year.

It’s usable, and now - finally - has a public demo.

The Application

You should be able to explore Parley by visiting parley.pl in your browser.

Leave a comment

About Chisel

user-pic