Skip to content

Instantly share code, notes, and snippets.

@subbu
Created November 7, 2009 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subbu/228836 to your computer and use it in GitHub Desktop.
Save subbu/228836 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Assuming we are deploying to a intranet. Otherwise replace the below IP to actual address.
server=subbu@192.168.1.$1
echo 'Deploying to $server'
ssh $server '
deploy_to=/home/deploy/builds &&
cd $deploy &&
echo "Creating deployment folders in $PWD" &&
mkdir -p $deploy_to/releases &&
mkdir -p $deploy_to/shared/wp-config &&
echo "Successfully created deployment setup. Copy wordpress config files to $deploy_to/shared/wp-config and phpmyadmin to $deploy_to/shared ."
'
#!/bin/bash
if [ $1 -eq 224 ] ; then
ssh subbu@192.168.1.224 '
echo "Deploying to 224 server" &&
repos=/home/deploy/repos &&
builds=/home/deploy/builds &&
curdate=$(date +"%Y%m%d%H%M%S") &&
cd $builds/releases &&
echo "In $PWD" &&
mkdir -p $curdate &&
cd $curdate &&
echo "In $PWD" &&
echo "Fetching git repo..." &&
git clone $repos/portals &&
cd portals/public &&
echo "Copying config files..." &&
cp $builds/shared/wp-config/* . &&
echo "Linking shared files/folders" &&
ln -s $builds/shared/blogs.dir wp-content/blogs.dir &&
ln -s $builds/shared/uploads wp-content/uploads &&
echo "Getting laconica..." &&
git clone $repos/laconica &&
echo "Symlinking phpmyadmin..." &&
ln -s $builds/shared/phpmyadmin phpmyadmin &&
rm -f ../../../current &&
ln -s $PWD ../../../current &&
echo "Successfully deployed" ||
echo "Deployment failed. Reverting..." &&
rm -rf $builds/releases/$curdate
'
else
ssh root@192.168.1.232 '
echo "Deploying to 232 server..."
echo "Follow the same steps as above and customize according to this servers needs....."
'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment