Skip to content

Instantly share code, notes, and snippets.

@subbu
Created November 7, 2009 18:47
Show Gist options
  • Select an option

  • Save subbu/228836 to your computer and use it in GitHub Desktop.

Select an option

Save subbu/228836 to your computer and use it in GitHub Desktop.

Revisions

  1. subbu revised this gist Nov 8, 2009. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 1-setup-deploy-server.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #!/bin/bash

    #Assuming we are deploying to a intranet. Otherwise replace the below IP to actual address.
    [email protected].$1
    echo 'Deploying to $server'

  2. subbu revised this gist Nov 7, 2009. 2 changed files with 0 additions and 1 deletion.
    File renamed without changes.
    1 change: 0 additions & 1 deletion deploy.sh → 2-deploy.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    #!/bin/bash

    if [ $1 -eq 224 ] ; then
  3. subbu revised this gist Nov 7, 2009. 2 changed files with 2 additions and 1 deletion.
    1 change: 1 addition & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@

    #!/bin/bash

    if [ $1 -eq 224 ] ; then
    2 changes: 1 addition & 1 deletion setup-deploy-server.sh
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,4 @@ 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 ."
    '
    '
  4. subbu created this gist Nov 7, 2009.
    37 changes: 37 additions & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    #!/bin/bash

    if [ $1 -eq 224 ] ; then
    ssh [email protected] '
    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 [email protected] '
    echo "Deploying to 232 server..."
    echo "Follow the same steps as above and customize according to this servers needs....."
    '
    fi
    13 changes: 13 additions & 0 deletions setup-deploy-server.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/bin/bash

    [email protected].$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 ."
    '