Deployment Script WIP

This is a work in progress…

#!/bin/sh
SOURCEPATH=’/var/git/working_copies/website/webroot/’
DESTPATH=’/var/www/website/webroot’
DESTUSER=’deploy’
LOGFILE=’/var/log/website_rsync.log’
SUBJECT=”website.com  Prod Updated:from MANAGE01SRV”
EMAIL=”me@me.com
EMAILCC=”me@me.com
echo “Job started at: `/bin/date`” > $LOGFILE
for SERVER in web01 web02 web03 web04
if $SERVER = “web01” then NSSRV = “wb01”
else NSSRV = “wb02”
do
ssh nsroot@netscaler ‘disable server site01_$NSSRV’
ssh $DESTUSER@$SERVER service apache2 stop >> $LOGFILE
rsync -avc –delete –exclude=”.git” –exclude=”var/” –exclude=”.gitignore” –rsh=ssh $SOURCEPATH $DESTUSER@$SERVER:$DESTPATH 2>&1 >> $LOGFILE
ssh $DESTUSER@$SERVER rm -rf $DESTPATH/var/cache/*
ssh $DESTUSER@$SERVER /var/scripts/fixperms.sh >> $LOGFILE
ssh $DESTUSER@$SERVER service apache2 start >> $LOGFILE
ssh nsroot@netscaler ‘enable server site01_$NSSRV’
done
echo “Job completed at: `/bin/date`” >> $LOGFILE
/usr/bin/mail -s “$SUBJECT” “$EMAIL” < $LOGFILE

Inserting client-ip into IIS Logs

Since the IIS instances are behind load balancers, the load balancer IP is inserted as the client-ip. To work around this, an IIS module is needed that replaces the client-ip value with the correct value. This is acomplished with two changes. First, the ACE must inject a speacial header value. In this case the header value is X-Client-IP. Second, the arr_helper module has to be installed and configured to replace the client-ip value with the correct value.

The module can be found here:

http://blogs.iis.net/anilr/archive/2009/03/03/client-ip-not-logged-on-content-server-when-using-arr.aspx

The module is installed in:

%PROGRAMFILES%\IIS\ARR Helper\​

The configuration is located in:

%windir%\system32\inetsrv\config\schema\arr_helper_schema.xml