CakePHP Deployment

sas

Intro

About the task of deploy a PHP application to a web-server exists a lot of tools and possibilities. The most of these tools are complicated to configure or difficult to use.

A very simple and integrated with CakePHP solution for this, i would like to introduce here.

Prerequisites

  • CakePHP version 1.3
  • remote access to your web server during FTP
  • a command shell on localhost with configured cake-shell

Let’s start..

1. Installation

git://github.com/sassman/deployment_shell.git

put the code to directory “app/vendors/shells/”.

2. Create the configuration

2.1 Create the configuration interactive

like cake bake shell style the configuration can be created interactively.

cake deploy create_deployment_config
or
cake deploy

2.2 Create the Configuration manually

/app/config/deployment.php:

<?php
 
class AppDeployment extends BasicDeployment
{
    var $default = array(
	'source' => 'File',
	'destination' => array('Ftp' => array(
		'host'      => 'yourftp_hostname',
           	'login'     => 'username',
           	'password'  => 'password',
           	'port'      => '21',
           	'timeout'   => '60',
           	'path'		=> '/html/app/beta/your_app'
	)),
       'exclusions' => array(
       		'files/attachments*',
       		'core.php'
       )
    );
 
    var $live = array(
	'source' => 'File',
	'destination' => array('Ftp' => array(
		'host'      => 'your_ftphostname',
           	'login'     => 'username',
           	'password'  => 'password',
           	'port'      => '21',
           	'timeout'   => '60',
           	'path'		=> '/html/apps/your_app'
	)),
       'exclusions' => array(
       		'files/attachments*',
       		'/cake/',
       		'core.php'
       )
    );
}
 
?>

3. First Run

take a command line shell and go into your applications “/app” folder and type…

cake deploy

executes the deployment shell with the “default” configuration (default configuration descriptor see above).

and

cake deploy live

executes the deployment shell with the “live” configuration.

On this way you can provide one or many more of these configuration descriptors and with it many of deployment targets.

4. Remarks

The tracking of files witch was uploaded is implemented during a sha1 checksum from the file itself and saved in the context of a deployment descriptor. During this, every deployment descriptor provides it’s own change/update list of files.

Any Questions? Send me an email.


One Response to “CakePHP Deployment”

Leave a Reply