Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
4 total  XML / RSS feed 

Solaris Capistrano deploy.rb

// capiwhatisit recipe for solaris
// most important thing is overriding some tasks to use GNU ln, since solaris' ln are subtly different

set :application, "awesomeapp"
set :repository, "http://example.com/repos/#{application}/trunk"

role :web, "foo.com"
role :app, "bar.com"
role :db,  "baz.com", :primary => true

set :deploy_to, "/path/to/app"
set :user, "appuser"
set :svn, "/opt/csw/bin/svn"
set :rake, "/opt/csw/bin/rake"
set :mongrel_config, "#{deploy_to}/shared/config/mongrel_cluster.yml"

set :use_sudo, false

desc "The spinner task is used by :cold_deploy to start the application up"
task :spinner, :roles => [:web, :app, :node] do
  run "/opt/csw/bin/mongrel_rails cluster::start -C #{mongrel_config}" # or SMF
end

desc "Restart the Mongrel processes on the app server."
task :restart, :roles => [:web, :app, :node] do
  run "/opt/csw/bin/mongrel_rails cluster::restart -C #{mongrel_config}" # or SMF
end

desc "Symlinks the database.yml into the current release"
task :after_update_code, :roles => [:web, :app, :node] do
    run "/opt/csw/bin/gln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end

# Run rake migrate after the symlinking has been done, just because I'm a lazy bum
task :after_symlink, :roles => :db do
  backup
  migrate
end

# =====================================================================================
# = Overriding these tasks because we need to use GNU ln and need the full path to it =

desc <<-DESC
Update the 'current' symlink to point to the latest version of
the application's code. Using GNU ln
DESC
task :symlink, :roles => [:app, :db, :web, :node] do
  on_rollback { run "/opt/csw/bin/gln -nfs #{previous_release} #{current_path}" }
  run "/opt/csw/bin/gln -nfs #{current_release} #{current_path}"
end

desc <<-DESC
Rollback the latest checked-out version to the previous one by fixing the
symlinks and deleting the current release from all servers.
DESC
task :rollback_code, :roles => [:app, :db, :web] do
  if releases.length < 2
    raise "could not rollback the code because there is no prior release"
  else
    run <<-CMD
      /opt/csw/bin/gln -nfs #{previous_release} #{current_path} &&
      rm -rf #{current_release}
    CMD
  end
end



zfs migration script

First rev, works but could use improvement

#!/bin/bash
if [ $# -ne 2 ]
then
    echo "Usage: $0 host_to_send_to zpool_name_on_destination"
    exit
fi
SERVER=$1
ZPOOL=$2
echo
echo "*********************************************************************************"
echo "*                                                                               *"
echo "* Please note, this wrapper only creates migration scripts for filesystems with *"
echo "* existing snapshots. If you want to migrate a snapshot-less filesystem, just   *"
echo "* run 'zfs snapshot zpool/filesystem@migrate' to create a snapshot which will   *"
echo "* allow this script to transfer it to the destination zpool.                    *"
echo "*                                                                               *"
echo "*********************************************************************************"
echo
if [ -f ./tmp/${SERVER}.screens ]
then
echo
echo "******************************************************************************"
echo "*"
echo "* Sorry, tmp/${SERVER}.screens exists, please run 'rm tmp/*' and try again..."
echo "*"
echo "******************************************************************************"
echo
exit
else
if [ ! -d tmp ]
then
mkdir tmp
fi
fi
for z in `zfs list | grep @ | awk '{print $1}' `;
do
FSNAME=`echo $z | awk -F@ '{print $1}' | awk -F/ '{print $NF}'`
if [ -f tmp/${FSNAME}.migrate ] 
then
echo "zfs backup -i $PREV $z | ssh root@$SERVER zfs restore $ZPOOL/${FSNAME}" >> tmp/${FSNAME}.migrate
PREV=$z
else
echo "Processing snapshots for ${FSNAME}."
echo "zfs backup $z | ssh root@$SERVER zfs restore $ZPOOL/${FSNAME}" > tmp/${FSNAME}.migrate
echo "screen -m -d bash tmp/${FSNAME}.migrate" >> tmp/${SERVER}.screens
PREV=$z
fi
done
echo
echo "**************************************************************************"
echo "*"
echo "* Ok, all finished - You can either run them individually, or simply type"
echo "*"
echo "* bash tmp/${SERVER}.screens"
echo "*"
echo "* at a prompt to run them concurrently in disconnected screen sessions."
echo "*"
echo "**************************************************************************"
echo

Netperf benchmarks of FreeBSD versus Solaris

{Disclaimer: these were with FreeBSD 5. FreeBSD 6 doesn't seem to have the same issues}

Netperf server running on yumi.textdrive.com (solaris nevada build) and comox.textdrive.com (freebsd 5.4).

Tested from emi.textdrive.com (solaris) and pacific.textdrive.com (freebsd)

Restricted to one 3.2 Ghz Intel Xeon CPU

Representative numbers below and maximum of a gigabit is 128MB/sec

Also done with file sizes of 6400 and 64000 with insignificant differences

---------
LOOPBACKS
---------

Loopback speeds comox -> comox via private IP (All FreeBSD)

# /usr/local/netperf/netperf -fM -H private.comox.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST to private.comox.textdrive.com
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

65536  32768   1472    10.00      59.79

Loopback speeds comox -> comox via localhost (All FreeBSD)

# /usr/local/netperf/netperf -fM -H 127.0.0.1 -tTCP_STREAM -- -m1472
TCP STREAM TEST to 127.0.0.1
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

65536  32768   1472    10.00     180.22


Loopback speed yumi -> yumi via private IP (All Solaris)

[yumi:/] root# /opt/csw/bin/netperf -fM -H private.yumi.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to private.yumi.textdrive.com (10.0.0.247) port 0 AF_INET

Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

49152  49152   1472    10.00     303.60

Loopback speed yumi -> yumi via 127.0.0.1 (All Solaris)

[yumi:/] root# /opt/csw/bin/netperf -fM -H 127.0.0.1 -tTCP_STREAM -- -m1472
TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to ::ffff:127.0.0.1 (127.0.0.1) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

49152  49152   1472    9.99      331.41

-------------
OVER A SWITCH
-------------

FreeBSD -> FreeBSD

pacific# /usr/local/netperf/netperf -fM -H private.comox.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST to private.comox.textdrive.com
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

65536  32768   1472    10.02       4.86

FreeBSD -> Solaris

pacific# /usr/local/netperf/netperf -fM -H private.yumi.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST to private.yumi.textdrive.com
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

49152  32768   1472    10.01       4.95

Solaris -> FreeBSD

[emi:/] root# /opt/csw/bin/netperf -fM -H private.comox.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to private.comox.textdrive.com (10.0.0.189) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

65536  49152   1472    10.07      44.13

Solaris -> Solaris

[emi:/] root# /opt/csw/bin/netperf -fM -H private.yumi.textdrive.com -tTCP_STREAM -- -m1472
TCP STREAM TEST from ::ffff:0.0.0.0 (0.0.0.0) port 0 AF_INET to private.yumi.textdrive.com (10.0.0.247) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    MBytes/sec

49152  49152   1472    10.00      75.59

The 'make it do it automatically upon pxe boot' incantation

./add_install_client -d -s 207.7.108.10:/export/home/jumpstart -c 207.7.108.10:/export/home/jumpstart/Solaris_11_snv_31/boot -p 207.7.108.10:/export/home/jumpstart -b "console=ttya" SUNW.i86pc i86pc
« Newer Snippets
Older Snippets »
4 total  XML / RSS feed