2017 © Pedro Peláez
 

library phpdeploy

full php deployment tool to automate code deployment on multiple hosts/env

image

alwex/phpdeploy

full php deployment tool to automate code deployment on multiple hosts/env

  • Wednesday, July 20, 2016
  • by alwex
  • Repository
  • 3 Watchers
  • 1 Stars
  • 215 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 33 Versions
  • 1 % Grown

The README.md

php-deploy

Packagist, (*1)

php-deploy is a full php deployment tool designed to allow very common OR very specific tasks. It's main philosophy is to chain commands as described in a simple configuration file, commands are easily extensible and highly customizable., (*2)

Installation using composer

If you use composer you can easily use it on your project. The main binary file will be available on your binary path bin/pdeploy and ready to use., (*3)

composer require alwex/phpdeploy, (*4)

Initiating the project

To use php-deploy you have to initialize your project. Some directory and basic configuration files will be created under the .php-deploy directory located in the root of your project., (*5)

bin/pdeploy config:init myproject, (*6)

  • .php-deploy/config.ini -> the main configuration file which describe the global project configuration
  • .php-deploy/environments -> environment configuration files goes here
  • .php-deploy/Command -> you put your custom commands here

You may want to modify the config.ini file, (*7)

Adding some environments

In order to add environments simply type, (*8)

bin/pdeploy config:addenv production, (*9)

Environment file example:, (*10)

# user used for all remote commands
login=mySshLogin

# directory where the project is located
# relatively to the path where you execute
# bin/pdeploy
fromDirectory = ./
# remote or local path where to deploy
# the application
toDirectory = /var/www
# list of hosts where to deploy the app
hosts[] = 'localhost'
hosts[] = 'web1'
hosts[] = 'web2'
# ...
# name of the symlink allowing
# multiple apps in the same path
symlink = current-php-deploy

[deploy]
# PRE TASK
# executed before task
# usually vcs export and build
# of the package to deploy
preTask[] = Deploy\Command\GitExport
preTask[] = Deploy\Command\ComposerInstall
preTask[] = Deploy\Command\TarGz
# deployment stage executed against
# each hosts
onTask[] = Deploy\Command\Scp
onTask[] = Deploy\Command\UnTarGz
# post deployment stage executed
# on each hosts, usually cache clear,
# apache reload and symlink generation
# after this stage, deployment is done!
postTask[] = Deploy\Command\Symlink
# after tasks executed one time only
afterTask[] = ExampleCommand # custom comand

[mytask]
# PRE TASK
preTask[] = Deploy\Command\Symlink
# ON TASK
onTask[] = Deploy\Command\Symlink
# POST TASK
postTask[] = Deploy\Command\Symlink
# AFTER TASK
afterTask[] = Deploy\Command\Symlink

# ... and so on as many tasks as necessary

Executing a task

Once you have defined the tasks on the environment ini files, you can simply run them with, (*11)

bin/pdeploy task:run --release=0.0.1 --env=production mytask, (*12)

Creating custom commands

To add custom commands, simply add it as php classes on the folder .php-deploy/Command, you can duplicate the ExampleCommand.php to start. Just add this custom command to a task like for example, (*13)

afterTask[] = ExampleCommand, (*14)

ExampleCommand content:, (*15)

class ExampleCommand extends \Deploy\Command\AbstractCommand {

    /**
     * optionally you may check if all the
     * requirement are met before running
     * the command
     *
     * @throw \RuntimeException
     */
    public function beforeRun() {

        if (file_exists("/tmp/hello.txt")) {
            throw new \RuntimeException("hello file already exists");
        }
    }

    /**
     * execute command and php tasks
     * return the execution status as an integer
     *
     * @return void
     */
    public function run()
    {
        $command = "echo hello > /tmp/hello.txt";
        $this->shellExec($command);
    }

    /**
     * optionally you may check if the command has been
     * correctly done
     *
     * @throw \RuntimeException
     */
    public function afterRun() {

        $expectedValue = 'hello';
        $fileContent = file_get_contents("/tmp/hello.txt");

        if ($fileContent != $expectedValue) {
            throw new \RuntimeException("hello file does not contain expected value '$expectedValue', found '$fileContent'");
        }
    }
}

The Versions

20/07 2016

dev-master

9999999-dev

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

17/03 2015

dev-stable

dev-stable

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

17/03 2015

v1.5.9

1.5.9.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

17/03 2015

v1.5.8

1.5.8.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

17/03 2015

v1.5.7

1.5.7.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/03 2015

v1.5.6

1.5.6.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/03 2015

v1.5.5

1.5.5.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/03 2015

v1.5.4

1.5.4.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/03 2015

v1.5.3

1.5.3.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/03 2015

v1.5.2

1.5.2.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/03 2015

v1.5.1

1.5.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/03 2015

v1.5.0

1.5.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

10/03 2015

v1.4.5

1.4.5.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

10/03 2015

v1.4.4

1.4.4.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

10/03 2015

v1.4.3

1.4.3.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

10/03 2015

v1.4.2

1.4.2.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

09/03 2015

v1.4.1

1.4.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

09/03 2015

v1.4.0

1.4.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

05/03 2015

1.2.0

1.2.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

05/03 2015

v1.3.0

1.3.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

03/03 2015

1.1.1

1.1.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

03/03 2015

1.1.0

1.1.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

18/02 2015

1.0.3

1.0.3.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

18/02 2015

1.0.2

1.0.2.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

18/02 2015

1.0.1

1.0.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

17/02 2015

1.0.0

1.0.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

15/02 2015

0.1.3

0.1.3.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/02 2015

0.1.2

0.1.2.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/02 2015

0.1.1

0.1.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/02 2015

dev-free_actions

dev-free_actions

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

13/02 2015

0.1.0

0.1.0.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/02 2015

0.0.2

0.0.2.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET

11/02 2015

0.0.1

0.0.1.0

full php deployment tool to automate code deployment on multiple hosts/env

  Sources   Download

The Requires

 

The Development Requires

by Alexandre GUIDET