Giter Club home page Giter Club logo

deployer's Introduction

Deployer Logo Deployer

The PHP deployment tool with support for popular frameworks out of the box.



Deployer Screenshot


Build Status Latest Stable Version License

See deployer.org for more information and documentation.

Features

  • Automatic server provisioning.
  • Zero downtime deployments.
  • Ready to use recipes for most frameworks.

Additional resources

License

MIT

deployer's People

Contributors

amayer5125 avatar antonmedv avatar barryvdh avatar benoitchantre avatar bsacharski avatar clxmstaab avatar dechristo avatar dependabot[bot] avatar fagai avatar kennedytedesco avatar lorisleiva avatar lucasmezencio avatar lucasmichot avatar mbrodala avatar mikeymike avatar mkuznetsov4xxi avatar muxx avatar nicodmf avatar nofutur3 avatar oanhnn avatar peterjaap avatar schrank avatar sergiocarracedo avatar staabm avatar tomzx avatar ulrichthomasgabor avatar vanquang9387 avatar vinpel avatar zeecoder avatar zhukv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deployer's Issues

Default deploy task for common recipe

What do you think about to create default deploy task for common recipe similar to http://deployer.in/#symfony-recipe for non symfony oriented projects?

I spent additional time to figure out that there is no such default task.

Also tasks in symfony recipe should be prefixed accordingly like symfony:assets and so on.

Deploying Using FTP

Although I have read the docs twice I still can't figure it how deploy using ftp server , could your please help in that ?

Ignore files

Hello, I'm trying to use deployer but I have an issue with the ignore command.
This is my list of files to ignore
ignore([
'deployment',
'cache/',
'log/
',
'nbproject',
'sessions/operator/',
'sessions/webapp/
',
'sessions/driverAPI/',
'sessions/driver/
',
'sessions/mobile/*',
]);

But if I do this it ignore the entire folder for cache, log and sessions, instead of ignoring only their content.

Also if I just say ignore([ 'log' ]) it will ignore any folder with the name log in my project not just the one in root.

[after every '/' is a * but github editor seems to remove them or at least I don't see them in my browser]

Comparison to Magallanes deploy tool

As many devs do, I'm searching for PHP replacement of Capistrano to be more consistent. Deployer seems pretty thin and clear. BTW there is another tool http://magephp.com/. So far one feature from it seems to me important: YAML configuration. Such language agnostic way makes life easier to non-php-dev users. I understand that Deployer API is very light to be used directly.

Also it's not documented how can be used different environment configs. In Magallanes it's more clear

.mage/config - the main general.yml configuration file is stored here.
.mage/config/environments - the environments configuration files are here.
.mage/logs - logs (if enabled) are saved there.
.mage/tasks - and custom tasks are stored over here.

Problem reading Bitbucket private repository

I'm trying to deploy using a private Bitbucket repository. I've set Git access via SSH as instructed at Bitbucket https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

When I try to deploy it gives me:

[RuntimeException]                                   
Permission denied (publickey).                       
fatal: Could not read from remote repository.        
Please make sure you have the correct access rights  
and the repository exists.

Which means it connects succesfully to the server but it cannot access the remote repo. It's weird because I try to clone my repo manually and it works fine.

Release Schedule

As I understand @Elfet is preparing for a v3 relase, which is great, but the timing is unknown.
I also think that having a more more stable release schedule, would allow new features to become available to the general public.

If we take the Symfony Release Process especially the rationale, although it is overkill for this project, we can reuse some parts of it. For example:

  • Major releases can be released at any random time, especially because of having BC breaks
  • Minor releases are good for releasing new features, e.g.: which could happen on a monthly basis)
  • Patch releases are awesome to fix bugs.

Also considering other console based applications, such as composer, although it has some beta releases, when updating composer it always updates itself to the latest master version, which is perfect to roll out features.

I propose we start a discussion about this.

Git - throw Runtime exception while still run commands correctly on remote server

Hello,

I do the following task

task('git:update', function() {
  run('git fetch');
  run('git checkout master-dev');
  run('git pull origin');
});

