Plone 4.0.3 Universal Installer

by topia
28 deployments · 4 still active · last rev. 5 years ago

Prepares the environment for a Universal-Installer-based zeocluster install of Plone 4.0.3, running as user plone, under /home/plone.

May be used for development, and or prototype/production. Adds Facebook integration, varnish, and nginx, including basic config.

TODO: Create a /home/plone/www/maintenance/500.html file for outages. Start the instance with bin/startcluster.sh. Enjoy!

Questions: russf@topia.com

Compatible with: No distros currently supported
						#!/bin/bash

# Copyright 2010 Russ Ferriday, Topia Systems Ltd
# russf@topia.com

#This script puts its output in the LOGFILE below, and makes a temp fifo.
PIPEFILE=/tmp/teepipe.fifo
LOGFILE=/root/StackScript.log

mkfifo $PIPEFILE

# Start tee writing to a logfile, but pulling its input from our named pipe.
tee $LOGFILE < $PIPEFILE &

# capture tee's process ID for the wait command.
TEEPID=$!

# henceforth, redirect the rest of the stderr and stdout to our named pipe.
exec > $PIPEFILE 2>&1

#DO THE WORK -----------------------------

echo Doing the Prep work before Plone setup...

# use Linode provided primitive script
# to update to latest public ubuntu version
# Must get aptitude, since used by this script, and missing in 10.10
apt-get -y install aptitude
source <ssinclude StackScriptID="1">
system_update
postfix_install_loopback_only

#Then invoke our Ubuntu Base Install, now that we are up to date.
source <ssinclude StackScriptID="811">

apt-get -y install subversion

#dependencies for building varnish as part of buildout
apt-get -y install pkg-config libpcre3 libpcre3-dev

#dependency for building Universal Installer Plone with ssl support
apt-get -y install libssl-dev

#get root oriented setup files 
cd /root
git clone git://github.com/topiaruss/Plone4StackScript.git

#specify the firewall
iptables-restore <  Plone4StackScript/protoiptables.rules
#copy the rules into the webmin save file, and init on boot
iptables-save > /etc/iptables.up.rules 
echo '    post-up iptables-restore < /etc/iptables.up.rules' >> /etc/network/interfaces 

#use system NGINX due to library hassles when compiling from buildout
echo 'nginx setup'
apt-get -y install nginx
#Get the hostname interactively
#<udf name="host_dn_or_ip" label="Fully Qualified Domain Name or IP address of the server" example="www.example.com"/>
if [ ! -n "$HOST_DN_OR_IP" ]; then
  HOST_DN_OR_IP=$(get_rdns_primary_ip)
fi

sed -e "s/_FQDN_/${HOST_DN_OR_IP}/g" /root/Plone4StackScript/nginx.conf.in > /root/Plone4StackScript/nginx.conf
cp  /root/Plone4StackScript/nginx.conf /etc/nginx/nginx.conf
mkdir -p /usr/local/nginx/logs

#First create the plone user, and init ssh for him
adduser --gecos '' --disabled-password  plone
su -c 'ssh-keygen -q -t rsa -N "" -f /home/plone/.ssh/id_rsa ' plone

echo 'going over to home directory of "plone" user'
cd /home/plone

#get the more volatile parts of the install
git clone git://github.com/topiaruss/robust-linode-plone.git

chown -R plone:plone .

cd robust-linode-plone

echo 'run the install script as plone user'
su -c './doUI.sh' plone

echo 'add the custom layers'
su -c './addCustomBuildoutLayers.sh' plone

echo 'ensure everything runs after restart - as root'
./installRunlevelCommands.sh

#WORK IS COMPLETE ---------------------------

#Teardown logging pipe, etc.

# close the stderr and stdout file descriptors.
exec 1>&- 2>&-

# Wait for tee to finish since now the other end of the pipe has closed.
wait $TEEPID