Git Product home page Git Product logo

plumber's Introduction

Plumber

Build Status

An object oriented deployer library. This library is heavily inspired by the Plum library, but I've tried a different approach.

Installation and configuration

Plumber follows the PSR-0 convention, so you can use Composer autoloader.

// Options. Here you can define which unix commands you want to execute in the server
$options = array(
    'dry_run' => true, // Optional: Default to false. If set to true, Rsync will run as dry-run mode, which only shows the output but doesn't deploy anything
    'rsync_exclude' => 'excludes.txt', // Optional. File used by rsync to exclude files.
    'rsync_options' => '-az', // Optional: Default to "-azC --force --delete --progress". You can overwrite the default rsync parameters and use your own arguments
    'commands' => array( // Optional. Commands to execute in the server being deployed. The commands'll be executed in the path defined by the server
        'php app/console doctrine:schema:create',
        'php app/console cache:warmup'
    )
);

// Set up
$deployer               = new \Plumber\Deployer\RsyncDeployer();
$ssh_command_executer   = new \Plumber\Server\SshCommandExecuter( new \Plumber\Server\SshConnection() );
$plumber = new \Plumber\Plumber( $deployer, $ssh_command_executer );

// Add your server
$plumber->addServer( 'production', new \Plumber\Server\Server( 'your_server_ip_or_hostname', 'username', '/path/to/my/website' ) );
$plumber->addServer( 'dev', new \Plumber\Server\Server( 'your_server_ip_or_hostname', 'username', '/path/to/my/website' ) );

// Let's go!
$plumber->deploy( 'production', $options );
$plumber->deploy( 'dev', $options );

If you prefer to deploy using git pull, instead of using rsync, you can use the dummy rsync deployer. The following code would connect to the server that you define, and execute three commands there.

// Options. Here you can define which unix commands you want to execute in the server
$options = array(
    'commands' => array( // Commands to execute in the server being deployed
        'git pull',
        'rm -rf cache/',
        'php app/console assetic:dump --env=prod --no-debug'
    )
);

// Set up
$no_rsync_deployer      = new \Plumber\Deployer\NoRsyncDeployer();
$ssh_command_executer   = new \Plumber\Server\SshCommandExecuter( new \Plumber\Server\SshConnection() );
$plumber = new \Plumber\Plumber( $no_rsync_deployer, $ssh_command_executer );

// Add your server
$plumber->addServer( 'prod', new \Plumber\Server\Server( 'your_server_ip_or_hostname', 'username', '/path/to/my/website' ) );

// Let's go!
$plumber->deploy( 'prod', $options );

plumber's People

Contributors

fiunchinho avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.