pyami¶
boto.pyami¶
boto.pyami.bootstrap¶
-
class
boto.pyami.bootstrap.
Bootstrap
¶ The Bootstrap class is instantiated and run as part of the PyAMI instance initialization process. The methods in this class will be run from the rc.local script of the instance and will be run as the root user.
The main purpose of this class is to make sure the boto distribution on the instance is the one required.
-
create_working_dir
()¶
-
fetch_s3_file
(s3_file)¶
-
load_boto
()¶
-
load_packages
()¶
-
main
()¶
-
write_metadata
()¶
-
boto.pyami.config¶
-
class
boto.pyami.config.
Config
(path=None, fp=None, do_load=True)¶ -
dump
()¶
-
dump_safe
(fp=None)¶
-
dump_to_sdb
(domain_name, item_name)¶
-
get
(section, name, default=None)¶
-
get_instance
(name, default=None)¶
-
get_user
(name, default=None)¶
-
get_value
(section, name, default=None)¶
-
getbool
(section, name, default=False)¶
-
getfloat
(section, name, default=0.0)¶
-
getint
(section, name, default=0)¶
-
getint_user
(name, default=0)¶
-
load_credential_file
(path)¶ Load a credential file as is setup like the Java utilities
-
load_from_path
(path)¶
-
load_from_sdb
(domain_name, item_name)¶
-
save_option
(path, section, option, value)¶ Write the specified Section.Option to the config file specified by path. Replace any previous value. If the path doesn’t exist, create it. Also add the option the the in-memory config.
-
save_system_option
(section, option, value)¶
-
save_user_option
(section, option, value)¶
-
setbool
(section, name, value)¶
-
boto.pyami.copybot¶
boto.pyami.installers¶
-
class
boto.pyami.installers.
Installer
(config_file=None)¶ Abstract base class for installers
-
add_cron
(name, minute, hour, mday, month, wday, who, command, env=None)¶ Add an entry to the system crontab.
-
add_env
(key, value)¶ Add an environemnt variable
-
add_init_script
(file)¶ Add this file to the init.d directory
-
install
()¶ Do whatever is necessary to “install” the package.
-
start
(service_name)¶ Start a service.
-
stop
(service_name)¶ Stop a service.
-
boto.pyami.installers.ubuntu¶
boto.pyami.installers.ubuntu.apache¶
boto.pyami.installers.ubuntu.ebs¶
Automated installer to attach, format and mount an EBS volume. This installer assumes that you want the volume formatted as an XFS file system. To drive this installer, you need the following section in the boto config passed to the new instance. You also need to install dateutil by listing python-dateutil in the list of packages to be installed in the Pyami seciont of your boto config file.
If there is already a device mounted at the specified mount point, the installer assumes that it is the ephemeral drive and unmounts it, remounts it as /tmp and chmods it to 777.
Config file section:
[EBS]
volume_id = <the id of the EBS volume, should look like vol-xxxxxxxx>
logical_volume_name = <the name of the logical volume that contaings
a reference to the physical volume to be mounted. If this parameter
is supplied, it overrides the volume_id setting.>
device = <the linux device the EBS volume should be mounted on>
mount_point = <directory to mount device, defaults to /ebs>
boto.pyami.installers.ubuntu.installer¶
-
class
boto.pyami.installers.ubuntu.installer.
Installer
(config_file=None)¶ Base Installer class for Ubuntu-based AMI’s
-
add_cron
(name, command, minute='*', hour='*', mday='*', month='*', wday='*', who='root', env=None)¶ - Write a file to /etc/cron.d to schedule a command
- env is a dict containing environment variables you want to set in the file name will be used as the name of the file
-
add_env
(key, value)¶ Add an environemnt variable For Ubuntu, the best place is /etc/environment. Values placed here do not need to be exported.
-
add_init_script
(file, name)¶ Add this file to the init.d directory
-
create_user
(user)¶ Create a user on the local system
-
install
()¶ This is the only method you need to override
-
start
(service_name)¶
-
stop
(service_name)¶
-
boto.pyami.installers.ubuntu.mysql¶
This installer will install mysql-server on an Ubuntu machine. In addition to the normal installation done by apt-get, it will also configure the new MySQL server to store it’s data files in a different location. By default, this is /mnt but that can be configured in the [MySQL] section of the boto config file passed to the instance.
boto.pyami.installers.ubuntu.trac¶
-
class
boto.pyami.installers.ubuntu.trac.
Trac
(config_file=None)¶ Install Trac and DAV-SVN Sets up a Vhost pointing to [Trac]->home Using the config parameter [Trac]->hostname Sets up a trac environment for every directory found under [Trac]->data_dir
[Trac] name = My Foo Server hostname = trac.foo.com home = /mnt/sites/trac data_dir = /mnt/trac svn_dir = /mnt/subversion server_admin = root@foo.com sdb_auth_domain = users # Optional SSLCertificateFile = /mnt/ssl/foo.crt SSLCertificateKeyFile = /mnt/ssl/foo.key SSLCertificateChainFile = /mnt/ssl/FooCA.crt
-
install
()¶
-
main
()¶
-
setup_vhost
()¶
-