Easy PHP Deployment with Rocketeer

Posted by Tully on Fri 09 May 2014

Rocketeer is a command line PHP deployment tool. I have used Capistrano for deployment in the past, and really enjoyed using it. Rocketeer is very similar to Capistrano. It's extremely easy to set-up, and is a breeze to work with.



The PHP-mcrypt module is required on the server you are deploying to.

Centos Install Instructions

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum update
yum install php-mcrypt*


The below example uses 2 servers. A web server hosting your site and a server that is running the commands to deploy your code. This is usually your build server. Jenkins and Bamboo are two commonnly used build servers.

This is the Apache virtual host used in the example below.

<VirtualHost *:80>
    DocumentRoot /var/www/example/current  

Create a build directory (Deployment server)

mkdir ~/example_deployment
cd ~/example_deployment

Download Composer (Web server)

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Download Rocketeer (Deployment server)

wget http://rocketeer.autopergamene.eu/versions/rocketeer.phar
mv rocketeer.phar /usr/local/bin/rocketeer
chmod +x /usr/local/bin/rocketeer

Initialize deployment folder (Deployment server)

rocketeer ignite

Configure .rocketeer/config.php (Deployment server)

  1. Set the application_name. In my case, I have set the application name as example. This will be the name of the folder your application gets deployed to on the web server. (If you want the application deployed in a different directory, you can change the app_directory value in remote.php)
  2. Configure the connections array. (Production, Staging, QA, etc)

Configure .rocketeer/remote.php (Deployment server)

  1. Set the root_directory variable. This is the parent path of your application (Example: /var/www/)
  2. Under the permissions section, change www-data:www-data to apache:apache.

Configure .rocketeer/scm.php (Deployment server)

  1. Set scm variable to svn (SVN is used in this example, but you can use git).
  2. Set your repository path. Example: https://github.com/tullyrankin/example (add .git to the end of the URL when using git)
  3. If we are doing SVN as the scm, the branch value needs to be empty.
  4. If we are doing SVN the submodules value should be set to false.

Set-up the folder structure needed for the application (Deployment server)

rocketeer setup

Run a check to make sure everything is working

rocketeer check

If no errors were reported, you can now deploy the application

rocketeer deploy

After a few releases you may run into a bad release and need to rollback. In this case use the following command. (Deployment server)

rocketeer rollback