Then I run the task on console (win 8, powershell). I've got the following message under the console

If you want to rollback run "rollback" task



  [RuntimeException]
  Switched to branch 'master-dev'



git:update [--dry-run] [--server[="..."]] [stage]

I checked the the server and it was run correctly.
Please let me know if it is a bug or somethings

Rgs,
Cheers
Phuc

Proper way to use AWS .pem file?

Hi, I'm trying to test a deployment with ssh + git, but I cannot figure out the proper way to use my .pem private key that lets me SSH into AWS instances. This is normally done with ssh -i key.pem or similar. I've tried setting is as both a public and a private key, to no avail. Also it seems that deployer is not properly recognizing the fact that phpseclib is failing in this case.

PHP Fatal error: Cannot access private property

Hi,

I just found your repository and play a bit with deployer.

However I have this error when I run php deploy.php install

PHP Fatal error:  Cannot access private property Deployer\Tool::$tasks in /Users/william/my_app/vendor/elfet/deployer/src/Deployer/Tool.php on line 72

Console launch get error

Hi,

I am trying to test this script but i get an issue (all the team get the same issue in the office):
I've follow your very simple doc and I get this message when I launch cmd :
[InvalidArgumentException] Command "prod" is not defined.

Usually we didnot have problem with symfony/console on our symfony project.

Is there a special step for windows (seven) we miss ?

Thanks

Shared folders in bash

Hi there!

First of all, thanks for this awesome toolkit! It really rocks :)

My production server has bash console. There is an issue with deleting shared folders in codebase. Somewhy bash does not expand "~" in the following command:

cd ~/webroot/production && if [ -d "~/webroot/production/releases/2014072705721/core/modules/error/media" ]; then rm -rf ~/webroot/production/releases/2014072705721/core/modules/error/media; fi

and does not delete the directory (so symlink does not work).
After googling I've found this: http://stackoverflow.com/questions/1685894/home-directory-expansion-within-an-argument

So I've changed the expression to this

if [ -d $(echo ~/webroot/production/releases/2014072705721/core/modules/error/media) ]; then echo 'exists'; fi

and it worked as expected.

Documentation not working

Hi,

Looks like the documentation page isn't working any more. The navigation on the left won't redirect me to another page on Chrome and Safari on Mac. It links for example to '/#examples'.

Hope you can fix this, so I can read a bit more about this awesome tool :-)

Thanks!
Jeroen.

Specifying a branch for deploy

I just been trying out the ability to specify a different branch for each stage as documented here: http://deployer.in/stages.html

I just checked out the master branch even though I configured the develop branch. It doesn't seem to do anything with the "branch" option you set in the deployer. I searched for term branch and got no results. Is this something that has not yet been implemented?

Availible comands

I install deployer through composer:
composer require elfet/deployer:~1.0
after that I call
vendor/bin/dep

and there are only 3 availible options (help, list, self-update)
When call:
dep deploy
Error is Command "deploy" not exists...

dry-run option doesn't share env()

Every task is executed with its own Environment when running with --dry-run, this makes it impossible to share env() variables between tasks.

(working on pull request)

php-amend can not be downloaded

Trying to run composer install will produce this error message:

Multistaging

Is it possible to deploy multiple stages to multiple environments easily, like it's done with capistrano (cap staging deploy / cap production deploy)?

I'd like to deploy my staging git branch to another server then my master branch. Only this branch and the server settings need to be different.

No compatible server to client encryption algorithms found

Got this error yesterday on my first try with deployer:

PHP Notice: No compatible server to client encryption algorithms found in ...../vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 1127

I got it fixed by updating vendors and rebuilding PHAR archive.

Hope this can help :)

Permissions on Remote Server

Hey there!

I'm still trying to determine what permissions are needed on the remote server for using deployer?

The user I'm using is fo, and the user Nginx uses is the standard www-data. When everything deployed, checking the permissions it's fo:fo, but shouldn't it be fo:www-data? I've added the user fo to the www-data group. I just get a forbidden error when trying to access the site after deploying.

