Code Monkey home page Code Monkey logo

deployer's Introduction

Build Status

Introduction

There are a lot of deployment tools, even in php. But none of them are simple and functional like Deployer.

Here is simple example of deployment script (deploy.php):

require 'deployer.phar';

task('prod_server', function () {
    connect('prod.ssh.domain.com', 'user');
});

task('test_server', function () {
    connect('test.ssh.domain.com', 'user');
});

task('upload', function () {
    upload(__DIR__, '/home/domain.com');
});

task('clear', function () {
    run('php bin/clear');
});

task('prod', 'Deploy on production.', ['prod_server', 'upload', 'clear']);
task('test', 'Deploy on test server.', ['test_server', 'upload', 'clear']);

start();

Now you can run php deploy.php prod command to deploy on production server.

Here you can see Symfony deployment example script.

Requirements

Deployer is only supported on PHP 5.3.3 and up.

Installation

You can download deployer as phar archive or you can use composer:

"require": {
    "elfet/deployer": "dev-master@dev"
}

If you use phar version, simple require it in your script:

require 'deployer.phar';

If your use composer version, require your autoload file and call deployer function.

require 'vendor/autoload.php';
deployer();

Development

This project is still in development. I want to invite developers to join the development.

There are a lot of things needs to be implemented:

  • Add rsync support if available.
  • Add pecl ss2 extension support if available.
  • Write better documentation and tests.

Documentation

task(name, [description], callback)
  • name - required, you can run tasks from CLI.
  • description - optional, describe your task. If false this task will be private and does not available from CLI.
  • callback - closure or array of tasks.
connect(server, user, key, group = null)

Connect to server, login as user with key which is password or RSA key and add to group.

rsa(path, [password])

Can be used as key in connect function with path to your RSA key (~/.ssh/id_rsa) and password of your key.

cd(path)

Change remote directory to given path.

upload(from, to)

Upload local files or directories from to remote to.

ignore(array)

Ignore this files while uploading directories. array of string with * patterns.

run(command)

Run command in directory provided by cd function.

runLocally(command)

Run command locally.

writeln(message)
write(message)

Write message with/without new line.

group(group_name, function () {
    // run, cd, upload and ext commands
})

Run commands run, cd, upload only for group connections.

If your do not want include functions, you can use methods:

$tool = deployer(false);

$tool->task('connect', function () use ($tool) {
    $tool->connect('ssh.domain.com', 'user', 'password');
});

Every function is alias to Deployer\Tool methods.

License

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

deployer's People

Contributors

muxx 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.