A light-weight flexible deployment tool for deploying web applications. This project was inspired by Capistrano and Vlad the Deployer, as well as being built on top of Phake, a Rake clone.
This project came out of the need for a way to deploy Wordpress sites to multiple environments easily and without firing up FTP clients, etc. What started as a simple Rakefile, quickly grew into much more, and has been finally abstracted and ported to PHP to be able to fully integrate tasks with your application.
Make sure you have composer installed:
$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
Need help installing composer?
I like to install Pomander globally so I can use it in any project. Unfortunately, Composer does not have a way of doing this by default, so here is an easy way to allow global package installation:
$ curl https://gist.github.com/raw/4242494/35dde077b9d614d537b322c191fecf25ec74d1a5/global_composer.sh | sh
If you haven't added composer's bin folder to your $PATH
, better do that now:
$ echo 'export PATH="$HOME/.composer/bin:$PATH"' >> ~/.bashrc
Substitute .bashrc with whatever you use.
If you are using the global installation method from above, you can easily do:
$ cd ~/.composer && composer require pomander/pomander
Otherwise, you need to add pomander/pomander
to your project's composer.json:
{
"require": {
"pomander/pomander": "*"
}
}
You can also do this using Composer:
$ composer require pomander/pomander
$ pom init
Once the file has been created, you will want to fill in the appropriate values. You can also check out the options reference for help.
Pomander also supports YAML deploy environments, but recommends using php scripts for extra customization.
$ pom staging deploy:setup # staging is the environment name and uses deploy/staging.php
$ pom staging deploy
Use pom -T
to see your available tasks.
Option | Description |
---|---|
url | Application URL. Used primarily for database migration and isn't always needed. |
user | SSH user for performing remote tasks. |
repository | Repository url. |
revision | Revision/branch to deploy. Default: origin/master, trunk |
branch | Alias of revision. |
scm | SCM to use. Currently support svn and git. Default: git |
releases | Use current/releases/shared structure. (true/false/number of releases to keep) Default: false |
adapter | Data adapter to use for databases. Currently support MySQL Default: mysql |
remote_cache | Cache repository for faster deploys. (true/false) Default: true when releases are set |
deploy_to | Path to deploy application to. Default: cwd |
backup | Perform database backup on deployments. (true/false). Default: false |
umask | User's umask for remote tasks. Default: 002 |
rsync_cmd | Command to use for file syncing. Default: rsync |
rsync_flags | Extra flags used for file syncing. Default: -avuzPO --quiet |
app | String or Array of application hosts to deploy to. |
db | String or Array of database hosts to deploy to. |
<?php
$env->user('deploy')
->repository('git@github.com:github/teach.github.com.git')
->deploy_to('/var/www/html')
->releases(true)
->app(array(
'node-1.rackspace.com',
'node-2.rackspace.com'
))
;
config # Create development environment configuration
db:backup # Perform a backup suited for merging.
db:create # Create database.
db:full # Perform a full database backup.
db:merge # Merge a backup into environment.
deploy:cold # First time deployment.
deploy:setup # Setup application in environment.
delpoy:update # Update code to latest changes.
init # Set it up
rollback # Rollback to previous release
Adding tasks is easy, you can drop them right into your environment configurations.
All of the tasks in Pomander are built using Phake. A typical task looks something like this:
<?php
task('task_name', function($app) {
//task actions
});
There are a lot of great things you can do with tasks, so please refer to Phake's README or the Pomander Wiki.