Aviate Manual

Chapter 1. Quickstart to Aviate

1.1. What is Aviate?

Aviate is designed to make deploying your web applications very easy, while providing you with a rich feature set to make repeated task performed in a snap, and being extensible so you can extend its features with your own Python code.

Simply put, Aviate was developed with the goal to allow as broad web developers as can be to automate the deployment process of their web applications.

1.2. Installing Aviate

The following sections describe how to install and run Aviate.

1.2.1. Installing Aviate on GNU/Linux

To run the Alpha version of Aviate, extract the downloaded file and use setup.py. Later examples in this chapter show off usage.

prompt> tar -xzvf aviate-1.0.tar.gz
prompt> cd aviate-1.0
prompt> sudo python setup.py install

This installs the application in your distribution's Python packages directory, and creates a launch script aviate in /usr/bin.

The following are the Python modules Aviate requires: paramiko, 1.7.3 or higher; pysvn, 1.6.0; pexpect, 2.3 or higher; pycrypto, 2.0.1 or higher.

You may install the binary of the dependencies on Debian/Linux by:

prompt> apt-get install python-crypto python-svn python-mysqldb mysql-client-5.0 rsync

You may install the binary of the dependencies on Fedora/Redhat Linux by:

prompt> yum install python-crypto pysvn MySQL-python mysql rsync

Note: Aviate has only been tested on Python 2.5.

1.2.2. Installing Aviate on Windows

Aviate on Windows does not require any installation. Simply extract the ZIP file and move the directory to the location you want.

1.3. Quick Example: Hello World!

Aviate comes with several examples in the examples directory, the simplest of which is helloworld.dep, which only prints the text "Hello World!" to the screen.

To run it on Windows:

prompt> aviate.exe examples/helloworld.dep -t hello

To run it on GNU/Linux:

prompt> aviate.py examples/helloworld.dep -t hello

1.4. Quick Example: Installing Wordpress via FTP/SSH

One of the examples is wordpress.dep, a Deployment File (DepFile) for Wordpress.

Using this Deployment File, you can install a fresh Wordpress blog on your server, through either FTP or SSH. All you'd need to do is to run the DepFile as below, and answer the questions based on your server's details:

Note: You must have created the database to install to. This example will not create the database.

prompt> aviate examples/wordpress-install.dep -t install

Deploy to FTP or SSH? (ftp/ssh): ftp
Server hostname? ftp.example.com
Server username? myftpuser
Server password? mypassword
Database username? mysqluser
Database password? mysqlpassword
Database name? blog
Directory to install to on the server? /public_html/blog
HTTP address of that directory? http://www.example.com/blog
Blog title? My Blog
Admin e-mail? admin@example.com
Make blog public (1/0)? 1

Once you have answered all the questions, the deployment process will start, and a status of the performed actions will be printed. The process may take some time, specifically the step of copying the files to your server.

That's all, you should now go to your server and you'd find the blog installed.

1.5. Quick Example: Installing Wordpress via Chaining

With Chaining, more power and higher performance can be achived. Chaining requires you have Aviate installed on the destination server, and it can only be used via SSH. When executing a Chained Task, Aviate uploads the DepFile on the target server and executes the task on the server. This can give you many advantages like performance; possibly, downloading a file on the target server and extracting it there would be much faster than downloading it on your computer, and then uploading each of its files after extraction.

Using the DepFile wordpress-install-chained.dep, you can install a fresh Wordpress blog on your server, through SSH. All you'd need to do is to run the DepFile as below, and answer the questions based on your server's details:

prompt> aviate examples/wordpress-install-chained.dep -t install

Server Hostname or IP? example.com
Server Username? mysshuser
Server Password? mypassword
Database Username? mysqluser
Database Password? mysqlpassword
Database Name? blog
Directory to install to on the server? /var/www
HTTP address of that directory? http://www.example.com/
Blog title? My Blog
Admin e-mail? admin@example.com
Make blog public (1/0)? 1

Once you have answered all the questions, the deployment process will start, and a status of the performed actions will be printed.

That's all, you should now go to your server and you'd find the blog installed.

1.6. Quick Example: Upgrading Wordpress via Chaining

Using the DepFile wordpress-upgrade.dep, you can ugraade an existing Wordpress blog on your server, through SSH, via Chaining. All you'd need to do is to run the DepFile as below, and answer the questions based on your server's details:

prompt> aviate examples/wordpress-upgrade.dep -t upgrade

Server Hostname or IP? example.com
Server Username? mysshuser
Server Password? mypassword
Database Username? mysqluser
Database Password? mysqlpassword
Database Name? blog
Directory the blog is installed at? /var/www
HTTP address of the blog? http://www.example.com/
Where to store a pre-upgrade backup locally? /tmp

Once you have answered all the questions, the deployment process will start, and a status of the performed actions will be printed.

Chapter 2. Tutorial

This tutorial servers as a quick introduction to Aviate. It mainly covers the structure of a DepFile, which is the XML-formatted deployment file understood by Avite.

2.1. DepFile Structure

A DepFile is the XML-based file format used by Aviate. It defines the tags needed to allow you to describe your deployment project. The root tag of the DepFile is project, and its children, referred to as the top level elements, are defaults, variables, constants, servers and targets.

All these root level elements can be declared only once, and while servers and targets must be declared, the others are optional.

The layout of the DepFile looks as follows if all the root level elements were declared:

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="example">
	<defaults>
		<!-- ... -->
	</defaults>
	<variables>
		<!-- ... -->
	</variables>
	<constants>
		<!-- ... -->
	</constants>
	<servers>
		<!-- ... -->
	</servers>
	<targets>
		<!-- ... -->
	</targets>
</project>

The following sections will go through all of these top level elements.

2.2. Defaults, Variables and Constants

2.2.1. Defaults

Defaults are a mean to assign a global default value for parameters that are used commonly, one of these is the retry default. For most commands, you can specify the number of times the execution of the command is retried till it succeeds, the default of which if not specifically specified is only 1 time. The following are two commands in which one specifies a retry count while the other not.

<fs:mkdir destination="local" path="aviate-tests/1" retry="2" />
<fs:mkdir destination="local" path="aviate-tests/2" />

In the above example, the first command will retry execution twice, while the second will retry execution once since this is the local default of all commands. To make the second command retry execution 4 times, then at the top level of the DepFile, you should override the default value as follows:

<default name="retry" count="4" />

The following are the available defaults you can override:

Table 2.1. List of Defaults

NameDescriptionDefault Value
haltWheher to halt execution on failure of one command or notFalse
retryThe number of times to retry execution on error1

2.2.2. Variables

Variables are named values that can change from one execution to another based on different user input. There are two types of variables: Arguments, whose values are retrieved from the command line, and Properties, whose values are retrieved from a Property File.

For both types, allowed characeters in variable names are letters, numbers, dots, underscores and dashes. Variables are evaluated by prefixing the variable name with ${ and postfixing it with }. Thus, to evaluate a variable named myvar:

<fs:copy source="local" destination="ftp_server" from="${myvar}" to="/var/www" />

2.2.2.1. Arguments

An argument is a variable whose value is retrieved from the command line. An argument can be marked as "required", in which case it must be specified. If it is not required, a default value can be specified, and if not, and the argument was not specified in the command line, it will be assigned a value of an empty string.

Arguments are defined inside a variables tag at the top level of the DepFile.

<variables>
	<argument name="arg1" required="true" />
	<argument name="arg2" default="val2" />
	<argument name="arg3" question="What is the value of 'arg3'?" />
</variables>

If the DepFile "example.dep" where to declare the above arguments, then the DepFile can be executed as follows:

prompt> aviate.exe example.dep arg1=val1 arg2=someval2

You can use the question parameter to specify a question to be asked to the user if the value of the parameter was not specified in the command line interface. The "question" parameter is optional, and an input question will be asked only if the parameter was not sent as a command line argument.

2.2.2.2. Property Files

Properties are variables that are declared in a Property File. A Property File is an INI-like file divided into sections, and its variables are referred to in the format section_name.variable_name. An example Property File:

[ftp]
username = me
password = mine

