The demo site challenge


Since I haven't written shell script since college (and you don't want to know how long ago that was) I'm looking for someone who can write a shell script that will 'reset' an installation of ProjectPier to it's virgin state.   I'll then use cron to schedule it to run every hour on the demo server.

You basically need to clean out a couple of directories, erase the database and reload it from a .sql file.  Any takers on this challenge? (not much of a challenge if you know what you are doing I suppose)...

Try this, obviously set the variables to match your environment and double check the paths, etc. Very insecure, as well as untested, but should do just fine. You'll want to be sure that your SQL dump includes the "DELETE FROM" lines to clear out the tables, or just drop the tables (or the entire DB) at the top of the dump:

#!/bin/sh
# ProjectPier Demo Reset

ROOTDIR=/var/www/html/demo/
RELOADSQL=/var/projectpier/demoreload.sql
DBUSER=projectpier
DBPASS=password
DBNAME=projectpier

rm -f $ROOTDIR/public/files/* $ROOTDIR/cache/* $ROOTDIR/upload/*
mysql -u $DBUSER -p$DBPASS $DBNAME < /var/projectpier/demoreload.sql

The first two lines got incorrectly combined and stripped of their leading hash ("pound") sign, but you should get the idea.

It would be better to let folks request a demo site to be installed (automatically) that they can use for, say, 48 hours.

Requesting the demo site would involve submitting an email address which we send a verification email back to. If they verify their email address, we kick off a script that performs a full demo PP install for them. After 48 hours, we kill/reap the install.

This way you avoid people vandalizing the demo site, even if it lasts for an hour.

If people think this is a good idea and would support it, I'll implement it.

Yes, I think that is a greatest idea... please Implement it... thanks!!

Hi Jon,

if you do not want to vreate an infrastructure where users can have their own installations for days it's much easier to setup the demo in a virtual machine, i.e. with the free VMware Server edition.

Advantages:
- No scripting / customization of the "nightly reset script" / ... needed
- very simple reset with one command (vmware-cmd /var/lib/vmware/demos/demoserver-1.vmx -H localhost -U youruser -P yourpass reset hard)
- reset is completely software- and system-independant
- you can setup a second VM and use it for improving the demo-content. When the content is improved you only have to copy the "improved VM" over the "old VM", change IP's and it's working
- If there are more visitors you can simply assign more RAM to the VM

I created demos this way for some companies in the past and their admins, webmasters and editors are all very satisfied with this kind of implementation.

Best regards,
Daniel