Any help is appreciated! Thanks!

[Suggestion] Use of static properties makes it difficult to write self-contained tests

The use of many static variables makes it difficult to write extensive tests for complicated scenarios or functionality or single functions

Suggest to change to a more test friendly

functions.php: use Deployer::get() to get the current instance

Deployer::$servers => Deployer::get()->servers();
Deployer::$servers['main'] => Deployer::get()->servers('main');

classes: the Deployer is needed in a few classes, so injecting it through the constructor would allow it to be mocked.

class RunTaskCommand extends BaseCommand
{
    ...
    protected $deployer;

    public function __construct($name, Deployer $deployer, TaskInterface $task)
    {
        ....
    }
}

Display version in 1.1.2

  1. There is no deployer.php in root
  2. $ vendor/bin/dep
  3. Console displays Deployer version __VERSION__

How to deploy via rsync or copy?

On your website you make the following statement:
Deploy your code to all servers you want, it supports deploy via copy, or via VCS (like git), or via rsync.

However, I am unable to see how exactly one would deploy via "copy" or rsync. It is unclear from the documentation or from the source code.

Could you please give an example deploy.php file showing how this can be done? Or does one have to write the custom tasks running all the appropriate rsync or "copy" commands?

The writable_dirs task makes files also writable

https://github.com/elfet/deployer/blob/master/recipe/common.php#L138

I think there should be distinction like we have with shared_dirs / shared_files.

Probably more intelligent way is to get rid of such difference and have only one shared option witch will able to guess is given argument a file or a directory.

set('shared', ['app/logs/', 'app/config/parameters.yml']);
set('writable', ['app/logs/', 'app/logs/*', 'app/public/whatever']);

Slash at the end treated as directory, file otherwise. Asterisk explicitly says that it is recursive.

upload of dotfiles

I just tested out deployer with some sample data and I found that it does not upload any dotfiles (.htaccess ...).
On the on side of course it's good, because no gitfiles (.git, .gitignore) are pushed to the webroot but as I mentioned files like .htaccess are not uploaded. Could there be an implementation to support this?

task(name, shellCommand) & alias(name, alias)

Possible to run simple shell commands directly without creating callback.

task(name, shellCommand)

example:
task('deploy:cache:warmup','php %releasepath%/app/console assetic:dump --env=%env% --no-debug')

This would automatically provide some default behaviour for a task, and could replace many simple tasks.

The current functionality for ReferenceTask could be removed to an alias function

function alias($name, $alias) {
    Deployer::$tasks[$name] = new ReferenceTask(Deployer::$tasks[$alias]);
}

Drop PHP 5.4 support?

I'm thinking to drop support for PHP 5.4 for Deployer 3. And start with 5.5.

What do you think? ✌️

connection problem ?

patie@iMac27:~/www/clients/xxx/project$ dep deploy

Preparing server for deploy.................................Password: 
If you want to rollback run "rollback" task



  [RuntimeException]      
  Illegal variable name.  