[mysql]
host = 127.0.0.1

Arguments are defined inside the same variables tag as Arguments. The precedence of Arguments overrides that of properties, so an argument named ftp.username would override a property variable named username in section ftp. Furthermore, Property Files declared at the end have precedence over property files defined earlier that have variables with the same fully qualified name.

<variables>
	<properties file="prop1.cfg" />
	<properties file="prop2.cfg" />
</variables>

2.2.3. Constants

Constants are a way to define named values inside the DepFile, and to refer to them in other parts of the DepFile. Contrary to Arguments and Variables, the value of a constant is specifically specified in the DepFile, and there are a number of pre-defined constants. An example of defining a constant follows.

<constant name="CONFIG_FILE_NAME" value="main.cfg" />

Allowed characeters in constant names are letters, numbers, dots, underscores and dashes. Constants are evaluated by prefixing the constant name with #{ and postfixing it with }. To evaluate the constant defined above:

<fs:copy source="local" destination="ftp_server" from="#{CONFIG_FILE_NAME}" to="/var/www" />

For a list of the pre-defined constants, see the Pre-Defined Constants appendix.

2.3. Servers

All of Aviate's commands are server-aware, and all run on zero or more servers. A command that executes on zero servers is said to be a virtual command, an example of which is the echo command which merely prints on the screen. A command that executes on one server is said to have a destination of that server; an example of which is fs:delete, a command which allows you to delete a file or directory from a filesystem on a destination server. A command that executes on two servers is said to have a source and a destination; an example of which is fs:copy, with which you can copy a file or directory from a source to a destination server's filesystem.

A server is a representation of a machine, which has an operating system of some platform running on it. For example, a machine running Windows 98 would be identified by Aviate as a Server running the 9x operating system on the windows platform. Additionally, a server can either be local or remote. There can only be one local server which represents the current machine running Aviate.

Aviate comes with a number of pre-defined Servers, and support for Servers is planned to grow with time. Besides the local server which represents the local filesystem of the machine running Aviate, there are other filesystem servers, namely FTP, SFTP and SSH servers. Other Servers include SVN, a version control Server, MySQL, a SQL Server, and an Rsync Server.

The following are examples of how you can define servers:

<servers>
	<server:local id="local" root="/tmp/" />
	<server:mysql id="db_server" host="127.0.0.1" username="root" password="pass" />
	<server:subversion id="svn_server" repository_path="http://127.0.0.1/trunk" />
	<server:ssh os="linux" id="ssh_server" host="127.0.0.1" username="root" password="pass" />
</servers>

And next are three commands that use zero servers, one server, and two servers, respectively:

<echo text="creating a database and copying a file" />
<db:create destination="db_server" name="test_database" />
<fs:copy source="local" destination="ssh_server" from="main.cfg" to="/var/www/" />

2.3.1. The Root of the Server

FileSystem servers, like a Local Server, an FTP Server or an SSH Server, have a parameter called "root". With this parameter you can specify the root directory to assume for all relative paths specified for that directory. For example, if you were to define the root of an FTP server as /public_html, then to copy the file config.php into the directory /public_html/config, you can either copy that file to the absolute path /public_html/config or the relative path config. If you do not specify the root for every server, then for POSIX Servers the root is assumed to be /, and for Windows Servers it is assumed to be C:\.

2.4. Targets, Tasks and Commands

After a DepFile is parsed, the commands of a task of a target are executed in sequential order. You can set tasks to depend on other tasks, or set Targets to depend on other Targets -- this affects the execution order of the Tasks and Targets. Aviate takes care of resolving the dependency and the order of execution.

2.4.1. Targets

A target is the main action you want to perform, like installing a new application or updating an existing one. When you execute a DepFile, you must specify the name of the target to execute. A target can depend on other targets, in which case before execution begins, Aviate takes care of resolving the dependency between Targets to decide on the order of their execution. A DepFile must define at least one Target.

Each Target has a unique name that identifies. In a Target's name, allowed characeters are letters, numbers, dots, underscores and dashes.

The next example illustrates three Targets, one of which depends on another.

<targets>
	<target name="target_1" >
		<!-- ... -->
	</target>
	<target name="target_2" depends="target_1" >
		<!-- ... -->
	</target>
	<target name="target_3" >
		<!-- ... -->
	</target>
</targets>

If you are using dependency between Targets, be sure there are no cycles in your dependency graphs. If there are, Aviate will refuse to execute the Target.

2.4.1.1. The Pre-defined "help" Target

While a target can be named arbitarily so long as the name follows the naming rule stated above, there is one target name that is treated different: "help". If you want to add a help or usage message to your deployment files, use the target name "help". Execution of a "help" target differs from other targets as follows:

  • No question prompts will be made for Arguments.

  • No "Processing target" messages will be printed.

  • No "Processing task" messages will be printed.

2.4.2. Tasks

A Task is a grouping of Commands that share a common goal, or describe a single phase of execution. Executing a Target leads to the execution of all of its tasks; in sequential order with regards to Task dependency. Aviate takes care of resolving the dependency between Tasks to decide on the order of their execution. A target must contain at least one Task.

Each Task has a unique name that identifies. In a Task's name, allowed characeters are letters, numbers, dots, underscores and dashes.

The next example illustrates three Tasks, one of which depends on another.

<targets>
	<target name="target_1" >
		<task name="task_1" >
			<!-- ... -->
		</task>
		<task name="task_2" depends="task_1" >
			<!-- ... -->
		</task>
		<task name="task_3" >
			<!-- ... -->
		</task>
	</target>
</targets>

If you are using dependency between Tasks, be sure there are no cycles in your dependency graphs. If there are, Aviate will refuse to execute the Task.

2.4.3. Commands

A Command is the unit of execution. A Command is what copies a file, creates a database, exports a copy from a Subversion repository, or syncs a local directory to a remote one over SSH.

All of Aviate's commands are server-aware, and all run on zero or more servers. A command that executes on zero servers is said to be a Virtual Command, an example of which is the echo command which merely prints on the screen. A command that executes on one server is said to have a destination of that server; an example of which is fs:delete, a command which allows you to delete a file or directory from a filesystem on a destination server. A command that executes on two servers is said to have a source and a destination; an example of which is fs:copy, with which you can copy a file or directory from a source to a destination server's filesystem.

Except Virtual Commands, all Commands are referenced by using a namespace-qualified name. For example, the Copy Command belongs to the FileSystem namespace, and is associated with the tag fs:copy. Similarily, db:create to create a database, web:download to download a file from the web, vc:checkout to checkout from a version control system, and so on.

2.5. FileSets, Lists and Dictionaries

FileSets, Lists and Dictionaries are container types that can be used to represent a group of data needed by some command.

2.5.1. FileSets

>A FileSet is a definition of a number of rules that declare match patterns against files or directories. These patterns can be used by some Commands to filter their operation. For example, a Copy Command may exclude a number of files or directories who are matched by the definition in a FileSet. An example declaration of a FileSet in a DepFile is:

<fileset name="set1">
	<match parent="/var/www/uploads" />
	<match parent="/var/www/" name="(.*)\.pyc" />
	<match parent="/var/www/" name="log" type="directory" />
</fileset>

A match entry is a condition that is applied to each file or directory. Each entry can consist of up to three conditions; parent, name or type. If more than one condition is specified, they are ANDed together. The "parent" condition is a regular expression that is applied against the parent directory of the current item, whether it is a file or directory. The "name" condition is a regular expression that is applied against the name of the current item, whether it is a file or directory. The "type" condition restricts applying the match to either a "file or "directory".

2.5.2. Lists

A List is a named collection of ordered values. It can be used with commands that can take list of data, like the db:sql Command. A List must be locally defined within a Command, and must have a unique name within the scope of its enacpsulating Command.

<db:sql destination="sql_server" statements="mystat_1" database="test_db" >
	<list name="mystat_1">
		<entry value="create table test (id INT, data VARCHAR(100));" />
		<entry value="insert into test values ('1', 'one');" />
		<entry value="insert into test values ('2', 'two');" />
	</list>
</db:sql>

2.5.3. Dictionaries

