Package: profab
Automated tools for engaging with server infrastructure on AWS.To install use:pip install profabTo use the latest development version install:pip install git+git://github.com/Proteus-tech/profab.git@developConfiguring profabYou will need to give profab EC2 API keys for each client in order for
it to be able to manage EC2 infrastructure. I.e. for a client you wish
to refer to as ‘acme-widgets’ use:mkdir -p ~/.profab/acme-widgets
$EDITOR ~/.profab/acme-widgets/ec2.jsonIn the configuration file you will need a minimum of:{
    "host": "ec2",
    "keys": {
        "api":"paste API key here",
        "secret": "paste API secret here"
    }
}The first time you connect to an EC2 region to start a machine a new
private/public key pair will be created with the private key being
stored in the client folder.Command line scriptsFor all commandsclient-nameis the same as the configuration folder
used above, (acme-widgets)..Commands that take host names can also be given an EC2 reservation.
These look liker-adf3243234.Command line arguments are given as names after the script. For roles
they come in two types: either with or without a parameter. This is
either asroleor--roleparameter. Roles are processed in the
order specified.pf-server-startpf-server-start client-name _roles_Starts a new server. Roles that control the region, size or AMI are only
effective when an instance is started. Instances cannot be moved between
regions, cannot be re-sized and the AMI cannot be changed once launched.If multiple roles set an AMI, instance size or region then the last one
that does so controls which is actually used.pf-server-listpf-server-list client-namepf-server-restartpf-server-restart client-name reservationpf-server-role-addpf-server-role-add client-name hostname _roles_pf-server-stoppf-server-stop client-name hostnamepf-server-terminatepf-server-terminate client-name hostnamepf-server-updatepf-server-update client-name hostnameRolesami--ami ami-codeAllows the AMI that is to be launched to be controlled. The AMI must be
available in the region requested.--ami.ubuntu releaseWill choose the current AMI based on the named or numbered release. Only
those releases listed athttp://uec-images.ubuntu.com/releases/are
available, and only those that have actually been released (pre-release
versions won’t work – you’ll need to specify the full AMI yourself).ami.lucidThis is deprecated.Will choose an Ubuntu Lucid (10.04) AMI. This is the default AMI if no
other one is chosen.Instances are chosen fromhttp://uec-images.ubuntu.com/releases/10.04/release/ami.preciseThis is deprecated.Will choose an Ubuntu Precise (12.04) AMI. This is the default AMI if no
other one is chosen.Instances are chosen fromhttp://uec-images.ubuntu.com/releases/12.04/release/bitsbitsAutomatically determines the number of bits that are to be used for a
new server. This role is added automatically by profab, so there is no
need to add it explicitly.--bits 32|64Set the number of bits. profab will determine the correct number of bits
for all current instance sizes automatically. You will need to use--bits64to run smaller instance sizes using a 64 bit operating
system as profab will default to 32 bits.eip--eip ip-numberBinds the Elastic IP number to the instance. Adding this to a running
server along with other configuration may cause connection problems.muninmuninConfigures the machine as a Munin server. Installs Apache 2 as the web
server and the default web site is set to be Munin.--munin serverConfigures the machine to be monitored by Munin at the specified server.
Only basic monitoring is configured.postgrespostgresInstalls the Postgres packages on the machine. It also sets up Postgres
users (roles and default databases) for theubuntuandwww-datausers so they can both access the database using ident authentication.region--region region-nameAllows the region that the instance is to be run in to be chosen. The
default region is us-east-1 (Virginia).security_group--security_group group-nameAdds a new security group to the instance as it is launched. If no
security groups are set then the server will get the default security
group.This can be specified more than once in order to add more than one
security group. It has no effect when used on a server instance that has
already been started.size--size size-codeSets the instance size to be launched to the requested size. Current
valid sizes can be found athttp://aws.amazon.com/ec2/instance-types/Unlike the normal EC2 default, profab has a default size oft1.micro.smarthostsmarthostInstalls and configures exim to relay email for the machine. Emails are
sent to recipients directly from the machine. The machine will only
relay for mail sent from the local host.wsgiwsgiInstalls Apache and the WSGI module allowing it to host Python
applications. In installing Apache it disables the default website and
ensures that thewww-datauser has a proper home directory.Doing developmentThis project uses git flow. Don’t forget to do ``git flow init -d``(use defaults for all options).You should run the devenv/paths script in order to set up your command
line environment to be able to use profab straight from the check out.. devenv/pathsTo run the tests, create and activate a new virtual environment and then
use theruntestsscript.mkvirtualenv --no-site-packages profabdev
pip install -r devenv/setup.pip
./runtestsCustomising rolesA role is a Python module that contains a definition for eitherAddRoleorConfiguredepending on whether there is a parameter
or not. These should inherit fromprofab.role.Roleand may include
any of the following members:packagesThe packages that are to be installed as part of this role.region(self)Returns the region that should be used for starting an instance.ami(self, region)Returns the AMI for the region that is to be used.started(self, server)Can do configuration of the machine within EC2 after the reservation has
been made and the instance started, but before it is first connected to.configure(self, server)Can do any configuration that is required in order to get the role
working.