Exception trace:
 () at phar:///usr/local/bin/dep/vendor/elfet/php-ssh/src/Ssh/Exec.php:28
 Ssh\Exec->run() at phar:///usr/local/bin/dep/src/Server/Ssh2.php:94
 Deployer\Server\Ssh2->run() at phar:///usr/local/bin/dep/src/functions.php:115
 run() at phar:///usr/local/bin/dep/recipe/common.php:37
 {closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/dep/src/Task/Runner.php:45
 Deployer\Task\Runner->run() at phar:///usr/local/bin/dep/src/Console/RunTaskCommand.php:168
 Deployer\Console\RunTaskCommand->runSeries() at phar:///usr/local/bin/dep/src/Console/RunTaskCommand.php:118
 Deployer\Console\RunTaskCommand->execute() at phar:///usr/local/bin/dep/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/dep/vendor/symfony/console/Symfony/Component/Console/Application.php:887
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/dep/vendor/symfony/console/Symfony/Component/Console/Application.php:124
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/dep/src/Deployer.php:114
 Deployer\Deployer->run() at phar:///usr/local/bin/dep/bin/dep:51
 require() at /usr/local/bin/dep:4


deploy [--dry-run] [--server[="..."]] [stage]

in deploy i have only this (but tried also other ways) :

<?php
require 'recipe/symfony.php';

server('main', '1.1.1.1')
    ->path('/home/html/project/public_html/')
    ->user('patie');

set('repository', '[email protected]:xxx/project.git');

ip, path and repository are of course other in my deploy.php, there is other problem

im on latest OSX, PHP 5.4.16 (cli)

any idea where is problem ?

Abstract base deployment recipe

I'm sure this was built with with Symfony in mind (heck its built using Symfony components), but to make is easier for people to adapt this to other frameworks could the most basic deployment steps like prepare, symlink, and rollback be in a separate recipe and then layer Symfony specifics on top of that?

For a freeform project instead of require 'recipe/symfony.php'; you could just require 'recipe/basic.php'; and get the meat and potatoes of the tool.

If you ever plan on shipping more default recipes for other frameworks this could also help cut down on duplication, since everything will leverage the basics, but each framework will handle assets and caches differently.

Non resolvable dependency in 1.1.2

{
    "require": {
        "elfet/deployer": "1.1.2"
    }
}

Your requirements could not be resolved to an installable set of packages.

Problem 1
- elfet/php-ssh v1.0.0 requires ext-ssh2 * -> the requested PHP extension ssh2 is missing from your system.
- elfet/deployer v1.1.2 requires elfet/php-ssh ~1.0 -> satisfiable by elfet/php-ssh[v1.0.0].
- Installation request for elfet/deployer 1.1.2 -> satisfiable by elfet/deployer[v1.1.2].

Run task only once

Hi,

Would it be hard to implement a special task that runs only on one server (last one). Let's say i'm deploying application to 10 servers ... and want to run a task after all the servers are deployed. The task should run on last server in the queue.

I need to clear some remote cache server (throught an api call) and running it on all servers seems like a bad solution.

The easiest solution would be to add some kind of env variable that I could check by config()->lastServer() and run a task only if this returns true.

Best regards,
Pawel

Parameters with escaping for run command

One more enhancement ;)

runWithParameters('some.sh --param=? || anything_else ?', ['foo', 'zoo']);

Should be converted to

run('some.sh --param=`foo` || anything_else `zoo`');

phpseclib notice doesn't halt deploy process

$ vendor/bin/dep deploy
Preparing server for deploy.................................
Notice: No compatible server to client encryption algorithms found in /var/www/project/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 1257
✔
Updating code...............................................✔
Creating cache dir..........................................✔
Creating symlinks for shared files..........................✔
Make writeable dirs.........................................✔
Normalizing asset timestamps................................✔
Installing vendors..........................................✔
Dumping assets..............................................✔
Migrating database..........................................✔
Warming up cache............................................✔
Creating symlink to release.................................✔
Cleaning up old releases....................................✔
Successfully deployed on xx.xx.xx.xx

Seems Deployer successfully finished but there is nothing on destination server.

Argument to specify deploy file

Hello,

It would be interesting to be able to specify the deploy file as an argument to the "dep deploy" command, for example with "dep deploy --file acme.php".

I'd like it so I wouldn't put a deploy.php file in every project but have all centralized.

jmsche

Allow overwriting tasks

I'm using the symfony recipe but would like to change one of the tasks. The way the recipe is written means there's no way of changing that task without needing to rewrite the whole recipe.

Available commands

I install deployer through composer:
composer require elfet/deployer:~1.0
after that I call
vendor/bin/dep

and there are only 3 availible options (help, list, self-update)
When call:
dep deploy
Error is Command "deploy" not exists...

Forwarding agent

In my case I have different ssh keys on my deploy host and my git repository. For that I use "forward_agent" option in ruby lib "net-ssh".

I have researched that and unfortunately found that libssh2 and therefore "pecl_ssh2" don't support forwarding agent. Only it prevents me to use "deployer" in my projects.

@Elfet Do you have any ideas how to bypass it?

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.