A Dictionary is a named collection of ordered pairs of keys and values. It can be used with commands that can take dictionaries of data, like the fs:rsync Command. A Dictionary must be locally defined within a Command, and must have a unique name within the scope of its enacpsulating Command.

Each entry of the Dictionary must have a name (the key), but does not need to have a value. If a value is not specified, an empty string will be assumed.

<fs:rsync source="local" destination="ftp_server" from="/var/www" to="/var/www" options="opt">
	<dictionary name="opt">
		<entry name="--max-size" value="10000" />
		<entry name="-r" />
	</dictionary>
</fs:rsync>

2.6. One Nice Example

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="example">
	<defaults>
		<default name="retry" value="3" />
	</defaults>
	<variables>
		<argument name="arg1" required="true" />
		<properties file="prop1.cfg" />
		<properties file="prop2.cfg" />
	</variables>
	<constants>
		<constant name="MY_NAME" value="someone" />
	</constants>
	<servers>
		<server:local id="local" root="/tmp/" />
		<server:mysql id="db_server" host="a.com" username="root" password="abc" />
		<server:subversion id="svn_server" repository_path="http://b.com/trunk" />
		<server:ssh os="linux" id="srv" host="a.com" username="root" password="abc" />
	</servers>
	<targets>
		<target name="install">
			<task name="install">
				<fs:copy
					source="local"
					destination="srv"
					from="${arg1}"
					to="/var/www"
				/>
			</task>
		</target>
		<target name="help">
			<task name="help">
				<echo text="Hello World!">
			</task>
		</target>
	</targets>
</project>

Chapter 3. DepFile Reference

3.1. DepFile Tags

3.1.1. project

Required Parameters

  • name (type: String):

    The name of the project.

Optional Parameters

  • schema (type: String):

    Schema version.

Description. Each DepFile has as its root a project tag. Only one such tag must exist in a DepFile,and it must have defined for it a project name, and optionally a schema version. An example DepFile looks like:

<?xml version="1.0" encoding="iso-8859-1"?>
<project>
	...
</project>

3.1.2. defaults

Description. Defaults are a mean to assign a global default value for parameters that are used commonly, one of these is the retry default. For most commands, you can specify the number of times the execution of the command is retried till it succeeds, the default of which if not specifically specified is only 1 time. The following are two commands in which one specifies a retry count while the other not.

<fs:mkdir destination="local" path="aviate-tests/1" retry="2" />
<fs:mkdir destination="local" path="aviate-tests/2" />

In the above example, the first command will retry execution twice, while the second will retry execution once since this is the local default of all commands. To make the second command retry execution 4 times, then at the top level of the DepFile, you should override the default value as follows:

<defaults>
	<default name="retry" count="4" />
</defaults>

3.1.3. default

Required Parameters

  • name (type: Variable Name):

    The name of the default. Must be on the pre-defined defaults.

  • value:

    The value of the default. Must be specified. Its type is dependant on the type of the specific default.

Description. The following are the available defaults you can override:

Table 3.1. List of Defaults

NameDescriptionDefault Value
haltWheher to halt execution on failure of one command or notFalse
retryThe number of times to retry execution on error1


An example follows:

<defaults>
	<default name="retry" count="4" />
	<default name="halt" count="false" />
</defaults>

3.1.4. variables

Required Parameters

  • project:

    An instance of a Project, sent as None the first time get_object is called when supposedly it is asked to create an instance of Project.

  • parameters:

    A dictionary of parameters that are sent to the constructor.

Description. Variables are all name/value pairs that can be referenced in a DepFile; Aviate automatically subistitutes occurences of ${name} in a DepFile by the variable's ${value}. A variable can be either a command line argument, whose name is defined with an argument tag and whose value is retrieved from the command line interface, or it can be retrieved from a property file (an INI-like file).

<variables>
	<argument name="username" required="true" default="root" question="What's the server's username?" />
	<argument name="password" question="What's the server's password?" />
	<property file="properties.ini" />
</variables>

Arguments have higher precedence than Properties, and variable precedence is bound by the order of its definition. For example, if a property file defined a variable X.Y to 1, and then a property file defined X.Y as 2, then it will be stored as 2. Whatever the order is, Arguments have the higher precedence. The constants tag holds a list of constant tags.

3.1.5. argument

Required Parameters

Optional Parameters

  • default (type: String):

    The default value of the argument if it was not specified.

  • required (type: Boolean):

    If True, then this Argument must be specified by the user.

  • question (type: Non-Empty String.):

    A question to ask the user if a value for the argument was not specified.

Description. An argument is a variable whose value is retrieved from the command line. An argument can be marked as "required", in which case it must be specified. If it is not required, a default value can be specified, and if not, and the argument was not specified in the command line, it will be assigned a value of an empty string. Arguments are defined inside a variables tag at the top level of the DepFile.

<variables>
	<argument name="arg1" required="true" />
	<argument name="arg2" default="val2" />
	<argument name="arg3" question="What is the value of 'arg3'?" />
</variables>

If the DepFile "example.dep" where to declare the above arguments, then the DepFile can be executed as follows:

prompt> <emphasis>aviate.exe example.dep arg1=val1 arg2=someval2</emphasis>

You can use the question parameter to specify a question to be asked to the user if the value of the parameter was not specified in the command line interface. The "question" parameter is optional, and an input question will be asked only if the parameter was not sent as a command line argument.

3.1.6. properties

Required Parameters

Description. Properties are variables that are declared in a Property File. A Property File is an INI-like file divided into sections, and its variables are referred to in the format section_name.variable_name. An example Property File:

[ftp]
username = me
password = mine

[mysql]
host = 127.0.0.1

Arguments are defined inside the same variables tag as Arguments. The precedence of Arguments overrides that of properties, so an argument named ftp.username would override a property variable named username in section ftp. Furthermore, Property Files declared at the end have precedence over property files defined earlier that have variables with the same fully qualified name.

<variables>
	<properties file="prop1.cfg" />
	<properties file="prop2.cfg" />
</variables>

3.1.7. constants

Description. Constants are a way to define named values inside the DepFile, and to refer to them in other parts of the DepFile. Contrary to Arguments and Variables, the value of a constant is specifically specified in the DepFile, and there are a number of pre-defined constants. The constants tag holds a list of constant tags.

<constants>
	<constant name="CONFIG_FILE_NAME" value="main.cfg" />
	<constant name="INSTALL_DESTINATION" value="/var/www" />
</constants>

3.1.8. constant

Required Parameters

  • name (type: Variable Name):

    The name of the constant.

  • value (type: String):

    The value of the constant.

Description. Allowed characeters in constant names are letters, numbers, dots, underscores and dashes. Constants are evaluated by prefixing the constant name with #{ and postfixing it with }. An example constant:

<constants>
	<constant name="CONFIG_FILE_NAME" value="main.cfg" />
</constants>

To evaluate the constant defined above:

<fs:copy source="local" destination="ftp_server" from="#{CONFIG_FILE_NAME}" to="/var/www" />

For a list of the pre-defined constants, see the Pre-Defined Constants appendix.

3.1.9. servers

Required Parameters

  • project:

    An instance of a Project, sent as None the first time get_object is called when supposedly it is asked to create an instance of Project.

  • parameters:

    A dictionary of parameters that are sent to the constructor.

Description. All of Aviate's commands are server-aware, and all run on zero or more servers. A command that executes on zero servers is said to be a virtual command, an example of which is the echo command which merely prints on the screen. A command that executes on one server is said to have a destination of that server; an example of which is fs:delete, a command which allows you to delete a file or directory from a filesystem on a destination server. A command that executes on two servers is said to have a source and a destination; an example of which is fs:copy, with which you can copy a file or directory from a source to a destination server's filesystem. The following are examples of how you can define servers:

<servers>
	<server:local id="local" root="/tmp/" />
	<server:mysql id="db_server" host="127.0.0.1" username="root" password="rootpass" />
	<server:subversion id="svn_server" repository_path="http://127.0.0.1/trunk" />
	<server:ssh os="linux" id="ssh_server" host="127.0.0.1" username="root" password="rootpass" />
</servers>

A server is a representation of a machine, which has an operating system of some platform running on it. For example, a machine running Windows 98 would be identified by Aviate as a Server running the 9x operating system on the windows platform. Additionally, a server can either be local or remote. There can only be one local server which represents the current machine running Aviate. Aviate comes with a number of pre-defined Servers, and support for Servers is planned to grow with time. Besides the local server which represents the local filesystem of the machine running Aviate, there are other filesystem servers, namely FTP, SFTP and SSH servers. Other Servers include SVN, a version control Server, MySQL, a SQL Server, and an Rsync Server. And next are three commands that use zero servers, one server, and two servers, respectively:

<echo text="creating a database and copying a file" />
<db:create destination="db_server" name="test_database" />
<fs:copy source="local" destination="ssh_server" from="main.cfg" to="/var/www/" />

3.1.10. fileset

Required Parameters

Description. A FileSet is a definition of a number of rules that declare match names against files or directories. These matches can be used by some functions to filter their operation. For example, a fs:copy command may exclude a number of files or directories who are matched by the definition in a FileSet. An example declaration of a FileSet in a DepFile is:

<fileset name="set1">
	<match parent="/var/www/uploads" />
	<match parent="/var/www/" name="(.*)\.pyc" />
	<match parent="/var/www/" name="log" type="directory" />
</fileset>

A FileSet is declared as a child to a Command. Not all commands support FileSet children. An example use of a FileSet:

<compress source="local" destination="local" from="/var/www" to="/tmp/test.tar.gz" excludes="set1">
	<fileset name="set1">
		<match name="(.*)\.pyc" />
	</fileset>
</compress>

3.1.11. match

Optional Parameters

  • parent (type: String):

    A regular expression to apply against the current item's parent directory.

  • name (type: String):

    A regular expression to apply against the current item's name.

  • type (type: String):

    Restrict the match to either "file" or "directory".

Description. A match entry is a condition that is applied to each file or directory. Each entry can consist of up to three conditions; parent, name or type. If more than one condition is specified, they are ANDed together. The "parent" condition is a regular expression that is applied against the parent directory of the current item, whether it is a file or directory. The "name" condition is a regular expression that is applied against the name of the current item, whether it is a file or directory. The "type" condition restricts applying the match to either a "file or "directory".

<fileset name="set1">
	<match parent="/var/www/uploads" />
	<match parent="/var/www/" name="(.*)\.pyc" />
	<match parent="/var/www/" name="log" type="directory" />
</fileset>

3.1.12. targets

Required Parameters

  • project:

    An instance of a Project, sent as None the first time get_object is called when supposedly it is asked to create an instance of Project.

  • parameters:

    A dictionary of parameters that are sent to the constructor.

Description. A target is the main action you want to perform, like installing a new application or updating an existing one. When you execute a DepFile, you must specify the name of the target to execute. A target can depend on other targets, in which case before execution begins, Aviate takes care of resolving the dependency between Targets to decide on the order of their execution. A DepFile must define at least one Target.

<targets>
	<target name="target_1" >
		<!-- ... -->
	</target>
	<target name="target_2" depends="target_1" >
		<!-- ... -->
	</target>
	<target name="target_3" >
		<!-- ... -->
	</target>
</targets>

3.1.13. target

Required Parameters

Optional Parameters

  • depends (type: Variable Name):

    The name of the Target this Target depends on.

Description. A Target is a collection of Tasks that represents a unit of execution. A target is the main action you want to perform, like installing a new application or updating an existing one. When you execute a DepFile, you must specify the name of the target to execute. A target can depend on other targets, in which case before execution begins, Aviate takes care of resolving the dependency between Targets to decide on the order of their execution. A DepFile must define at least one Target.

3.1.14. task

Required Parameters

Optional Parameters

  • chain (type: Variable Name):

    The name of the SSH server to chain this task to.

Description. A Task is a grouping of Commands that share a common goal, or describe a single phase of execution. Executing a Target leads to the execution of all of its tasks; in sequential order with regards to Task dependency. Aviate takes care of resolving the dependency between Tasks to decide on the order of their execution. A target must contain at least one Task. Each Task has a unique name that identifies.

<targets>
	<target name="target_1" >
		<task name="task_1" >
			<!-- ... -->
		</task>
		<task name="task_2" depends="task_1" >
			<!-- ... -->
		</task>
		<task name="task_3" >
			<!-- ... -->
		</task>
	</target>
</targets>

Optionally, you can specify the name of an SSH server to chain a Task to. Chaining means that this task will be executed locally on the SSH server; the DepFile will be uploaded, and this task will be executed by another Aviate instance that should have been installed on that SSH server.

3.1.15. list

Required Parameters

Description. A collection of entries.

<list name="list1">
	<entry name="value1" />
	<entry name="value2" />
</list>

3.1.16. entry

Optional Parameters

  • name (type: String):

    The name of the the entry.

  • value (type: String):

    The value of the entry.

Description. An entry in a List or Dictionary. If used in a List, the value only needs to be specified. If used in a Dictionary, both the name and value must to be specified.

3.1.17. dictionary

Required Parameters

Description. A collection of key/value pairs.

<dictionary name="list1">
	<entry name="key1" value="value1" />
	<entry name="key2" value="value2" />
</dictionary>

3.1.18. filterchain

Required Parameters

Description. A FilterChain is an ordered list of Filters that is used to apply it on a stream of data. An example FilterChain:

<filterchain name="filter1">
	<regexfilter pattern="DB_USER" replace="${database.user}" ignoreCase="false" />
	<regexfilter pattern="DB_PASSWORD" replace="${database.password}" />
</filterchain>

3.1.19. regexfilter

Required Parameters

  • pattern (type: String):

    The regular expression pattern. Should not contain the heading and trailing slashes.

  • replace_with (type: String):

    The value to replace the match with.

  • ignore_case (type: Boolean):

    If True, matching is done case-insensitive.

  • multiline (type: Boolean):

    If True, then matching is done over multiple rather than one line. Note that the pattern character "^" matches at the beginning of the string and at the beginning of each line (immediately following each newline); and the pattern character "$" matches at the end of the string and at the end of each line (immediately preceding each newline). By default, "^" matches only at the beginning of the string, and "$" only at the end of the string and immediately before the newline (if any) at the end of the string.

Description. A Regular Expression filter to replace a pattern with a value in a stream of data.

<filterchain name="filter1">
	<regexfilter pattern="DB_USER" replace="${database.user}" ignoreCase="false" />
	<regexfilter pattern="DB_PASSWORD" replace="${database.password}" />
</filterchain>

3.1.20. server:local

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the local server.

Optional Parameters

  • root (type: String.):

    The root to append relative paths in this server to. If not specified, the server platform's default root is used ("/" for POSIX, and C:\ for Windows).

Description. A Local server represents the local machine running Aviate. Many commands are performed against the Local server. For example, when you copy a file from your computer to a web hosting account through SSH; you're copying a file from the Local server to an SSH server. There must be one and only one Local server defined. An example definition:

<servers>
	<server:local id="local" root="/var/www" />
	<server:ssh os="linux" id="srv" host="a.com" username="root" password="${password}" />
</servers>

To copy a file from the local to the remote SSH server as defined above:

<fs:copy source="local" destination="myserver" from="config.ini" to="/var/www" />

3.1.21. server:ftp

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the FTP server.

  • host (type: String):

    The host of the server, can be a hostname or an IP address.

  • username (type: String):

    The username to use to login to the FTP server.

  • password (type: String):

    The password for the FTP account.

  • os (type: String):

    The operating system running the FTP server. Can be "linux", "9x", "nt", "mac" or "osx".

Optional Parameters

  • port (type: Integer):

    The port number of the FTP server. Default if not specified is 21.

  • root (type: String.):

    The root to append relative paths in this server to. If not specified, the server platform's default root is used ("/" for POSIX, and C:\ for Windows).

Description. Defines an FTP server.

3.1.22. server:sftp

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the SFTP server.

  • host (type: String):

    The host of the server, can be a hostname or an IP address.

  • username (type: String):

    The username to use to login to the SFTP server.

  • password (type: String):

    The password for the SFTP account.

  • os (type: String):

    The operating system running the SFTP server. Can be "linux", "9x", "nt", "mac" or "osx".

Optional Parameters

  • port (type: Integer):

    The port number of the SFTP server. Default if not specified is 22.

  • root (type: String.):

    The root to append relative paths in this server to. If not specified, the server platform's default root is used ("/" for POSIX, and C:\ for Windows).

Description. Defines an SFTP (SSH over FTP) server.

3.1.23. server:ssh

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the Rsync server.

  • host (type: String):

    The host of the server, can be a hostname or an IP address.

  • os (type: String):

    The operating system running the FTP server. Can be "linux", "9x", "nt", "mac" or "osx".

Optional Parameters

  • username (type: String):

    The username to use to login to the SSH server.

  • password (type: String):

    The password for the SSH account.

  • certificate_file (type: String):

    The path to the certificate file to use for login.

  • passphrase (type: String):

    The passphrase encrypting the certificate file, if one is required.

  • port (type: Integer):

    The port number of the SSH server. Default if not specified is 22.

  • root (type: String.):

    The root to append relative paths in this server to. If not specified, the server platform's default root is used ("/" for POSIX, and C:\ for Windows).

Description. Defines an SSH server. An SSH server is similar to an SFTP server, with an added capability of executing system commands on it. To login to an SSH server, you either have to specify a username and password pair, or the path to a certificate file (along with its passphrase if necessary).

3.1.24. server:subversion

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the Rsync server.

  • repository_path:

    The URL of the repository.

Optional Parameters

  • username (type: String):

    The username to use to login to the Subversion server.

  • password (type: String):

    The password for the Subversion account.

Description. Defines a remote Subversion server. The repository_path could either be the root of the repository, or a specific directory inside it. For example, it can both be "http://example.com/svn/project" or "http://example.com/svn/project/dir1/dir2". Eitherway, when you want to checkout, you specify the directory you want to checkout relative to the repository path, so the checkout URL is formed by appending the repository path to the checkout directory.

<servers>
<server:subversion id="svn" repository_path="http://source.vimov.com/svn/aviate/trunk" />
</servers>

If you then wanted to checkout the contents of trunk, you could:

<vc:checkout source="aviate_svn" destination="local" from="/" to="/tmp" />

3.1.25. server:mysql

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the MySQL server.

  • host (type: String):

    The host of the server, can be a hostname or an IP address.

Optional Parameters

  • port (type: Integer):

    The port number of the MySQL server. Default if not specified is 3306.

  • username (type: String):

    The username to use to login to the MySQL server.

  • password (type: String):

    The password for the MySQL account.

Description. Defines a MySQL server. Note that in most server configurations, MySQL cannt be accessed except through a local connection from its server. To overcome this limitation, you can either run Aviate on the MySQL server, or better yet, use Chaining over SSH.

3.1.26. server:rsync

Required Parameters

  • id (type: Variable Name):

    A unique identifier for the Rsync server.

  • host (type: String):

    The host of the server, can be a hostname or an IP address.

  • model_name (type: String):

    The name of the Model to sync to.

Optional Parameters

  • username (type: String):

    The username to use to login to the Rsync server.

  • password (type: String):

    The password for the Rsync account.

  • port (type: Integer):

    The port number of the Rsync server. Default if not specified is 873.

Description. Defines an Rsync server; a server running Rsync in daemon mode. This is separate from using Rsync over SSH, to which you do not need to define an Rsync server.

3.1.27. fs:rsync

Required Parameters

  • source (type: Variable Name):

    The name of the server to sync from. Can be a Local, an SSH, or an Rsync server. Both the source and destination cannot be remote servers; one has to be Local.

  • source (type: Variable Name):

    The name of the server to sync to. Can be a Local, an SSH, or an Rsync server. Both the source and destination cannot be remote servers; one has to be Local.

  • from (type: Non-Empty String):

    The path to the directory to sync from. Can be an absolute path, or relative, in which case it is relative to the root of the source server. The path's trailing slash is treated the same as Rsync's behaviour.

  • to (type: Non-Empty String):

    The path of the directory to sync to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server. The path's trailing slash is treated the same as Rsync's behaviour.

Optional Parameters

  • options (type: Variable Name):

    The name of a Dictionary of options to pass to the Rsync executable.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Syncs a local or remote directory to a local or remote server one using Rsync. Both the source and destination cannot be remote servers; one has to be Local. You must have Rsync installed unless you are using a binary distribution (on Windows, Aviate is packaged with Rsync).

<fs:rsync
	source="local"
	destination="ssh_server"
	from="${working_dir}/"
	to="#{SITE_DIR}"
	options="opt"
>
	<dictionary name="opt">
		<entry name="-r"/>
		<entry name="--delete"/>
		<entry name="--exclude" value=".svn" />
		<entry name="--exclude" value="source/files" />
	</dictionary>
</fs:rsync>

Both the source and destination cannot be remote servers; one has to be Local.

3.1.28. fs:copy

Required Parameters

  • source (type: Variable Name):

    The name of the server to copy from. Can be a Local, an FTP, an SFTP, or an SSH server.

  • destination (type: Variable Name):

    The name of the server to copy to. Can be a Local, an FTP, an SFTP, or an SSH server.

  • from (type: Non-Empty String):

    The path to the file or directory to copy from. Can be an absolute path, or relative, in which case it is relative to the root of the source server.

  • to (type: Non-Empty String):

    The path of the directory to copy to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • contents_only (type: Boolean):

    If True, then the operation will be applied to the contents of the directory only and not the parent directory. Default is False.

  • recursive (type: Boolean):

    If True, then the operation will be applied recursively. Default is False.

  • create_dirs (type: Boolean):

    If True, and one or more directories in the "to" path do not exist, they will be created. Default is False.

  • replace (type: Boolean):

    If True, then any existing file or directory in the destination will be replaced. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Copy a file or directory to a destination server. You can copy files and directories on the Local server, from the Local server to a remote server (like an SSH server), or from a remote server to the Local server. Supported servers are Local, FTP, SFTP, and SSH. You cannot copy between two remote servers.

<fs:copy source="local" destination="ssh_server from="config.ini" to="/var/www/" replace="true" />

3.1.29. fs:delete

Required Parameters

  • destination (type: Variable Name):

    The name of the server to perform the operation at. Must be a Local, an FTP, an SFTP, or an SSH server.

  • path (type: Non-Empty String):

    Path to the file or directory to perform operation on. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • contents_only (type: Boolean):

    If True, then the operation will be applied to the contents of the directory only and not the parent directory. Default is False.

  • recursive (type: Boolean):

    If True, then the operation will be applied recursively. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Delete a file or directory. The Delete operation can be applied to a Local, an FTP, an SFTP, or an SSH server.

<fs:delete destination="ssh_server path="/var/www/cache" contents_only="true" />

An example that uses an exclude list to skip directories:

<fs:delete destination="local" path="a" recursive="true" />
<fs:mkdir destination="local" path="a/1/b1" recursive="true" />
<fs:mkdir destination="local" path="a/2/b1" recursive="true" />
<fs:mkdir destination="local" path="a/2/b2" recursive="true" />
<fs:mkdir destination="local" path="a/3/b1" recursive="true" />
<fs:delete destination="local" path="a" recursive="true" excludes="list1">
	<fileset name="list1">
		<match parent="1" />
		<match parent="2" name="b2" />
	</fileset>
</fs:delete>

3.1.30. fs:chmod

Required Parameters

  • destination (type: Variable Name):

    The name of the server to perform the operation at. Must be a Local, an FTP, an SFTP, or an SSH server.

  • path (type: Non-Empty String):

    Path to the file or directory to perform operation on. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

  • permissions (type: String):

    The permissions to apply. For POSIX servers, the permissions can either be in the form rwxrwxrwx, or 0777, or 777. For Windows servers, the permissions have to be in the form rw.

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • contents_only (type: Boolean):

    If True, then the operation will be applied to the contents of the directory only and not the parent directory. Default is False.

  • recursive (type: Boolean):

    If True, then the operation will be applied recursively. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Change the permissions of a file or directory. The Chmod operation can be applied to a Local, an FTP, an SFTP, or an SSH server.

<fs:chmod destination="ssh_server path="/var/www/upload" permissions="rwxr-xr-x" recursive="true" />

3.1.31. fs:chown

Required Parameters

  • destination (type: Variable Name):

    The name of the server to perform the operation at. Must be either a Local or an SSH server, and cannot be Windows.

  • path (type: Non-Empty String):

    Path to the file or directory to perform operation on. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

  • owner:

    The new owner of the file or directory

  • owner:

    The new group of the file or directory

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • contents_only (type: Boolean):

    If True, then the operation will be applied to the contents of the directory only and not the parent directory. Default is False.

  • recursive (type: Boolean):

    If True, then the operation will be applied recursively. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Change the owner or group of a file or directory. The Chmod operation can be applied to a Local or an SSH server, and cannot be applied to Windows servers.

<fs:chown destination="ssh_server path="/var/www/upload" owner="www-data" group="www-data" />

3.1.32. fs:mkdir

Required Parameters

  • destination (type: Variable Name):

    The name of the server to perform the operation at. Must be a Local, an FTP, an SFTP, or an SSH server.

  • path (type: Non-Empty String):

    Path to the directory to create. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • mode (type: String):

    The permissions to apply on the newly created directory. For POSIX servers, the permissions can either be in the form rwxrwxrwx, or 0777, or 777. For Windows servers, the permissions have to be in the form rw. Default is 0777.

  • recursive (type: Boolean):

    If True, then any directory not existing in the specified path is created. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Create a directory. If the directory already exist, no error will be reported. The operation can be applied to a Local, an FTP, an SFTP, or an SSH server.

<fs:mkdir destination="ssh_server path="/var/www/upload" mode="rwxr-xr-x" />

3.1.33. fs:compress

Required Parameters

  • source (type: Variable Name):

    The name of the server to compress from. Must be the Local server.

  • destination (type: Variable Name):

    The name of the server to compress to. Must be the Local server.

  • from (type: Non-Empty String):

    The path to the file or directory to compress. Can be an absolute path, or relative, in which case it is relative to the root of the source server.

  • to (type: Non-Empty String):

    The path of the destination compressed file. Its extension will decide the compression type. The extension can be ".zip", ".tar", ".tar.gz" and ".tar.bzip". The path can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • replace (type: Boolean):

    If True, then any existing file in the destination will be replaced. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Compress a file or directory. The compressed file can be a ZIP, a TAR, a GZipped TAR or a BZipped TAR. The source and destination must both be the Local server, and cannot be a remote server. The extension of the target file will decide the compression type; it can be ".zip", ".tar", ".tar.gz" and ".tar.bz2".

<fs:compress source="local" destination="local" from="/var/www" to="latest.tar.gz" />

3.1.34. fs:decompress

Required Parameters

  • source (type: Variable Name):

    The name of the server to decompress from. Must be the Local server.

  • destination (type: Variable Name):

    The name of the server to decompress to. Must be the Local server.

  • from (type: Non-Empty String):

    The path to the file or directory to decompress. Can be an absolute path, or relative, in which case it is relative to the root of the source server.

  • to (type: Non-Empty String):

    The path of the destination compressed file. The path can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • replace (type: Boolean):

    If True, then any existing file or directory in the destination will be replaced. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Decompress a file. The compressed file can be a ZIP, a TAR, a GZipped TAR or a BZipped TAR. The source and destination must both be the Local server, and cannot be a remote server. The extension of the file will decide the compression type; it can be ".zip", ".tar", ".tar.gz" and ".tar.bz2".

<fs:decompress source="local" destination="local" from="latest.tar.gz" to="." />

3.1.35. fs:rename

Required Parameters

  • destination (type: Variable Name):

    The name of the server to rename at. Can be a Local, an FTP, an SFTP, or an SSH server.

  • from (type: Non-Empty String):

    The path to the file or directory to rename from. Can be an absolute path, or relative, in which case it is relative to the root of the source server.

  • to (type: Non-Empty String):

    The path of the directory to rename to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • replace (type: Boolean):

    If True, then any existing file or directory in the destination will be replaced. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Renames a file or directory on the same server.

<fs:rename destination="ssh_server from=".htaccess.production" to=".htaccess" replace="true" />

3.1.36. fs:ftpsync

Required Parameters

  • source (type: Variable Name):

    The name of the server to sync from. Must be a Local server.

  • source (type: Variable Name):

    The name of the server to sync to. Must be either an FTP or an SFTP server.

  • from (type: Non-Empty String):

    The path to the directory to sync from. Can be an absolute path, or relative, in which case it is relative to the root of the source server.

  • to (type: Non-Empty String):

    The path of the directory to sync to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • excludes (type: Variable Name):

    The name of a locally defined FileSet that defines an exclude list. Default is to not exclude anything.

  • chmod (type: String):

    The permissions to apply on the newly created directory. For POSIX servers, the permissions can either be in the form rwxrwxrwx, or 0777, or 777. For Windows servers, the permissions have to be in the form rw. Default is not to apply any changes to the server's default.

  • delete (type: Boolean):

    If True, deletes files in the destination not existing in the source. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Syncs a local directory to an FTP/SFTP server based on the timestamp.

3.1.37. db:create

Required Parameters

  • destination (type: Variable Name):

    The name of the database server to create a database at. The server must be a MySQL server.

  • name (type: Non-Empty String):

    The name of the database to create.

Optional Parameters

  • character_set (type: Non-Empty String):

    The character set of the new database. Defaults to the database engine's default.

  • collate (type: Non-Empty String.):

    The database collation. Defaults to the database engine's default.

  • if_not_exists (type: Boolean):

    If True, creates the database only if it did not exist. Default is True.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description.  Create a new database at a MySQL server.

<db:create destination="mysql_server" name="testdb" />

3.1.38. db:drop

Required Parameters

  • destination (type: Variable Name):

    The name of the database server to drop a database from. The server must be a MySQL server.

  • name (type: Non-Empty String):

    The name of the database to drop.

Optional Parameters

  • if_exists (type: Boolean):

    If True, drops the database only if it exists. Default is True.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description.  Drop a database from a MySQL server.

<db:drop destination="mysql_server" name="testdb" />

3.1.39. db:sql

Required Parameters

  • destination (type: Variable Name):

    The name of the database server to execute commands at. The server must be a MySQL server.

  • name (type: Non-Empty String):

    The name of the database to execute the commands on.

  • statements (type: Variable Name):

    The name of a List of statements to execute.

Optional Parameters

  • transaction (type: Boolean):

    If True, runs the statements inside a transaction.

Description.  Execute one or more SQL statements. The destination server must be a MySQL server.

<db:sql destination="mysql_server" statements="stats1" database="testdb" >
	<list name="stats1">
		<entry value="create table test (id INT, data VARCHAR(100));" />
		<entry value="insert into test values ('1', 'one');" />
		<entry value="insert into test values ('2', 'two');" />
	</list>
</db:sql>

3.1.40. db:mysqldump

Required Parameters

  • source (type: Variable Name):

    The name of the database server to dump from. The server must be a MySQL server.

  • destination (type: Variable Name):

    The name of the server to store the file at. Must be a Local server.

  • to (type: Non-Empty String):

    The path of the file to store the dump in. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • databases (type: Variable Name):

    The name of a List of the databases to backup. If not specified, all the databases are backed up.

  • tables (type: Variable Name):

    The name of a List of the tables to backup. If empty, backs up all tables. Not used if databases is empty or more than one database was specified.

  • options (type: Variable Name):

    The name of a Dictionary of options that is passed to mysqldump. Example options are compact and add-drop-database. The following options are ignored: help, ?, all-databases, A, databases, B, debug, #, debug-info, host, h, port, user, tables, verbose, v, version, V, password, p, pipe, W.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Dump to a file from a MySQL server. Uses the mysqlump binary from the MySQL client distribution. You can specify the same command line options you pass to the mysqldump binary through an options dictionary.

<db:mysqldump source="mysql" destination="local" to="o.sql" databases="dl" tables="tl" options="od" >
	<list name="dl">
		<entry value="blog"/>
	</list>
	<list name="tl">
		<entry value="posts"/>
		<entry value="comments"/>
		<entry value="users"/>
	</list>
	<dictionary name="od">
		<entry name="--xml"/>
	</dictionary>
</db:mysqldump>

3.1.41. db:mysqlimport

Required Parameters

  • source (type: Variable Name):

    The name of the server to read the SQL file from. The server must be a Local server.

  • destination (type: Variable Name):

    The name of the database server to import to. Must be a MySQL server.

  • from:

    The path of the file to import from. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

  • to (type: Non-Empty String):

    The name of the database to import to.

Optional Parameters

  • options (type: Variable Name):

    The name of a Dictionary of options that is passed to mysqlimport. Example options are compact and add-drop-database. The following options are ignored: help, ?, databases, B, debug, #, debug-info, host, h, port, user, tables, verbose, -v, version, V, password, p, pipe, W, local.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Import from a file to a MySQL server. Uses the mysqlimport binary from the MySQL client distribution.

<db:mysqlimport source="local" destination="mysql_server" from="dump.sql" to="testdb" />

3.1.42. vc:checkout

Required Parameters

  • source (type: Variable Name):

    The name of the server to checkout from. Must be a Subversion server.

  • destination (type: Variable Name):

    The name of the server to checkout to. Must be a Local server.

  • from (type: Non-Empty String):

    The path to checkout from. This path is appended to the repository path defined in the Subversion server.

  • to (type: Non-Empty String):

    The directory to checkout to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • revision (type: Integer):

    The revision number to checkout, or 0 for the latest revision. Default is 0.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Checkout from a Version Control server. The server must be a Subversion server.

<vc:checkout source="svn_server" destination="local" from="." to="/tmp" />

3.1.43. vc:export

Required Parameters

  • source (type: Variable Name):

    The name of the server to export from. Must be a Subversion server.

  • destination (type: Variable Name):

    The name of the server to export to. Must be a Local server.

  • from (type: Non-Empty String):

    The path to export from. This path is appended to the repository path defined in the Subversion server.

  • to (type: Non-Empty String):

    The directory to export to. Can be an absolute path, or relative, in which case it is relative to the root of the destination server.

Optional Parameters

  • revision (type: Integer):

    The revision number to export, or 0 for the latest revision. Default is 0.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Export from a Version Control server. The server must be a Subversion server.

<vc:export source="svn_server" destination="local" from="." to="/tmp" />

3.1.44. system:execute

Required Parameters

  • command (type: Non-Empty String):

    The command to execute, for example, "ls -al".

  • destination (type: Variable Name):

    The name of the server to copy to. Must either be a Local or SSH server.

Optional Parameters

  • success_if (type: Variable Name):

    The name of a List of exist codes that define the case for successful execution. If the return code of the command was one defined in this list, then the command is assumed to have executed successfully.

  • fail_if (type: Variable Name):

    The name of a List of exist codes that define the case for failed execution. If the return code of the command was one defined in this list, then the command is assumed to have produced an error during execution.

  • verbose (type: Boolean):

    If True, prints the output of execution. Default is False

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Executes a command on either the local server or a remote SSH server. It is not possible to execute commands on FTP or SFTP servers.

<system:execute
	destination="local"
	command="ls /tmp"
	verbose="true"
	success_if="success_list"
	fail_if="fail_list"
>
	<list name="success_list">
		<entry value="0" />
	</list>
</system:execute>

3.1.45. web:download

Required Parameters

  • destination (type: Variable Name):

    The name of the server to download to. Must be a Local server.

  • from (type: Non-Empty String):

    The URL to download from.

  • to (type: Non-Empty String):

    Can be the path to a non-existing file, in which case the file will be downloaded to that path, it can be an existing file if replace is True, or it can be a directory. If the destination is a directory, then the name of the file is read from the content-desposition header if it was sent, or else from the URL.

Optional Parameters

  • replace (type: Boolean):

    If True, then any existing file will be replaced. Default is False.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Download a file from the web to a Local server.

<web:download destination="local" from="${url1}" to="/tmp/download.zip" replace="true" />
<web:download destination="local" from="${url2}" to="/tmp" replace="true" />

3.1.46. web:browser

Description. The Web Browser allows you to simulate a traditional browser session. It allows you to pass data to pages, validate the responses using a variety of ways, and it carries the cookies between the requests. Each session, represented by an instance of web:browser, consists of one or more web:request.

3.1.47. web:request

Required Parameters

Optional Parameters

  • encoding (type: Non-Empty String):

    The encoding of the POST parameters. Can be either "xwww-data" or "form-data". Default is "xwww-data".

  • method (type: Non-Empty String):

    The method of the request. Can be either "get" or "post". Default is "get".

  • data (type: Variable Name):

    The name of a Dictionary of data to send along with the request. Default is not to send any data.

  • valid_codes (type: Variable Name):

    The name of a List of valid response codes to this request. Default is none, all request are assumed to have succeeded if any response is returned.

  • invalid_codes (type: Variable Name):

    The name of a List of invalid response codes to this request. Default is none.

  • body_regex_valid (type: Non-Empty String):

    If this regular expression matches, then the request will be assumed to have succeeded. Default is none.

  • required_cookies (type: Variable Name):

    The name of a List of cookie names that are required to have been sent back to assume this request has succeeded. Default is none.

  • retry (type: Integer):

    The number of times to retry execution on Failure. Default is 1.

Description. Defines a request to send to a web server. The request can be either a GET or POST request, and it can carry data if needed. If a response is returned, then the request is assumed to have succeeded by default. Further constraints can be imposed to specify the certain cases at which the request should be assumed to have succeeded, by utilizing the HTTP response code, the body of the response or the returned cookies.The following example demonstrates automating the web portion of installing Wordpress:

<web:browser>
	<web:request
		url="${sie_url}/wp-admin/install.php?step=2"
		method="post"
		data="post_data"
		valid_codes="vcodes"
 >
		<dictionary name="post_data">
			<entry name="weblog_title" value="${title}" />
			<entry name="admin_email" value="${email}" />
			<entry name="blog_public" value="${public}" />
		</dictionary>
		<list name="vcodes">
			<entry value="200" />
		</list>
	</web:request>
</web:browser>

3.1.48. t:echo

Optional Parameters

  • text (type: String):

    The text to print on the screen. If not specified, prints an empty line.

Description. Print a text on the terminal. An example to print pre-defined constants:

<t:echo text="Pre-defined Constants" />
<t:echo />
<t:echo text="Date: #{YEAR}-#{MONTH}-#{DAY}" /> #{CWD}, #{APP_DIR}, #{TEMP}, " />
<t:echo text="Time: #{HOUR}:#{MINUTE}:#{SECOND}:#{MICROSECOND}" />
<t:echo text="Platform: #{PLATFORM}, #{OS}" />
<t:echo text="DepFile: #{DEPFILE_DIR}, #{DEPFILE_NAME}" />
<t:echo text="CWD: #{CWD}" />
<t:echo text="APP_DIR: #{APP_DIR}" />
<t:echo text="TEMP: #{TEMP}" />

3.2. Parameter Types

3.2.1. Boolean

A two-state logical datatype. Its allowed values state values are "true" and "false", or "1" and "0".

3.2.2. Integer

An unsigned number datatype.

3.2.3. String

A string whose length is zero characters long or more.

3.2.4. Non-Empty String

A string whose length is one characters or more.

3.2.5. Variable Name

A Variable Name is a name that is used to identify a class of similar tags, like a list of Servers. A Variable Name must be unique in its scope of definition, but not globally unique. For example, since two Servers are in the same class, no two Servers may have the same name. However, a Server may have the same name as a Constant, since they are two objects of a different class.

Allowed characeters in a Variable's name are letters, numbers, dots, underscores and dashes.

Chapter 4. Extending Aviate

Documentation to accompany the release of Alpha 7.

Appendix A. Aviate for Developers

A.1. Source Trees

Aviate's source code is hosted on a Subversion server. Read access to the repositories is open to the public, with write privileges being assigned to approved developers. The repositories, although accessible through http and https. write access is only possible through an SSL connection.

Available repositories are:

You can browse the repositories with a browser, or checkout using a Subverion client like:

shell> svn checkout http://source.vimov.com/svn/aviate/trunk

All commits trigger email notifications to a mailing list, to which developers can subscribe to:

A.2. Building Aviate

A.2.1. Versioning Scheme

A version consists of an alternating series of release numbers and pre-release or post-release tags. A release number is a series of digits punctuated by dots, such as 2.4 or 0.5. Each series of digits is treated numerically, so releases 2.1 and 2.1.0 are different ways to spell the same release number, denoting the first subrelease of release 2. But 2.10 is the tenth subrelease of release 2, and so is a different and newer release from 2.1 or 2.1.0. Leading zeros within a series of digits are also ignored, so 2.01 is the same as 2.1, and different from 2.0.1.

In addition to the release number, pre-release and post-release tags can be used. Pre-release tags make a version be considered older than the version they are appended to. So, revision 2.4 is newer than revision 2.4beta1. Post-release tags make a version be considered newer than the version they are appended to. So, revisions like 2.4-1 are newer than 2.4, but are older than 2.4.1 (which has a higher release number).

Allowed pre-release tags are "rc", "beta" and "alpha" (without quotes). Allowed post-release tags is a dash followed by the re-release number.

A.2.2. Builds

A.2.2.1. Releases

Aviate releases are stored in the following directory:

http://source.vimov.com/files/aviate/releases/

For each release, there will be several files corresponding to the various targetted platforms. The main releases is packaged as a .tar.gz, and comes with none of the binaries of the libraries or programs Aviate depends on. This release is intended to be used for GNU/Linux or UNIX-based operating systems, and the installation instructions has information on installing the main release.

For Windows releases, where it is less expected that the user would be able to install the dependencies, Aviate is packaged for this platforms with the required binaries it depends on. The package will thus be larger, be in .zip, and postfixed with the tag -win32.

Example release files for version 1.0alpha3 would be:

aviate-1.0alpha3.tar.gz
aviate-1.0alpha3-osx.zip
aviate-1.0alpha3-win32.zip

A.2.2.2. Nightly Builds

A a new build snapshot of the trunk is made daily at 00:00 AM EST if there had been a change in the repository since the last nightly build. Only the main release (see Section A.2.2.1, “Releases”) is built, and only the last 30 builds are retained at:

http://source.vimov.com/files/aviate/nightly/

A.2.3. Building and Packaging Aviate

Aviate uses setuptools as the foundation for distribution, so setup.py is used to build on the various platforms.

A.2.3.1. Packaging on GNU/Linux

shell> python setup.py sdist

The packaged file will be in the build directory. That's all!

A.2.3.2. Building on Windows

Releases on Windows differ from UNIX-based OSes, since it is safe to assume most of the dependencies would not be installed, and may be too difficult to install manually by the user, like rsync, or the Python runtime. Hence, only binary releases are supported, and to build a release, you'd have to have installed the following dependencies so they would be packaged into the executable:

Then, to build the executable:

prompt> python setup.py py2exe

This builds the executabale to dist/aviat.exe, and copies to this directory the required configuration and binary files.

It is possilble to run the source on Windows, which is beneficial for development purposes, however, since the source is not officially distributed with binaries needed for Windows (like rsync), the only mean to run it on Windows is to check out from Subversion (see Section A.1, “Source Trees”) so that you'd have the binaries, and then manually copy thedeployer.conf.win to thedeployer.conf.

A.2.4. Building Aviate Documentation

Aviate's documentation is written using DocBook. To build the documentation, you must have "xsltproc" installed. On Ubuntu Debian, install the packages xsltproc and docbook-xsl.

shell> sudo apt-get install xsltproc docbook-xsl

With the build tools installed (build-essential package on Debiab/Ubuntu), do:

shell> ./configure
shell> make

The documentation will be generated in the build directory.

A.2.5. Building Aviate Front

First, you'd need to have the next dependencies if you don't already:

	
shell> sudo apt-get install build-essential
shell> sudo apt-get install libXrender-dev libXrandr-dev libXcursor-dev
shell> sudo apt-get install libXfixes-dev libXinerama-dev libXi-dev libXt-dev libXext-dev
shell> sudo apt-get install libX11-dev libSM-dev libICE-dev libglib-dev libpthread
shell> sudo apt-get install qt4.0-dev
shell> sudo apt-get install libxml-dev libxml2-dev

And build:

shell> qmake
shell> make

Appendix B. Pre-Defined Constants

The following are Aviate's pre-defined constants:

Table B.1. List of Pre-defined Constants

NameDescriptionExample Value
PLATFORMThe current platform; can be "posix" or "windows"posix
OSThe name of the current operating system9x
CWDThe current working directory/var/www
APP_DIRThe path of the Aviate executableC:\aviate
TEMPThe OS's default temporary directoryC:\windows\temp
DEPFILE_DIRThe directory containing the executing DepFile/var/www
DEPFILE_NAMEThe name of the executing DepFilemyproject.dep
YEARThe current year2008
MONTHThe current month12
DAYThe current day29
HOURThe current hour23
MINUTEThe current minute59
SECONDThe current second59
MICROSECONDThe current microsecond555943

Appendix C. Frequently Asked Questions

General

Q: Will there be a Max OS X version of Aviate?

Q:

Will there be a Max OS X version of Aviate?

A:

A Mac OS X version is planned, and we will try to bring it out as soon as we can.

Installation

Q: When installing via setup.py on GNU/Linux, I get an error in building MySQL-Python!

Q:

When installing via setup.py on GNU/Linux, I get an error in building MySQL-Python!

A:

Be sure to have the development MySQL C++ Library Bindings installed. On Debian/Ubuntu, you'd need to install the package libmysql++-dev.

Appendix D. Aviate - Release Notes

D.1. 1.0alpha6

What's New

  • setup.py now works for installation on Linux.

D.2. 1.0alpha5

What's New

  • system:execute command, both for local and SSH servers.

  • Chainging over SSH servers (1-link chaining only).

Known Issues

  • Decompressing a TAR with Python 2.4 doesn't work.

  • Compressing a single file produces a corrupt file.

D.3. 1.0alpha4

What's New

  • FTP synchronization.

  • Command "echo", and built-in support for the target "help".

  • Built-in constants and user-defined constants.

  • Better error message in parsing syntatically invalid DepFiles.

  • Added input questions to Arguments.

  • Only one target can be executed, and must be specified.

  • Comes with an example for Wordpress installation.

Fixes

  • Problem with web:download with some servers.

  • Problem with connecting to SFTP/SSH servers if known_hosts didn't exist.

  • Global timeout now read from the configuration file.

Known Issues

  • FileSet pattern matching in copy when destination exists not reliable.

  • Global timeout not used by Browser Session.

  • Problem with copy over SSH (at least) when there are existing directories.

  • with help target and validation for non-subistituted variables.

  • FTP and SSH too slow. Can/should be tuned to be at least three times faster!

D.4. 1.0alpha3

What's New

  • FTP and SFTP integrated to the commands. Local to Remote and vice versa.

Known Issues

  • SFTP/SSH connections fail on a fresh Windows box.

  • FTP ops seem to be much slower than SSH (tested on different servers though).

  • Excludes for FTP/SFTP operations not fully tested.

  • Filters not yet working.

  • When lacking permission, produced errors not clear enough.

D.5. 1.0alpha2

What's New

  • Fixed: Deletion problem on Windows due to read-only.

  • Each command can have an ignore_error field.

D.6. 1.0alpha1

What's New

  • Basic DepFile features like defaults.

  • MySQL support on Windows and Linux.

  • Rsync support on Windows and Linux.

  • Subversion support on Windows and Linux.

  • Local file system operations on Windows and Linux.

Known Issues

  • Windows: Fails on deletion of read-only files.

Appendix E. License

Aviate and Aviate Front are both licensed under the GNU General Public License (GPL) version 2. Full text of the license is available here.

This documentation is licensed under the GNU Free Documentation License (GFDL) version 1.2. Full text of the license is available here.