Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: committed/documented state.rb

...

You will need to install amazon-ec2 gem e.g. sudo gem install amazon-ec2 and knife should be working. Save the following script as Invoke maint/state.rb and then invoke it knife exec state.rb like so:

#!/usr/bin/env ruby # invoke with knife: #
No Format
Code Block
knife exec state.rb
#
# also make sure ruby gem for amazon ec2 is installed e.g.: sudo gem install amazon-ec2

require 'rubygems'
require 'AWS'

ACCESS_KEY_ID = ENV['AMAZON_ACCESS_KEY_ID']
SECRET_ACCESS_KEY = ENV['AMAZON_SECRET_ACCESS_KEY']

ec2 = AWS::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)

amis = {}

ec2.describe_images(:owner_id => "self").imagesSet.item.each do |image|
    name = image["name"]
    if !name.nil?
        m = name.match('CI\/EC2\/AMI\/(?:[^\/]+)\/(?:[^\/]+)\/TAG_hudson-cloud-(.+)(?:-)(.+)')
        if !m.nil?
            amis[image["imageId"]] = [(m[1].eql? "mifos-image") ? "mifos_2_1-bi_1_1-image" : m[1], m[2]]
        end
    end
end

mfis = {}

nodes.all { |n|
    if n.name =~ /^i-/
        mfi = n.override.tomcat.vhost
        env = (mfi.start_with? "testing-") ? "test" : "prod"
        mfi = mfi.match('(?:testing-){0}reporting-([^\/.]+).mifos.org')[1]
        mfis[mfi + " " + env] = [mfi, env, amis[n.ec2.ami_id][0], amis[n.ec2.ami_id][1]]
    end
}

printf("==============================================================\n")
printf("%-20s\t%-5s\t%-20s\t%s\n" % ["MFI", "ENV", "AMI", "BUILD"])
printf("==============================================================\n")
mfis.keys.sort.each { |mfi|
    printf("%-20s\t%-5s\t%-20s\t%s\n" % [mfis[mfi][0],mfis[mfi][1],mfis[mfi][2],mfis[mfi][3]])
}

Starting a new mifos/pentaho instance

...

  • Statefiles with lists of latest packages are created periodically (see above).
  • An administrator must keep track of security releases in upstream Ubuntu packages.
  • A groovy script is available to move a customer from one image to the next (it could be an upgrade or just a security update), this script should only be used if the mfi deployment for the environment already exists, volumes created, elastic ips associated etc. It can be invoked like so

...