Sha256: 7418aa700f98861223f09092b131394ebb101e759175d5c36c1f936f08ca1ae2

Contents?: true

Size: 1.74 KB

Versions: 81

Compression:

Stored size: 1.74 KB

Contents

# Tasks to be run on the server
namespace(:server) do                
  task :init  do
    PoolParty::Coordinator.init(false)
  end
  # bundle, upload and register your bundle on the server
  desc "Bundle, upload and register your ami"
  task :all => [:bundle, :upload, :register] do
    puts "== your ami is ready"
  end
  # Cleanup the /mnt directory
  desc "Clean the /mnt directory"
  task :clean_mnt do
    `rm -rf /mnt/image* img*`
  end
  # Before we can bundle, we have to make sure we have the cert and pk files
  desc "Ensure the required bundle files are present in /mnt"
  task :check_bundle_files do
    raise Exception.new("You must have a private key in your /mnt directory") unless File.exists?("/mnt/pk-*.pem")
    raise Exception.new("You must have your access key in your /mnt directory") unless File.exists?("/mnt/cert-*.pem")          
  end
  # Bundle the image
  desc "Bundle this image into the /mnt directory"
  task :bundle => [:clean_mnt, :check_bundle_files] do
    puts `ec2-bundle-vol -k /mnt/pk-*.pem -u '#{Planner.user_id}' -d /mnt -c /mnt/cert-*.pem -r i386`
  end
  # Upload the bundle into the app_name bucket
  desc "Upload the bundle to your bucket with a unique name: deletes old ami"
  task :upload => [:init, :delete_bucket] do
    puts `ec2-upload-bundle -b #{Planner.app_name} -m /mnt/image.manifest.xml -a #{Planner.access_key} -s #{Planner.secret_access_key}`
  end
  # Register the bucket with amazon and get back an ami
  desc "Register the bundle with amazon"
  task :register do
    puts `ec2-register -K /mnt/pk-*.pem -C /mnt/cert-*.pem #{Planner.app_name}/image.manifest.xml`
  end
  # Delete the bucket
  desc "Delete the bucket with the bundle under tha app name"
  task :delete_bucket do
    Planner.app_name.delete_bucket 
  end
end

Version data entries

81 entries across 81 versions & 4 rubygems

Version Path
auser-poolparty-0.0.8 lib/poolparty/tasks/server.rake
auser-poolparty-0.0.9 lib/poolparty/tasks/server.rake
auser-poolparty-0.1.0 lib/poolparty/tasks/server.rake
auser-poolparty-0.1.1 lib/poolparty/tasks/server.rake
auser-poolparty-0.1.2 lib/poolparty/tasks/server.rake
auser-poolparty-0.2.15 tasks/server.rake
auser-poolparty-0.2.16 tasks/server.rake
auser-poolparty-0.2.2 tasks/server.rake
auser-poolparty-0.2.20 tasks/server.rake
auser-poolparty-0.2.21 tasks/server.rake
auser-poolparty-0.2.22 tasks/server.rake
auser-poolparty-0.2.23 tasks/server.rake
auser-poolparty-0.2.24 tasks/server.rake
auser-poolparty-0.2.25 tasks/server.rake
auser-poolparty-0.2.26 tasks/server.rake
auser-poolparty-0.2.3 tasks/server.rake
auser-poolparty-0.2.35 tasks/server.rake
auser-poolparty-0.2.36 tasks/server.rake
auser-poolparty-0.2.37 tasks/server.rake
auser-poolparty-0.2.38 tasks/server.rake