Saturday, March 28, 2009

shindig on local ubuntu server

I installed shindig on a server running locally. It would have went as smoothly as my install on our virtual server (shindig on godaddy virtual dedicated server) but for a few small oops.

I want to have a way to play with OpenSocial and gadgets on a local machine. I have a small Ubuntu 8.04 server that is not visible to the world that I use for that sort of thing. I thought it would be easy to install and I was mostly correct.

Shindig is an open source implementation of the OpenSocial specification and gadgets specification. http://incubator.apache.org/shindig/ It comes in Java and PHP flavors. I went for the PHP version for now http://incubator.apache.org/shindig/#php.

My server is a pretty much out of the box Ubuntu Server Edition (8.04). I checked if PHP was PHP 5.2.x and added the extensions I was missing.

Check if the web server has a current PHP with phpinfo (PHP: phpinfo - Manual )
  http://test.jsoft.com/phpinfo.php
  returned that I had PHP 5.2.4 - good

I did not have the command line for PHP installed, so I installed that and checked the version again.
  $ sudo apt-get install php5-cli
  $ php -version
and no surprise it gave me the same answer. I then added curl and mcrypt.

  $ sudo apt-get install php5-curl
  $ sudo apt-get install php5-mcrypt
  $ sudo /etc/init.d/apache2 restart

I downloaded shindig, set up a new virtual host and was up and running (almost).

in /etc/apache2/sites-available
  $ sudo cp default shindig
to get a new virtual site and
  $ sudo vi shindig

Here are the important parts:

<virtualhost *>
ServerName shindig.jsoft.com
DocumentRoot /home/gary/public_html/shindig/php/
<directory>
Order Deny,Allow
Deny from All
</directory>
<directory>
Allow from All
AllowOverride All
</directory>
... other settings for vhosts
</virtualhost>

I installed into a public_html directory. You may want to install into the directory suggested in the shindig installation instructions.

I then enabled the site and reloaded apache

  $ sudo a2ensite shindig
  $ sudo /etc/init.d/apache2 reload

and found I did not have mod_rewrite enabled
  $ sudo a2enmod rewrite
  $ sudo /etc/init.d/apache2 force-reload

and then updated the file /home/gary/public_html/shindig/php/config/container.php

----- my copy -----
// The URL Prefix under which shindig lives ie if you have http://myhost.com/shindig/php set web_prefix to /shindig/php
'web_prefix' => '/shindig/php',
// If you changed the web prefix, add the prefix to these too
'default_js_prefix' => '/shindig/php/gadgets/js/',
'default_iframe_prefix' => '/shindig/php/gadgets/ifr?',
-----

tested and it was all good!

-----
It took me a while to decide to update container.php. I was lost till I read Chris Chabot's article PHP Shindig and mod_rewrite at chabotc.com. It has some great info on how things are set up and was what I needed to get shindig running.

I was looking at Google Friend Connect and the GFC demo The Chow Down when I decided to install shindig locally. We have tested a simple gadget or two with GFC on one of our sites and I look forward to getting more social.

Gary