Skip to content

Instantly share code, notes, and snippets.

@octplane
Created August 14, 2013 14:21
Show Gist options
  • Save octplane/6231506 to your computer and use it in GitHub Desktop.
Save octplane/6231506 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'murder'
set :remote_murder_path, '/etc/bundler.chef/vendor/bundle/ruby/1.9.1/gems/murder-0.1.2/dist/' # or some other directory
s = []
pee = s[0..(ENV['COUNT'].to_i || -1)]
role :peer, *pee
role :seeder, master_fqdn
role :tracker, master_fqdn
namespace :murder do
desc <<-DESC
Will cause the seeder machine to connect to the tracker and start seeding. The ip address returned by the 'host' bash command will be ann
ounced to the tracker. The server will not stop seeding until the stop_seeding task is called. You must specify a valid 'tag' argument (whi
ch identifies the .torrent in /tmp to use)
DESC
task :start_seeding, :roles => :seeder do
require_tag
run "screen -dms 'seeder-#{tag}' python #{remote_murder_path}/murder_client.py seeder '#{filename}.torrent' '#{filename}' `LC_ALL=C hos
t $(hostname -f) | awk '/has address/ {print $4}' | head -n 1`"
end
end
cap -l /dev/null murder:stop_all_seeding 2> /dev/null
knife ssh -x root "hostname:*" "rm -rf /mnt/tmp/Deploy*; rm -rf /tmp/Deploy*" > /dev/null
path_is_file=1 do_not_download_torrent=1 cap -l /dev/null murder:create_torrent tag="Deploy5" files_path="/mnt/tmp/artifact-5db0cd2f471dfcf280
ec718f0f117fab3b1cb86a-staging.tar"
cap -l /dev/null murder:start_seeding tag="Deploy5"
time cap -l /dev/null murder:peer tag="Deploy5" destination_path="/mnt/tmp/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment