Anchour is a deployment engine for web applications
wget http://rizeway.com/anchour.phar
First, Add a configuration file named .anchour
to your project.
This file defines some commands composed by an ordered set of steps
anchour:
connections:
MySSH:
type: "ssh"
options:
host: "localhost"
username: "foo"
password: "bar"
commands:
deploy:
steps:
-
type: "echo"
options:
message: "A test message <comment>with</comment> <info>formatted</info> <error>output</error>"
-
type: "rsync"
options:
key_file: "/home/username/.ssh/id_rsa_rsync"
source_dir: "tmp/minitwitter"
destination_dir: "tmp/minitwitter2"
connections:
connection: MySSH
Now deploy your project by running
./anchour.phar deploy
The connection types allowed by Anchour are
MySSH:
type: "ssh"
options:
host: "localhost"
username: "foo"
password: "bar"
MyFTP:
type: "ftp"
options:
host: "host.fr"
username: "foo"
password: "bar"
MySql1:
type: "mysql"
options:
host: "host.fr"
username: "foo"
password: "bar"
database: "db1"
The step types allowed by Anchour are
This step type allows you to output a formatted message
type: "echo"
options:
message: "A test message <comment>with</comment> <info>formatted</info> <error>output</error>"
This step type allows you to synchronize a local folder in a distant server using a SSH connection
type: "rsync"
options:
key_file: "/home/username/.ssh/id_rsa_rsync"
source_dir: "tmp/minitwitter"
destination_dir: "tmp/minitwitter2"
connections:
destination: "MySSH"
This step type allows you to upload a local folder using a FTP connection
type: "ftp"
options:
local_dir: "src"
remote_dir: "test"
connections:
connection: "MyFTP"
This step type allows you to execute commands in a remote server using SSH
type: "ssh"
options:
commands:
- uname -a
- date
connections:
connection: "MySSH"
This allows you to clone a GIT repository in a remote server using a SSH connection
type: "git"
options:
repository: "git://github.com/jubianchi/minitwitter.git"
remote_dir: "tmp/minitwitter"
clean_scm: true
remove_existing: true
depth: 1
connections:
connection: "MySSH"
This step allows you to maka a Mysql Export/Import using two MySql Connections
type: "mysql"
options:
create_database: true
drop_database: true
connections:
source: "MySQL1"
destination: "MySQL2"
This step allows you to build a CLI Phar archive
type: "cliPhar"
options:
directory: "."
regexp: "^[^\.].*/a/.*|regexp/.*|used/(?!to).*|filter\.php"
stub: "path/to/phar/stub.php"
name: "name.phar"
chmod: true
You may want to commit your .anchour file without some informations like passwords and hosts ... To do that, Anchour allows you to define some required variables in your connections like this
connections:
MyFTP:
type: ftp
options:
host: %my_host%
username: %my_username%
password: %my_password%
commands:
deploy:
description: Deploy using FTP
steps:
-
type: ftp
options:
remote_dir: %folder%
connections:
connection: MyFTP
There is several way to set those variables : command line arguments > config file > environment variable and finally interactive prompt
anchour.phar my_host=domain.tld
anchour.phar -c config.json
my_host=domain.tld anchour.phar
When you run the command deploy (described above), anchour will detect all the required variables for your command, asks you their values, and use them in the right places (example: %my_username% will be replaced by the value of the variable my_username)
Install the dependancies using composer and your ready to go
git clone https://github.com/youknowriad/anchour.git && cd anchour
curl -s http://getcomposer.org/installer | php
./composer.phar install