Giter Club home page Giter Club logo

recipes's People

Contributors

amitchotaliya avatar antonmedv avatar asafov avatar beeete2 avatar big-shark avatar endelwar avatar fdemiramon avatar gamesh avatar glensc avatar gordalina avatar joepsyko avatar johnny-bit avatar kasperg avatar kbsali avatar ketchoop avatar lucasmezencio avatar marmotz avatar mattbyers avatar mattheworres avatar mbrodala avatar neikei avatar panychek avatar petermein avatar razseo avatar snowiow avatar steefmin avatar tomaj avatar torvitas avatar trsteel88 avatar xethron 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

recipes's Issues

phinx recipe does not work under PHP 7+

The closuritis suffers from backward incompatible changes, see

http://php.net/manual/en/migration70.incompatible.php
"Changes to the handling of indirect variables, properties, and methods"

PHP Warning:  Missing argument 1 for Deployer\{closure}() in vendor/deployer/recipes/phinx.php on line 69
PHP Warning:  Missing argument 2 for Deployer\{closure}() in vendor/deployer/recipes/phinx.php on line 69
PHP Notice:  Undefined variable: cmdName in vendor/deployer/recipes/phinx.php on line 72
PHP Notice:  Undefined variable: conf in vendor/deployer/recipes/phinx.php on line 76
PHP Warning:  Invalid argument supplied for foreach() in vendor/deployer/recipes/phinx.php on line 76
PHP Fatal error:  Uncaught Error: Call to undefined function /var/www/html/daniel/releases/21/vendor/robmorgan/phinx/bin/phinx () in vendor/deployer/recipes/phinx.php:126
Stack trace:
#0 [internal function]: Deployer\{closure}()
#1 phar:///usr/local/bin/dep/src/Task/Task.php(91): call_user_func(Object(Closure))
#2 phar:///usr/local/bin/dep/src/Executor/SeriesExecutor.php(40): Deployer\Task\Task->run(Object(Deployer\Task\Context))
#3 phar:///usr/local/bin/dep/src/Console/TaskCommand.php(79): Deployer\Executor\SeriesExecutor->run(Array, Array, Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Deployer\Console\Output\OutputWatcher))
#4 phar:///usr/local/bin/dep/vendor/symfony/console/Command/Command.php(256): Deployer\Console\TaskCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 phar:///usr/local/bin/dep/vendor/symfony/console/Application.php(820): Symfony\Component\Console\Command\Command->run(Object(Symfony\C in vendor/deployer/recipes/phinx.php 

slack recipe depends on stages

given common config

$ deployer.phar init -t Common
Successfully created: deploy.php
$ composer require --dev deployer/recipes

the slack notifier throws exception:

                                                     
  [RuntimeException]                                 
  Configuration parameter `stages` does not exists.  
                                                     

Deprecate local recipe

Now local recipe is a copy of common recipe with replaced run calls by runLocally calls.
I would like to leave only one copy of those recipes – common.

To do so, in Deployer v5 was introduced task(...)->local() api.

@johnny-bit @nickdenardis let's talk about it.

For example, to make a task local:

task('deploy:update_code')->local();

task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'deploy:update_code',
    'deploy:vendors',
    'deploy:symlink',
]);

But now it will not work, because localhost created inside SeriesExecutor and you can't set proper deploy_path for it.

Maybe to solve it lets run all local tasks on first localhost if deployer->hosts? Then this will be possible:

localhost()->set('deploy_path', '/some/build/path');

Main goal to achieve easily configuration of tasks.

For example. Simple recipe there deploy process split into two phases: build and deploy:

task('build', [
    'deploy:update_code',
    'deploy:vendors',
    'yarn:install',
    'npm:build',
    'deploy:clear_paths',
])->local();

task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'rsync',
    'deploy:shared',
    'deploy:writable',
    'deploy:symlink',
    'cleanup',
    'success'
]);

before('deploy', 'build');

But now it does not work, group tasks doesn't supports become local. (what to do if one task persists in two groups: one local, one remote?)

So, what I propose to do:

  • Run all local() task on first defined localhost()
  • Allow group task to become local
  • Check all common task if they can be ran locally and what config they require

Can't set channel for Slack recipe?

Q A
Issue Type Question

Description

Looking at older versions of the Slack recipe you could set channel and custom title etc, but they seem to be removed. Am I missing something?

$php_errormsg getting deprecated

Q A
Issue Type Bug
Deployer Version N/A
Recipes Version master branch
Local Machine OS N/A
Remote Machine OS N/A

Description

The $php_errormsg global variable will be deprecated on the next PHP version (7.2). It should be replaced with error_get_last() on bugsnag recipe.

Steps to reproduce

Content of deploy.php

CONTENT

Output log

With enabled option for verbose output -vvv.

race condition in local recipe?

I think concurrent builds (for example on a CI-/CD-Server) are potentially having bad side effects due to the fact that the local recipe uses a fixed path '/tmp/deployer' as local_deploy_path.

Using mktemp or another way to ensure working in a uniqe directory would make the local recipe more robust for concurrent runs.

On the other hand I am not sure yet on the main purpose or usage scenario for the local recipe.

Anyway this matter might be worth a discussion or hint inside the documentation.

I am open and interested on your opinions.

Deployer The command "/usr/bin/php /var/www/html/.../artisan --version" failed.

| Q
| Issue Type | Question
| Deployer Version | 6.0.3
| Recipes Version | N/A
| Local Machine OS | MacOS Sierra High
| Remote Machine OS | Ubuntu

Description

I am trying to deploy to a machine, that worked like a charm yesterday. I don't recall changing anything, but it throws an error:

The command "/usr/bin/php /var/www/html/..../artisan --version" failed.
with Exit Code: 1 (General error)

Output log

With enabled option for verbose output -vvv.
In Client.php line 96:

[Deployer\Exception\RuntimeException (1)]
The command "/usr/bin/php /var/www/html/projectname.com/releases/1/artisan --version" failed.

Exit Code: 1 (General error)

Host Name: projectname.com

================

Exception trace:
Deployer\Ssh\Client->run() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/functions.php:292
Deployer\run() at /Users/mac/Code/projectname/vendor/deployer/deployer/recipe/laravel.php:39
Deployer\Deployer::Deployer{closure}() at n/a:n/a
call_user_func() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Configuration/Configuration.php:87
Deployer\Configuration\Configuration->get() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/functions.php:526
Deployer\get() at /Users/mac/Code/projectname/vendor/deployer/deployer/recipe/laravel.php:124
Deployer\Deployer::Deployer{closure}() at n/a:n/a
call_user_func() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Task/Task.php:104
Deployer\Task\Task->run() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Executor/SeriesExecutor.php:63
Deployer\Executor\SeriesExecutor->run() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Console/TaskCommand.php:142
Deployer\Console\TaskCommand->execute() at /Users/mac/Code/projectname/vendor/symfony/console/Command/Command.php:252
Symfony\Component\Console\Command\Command->run() at /Users/mac/Code/projectname/vendor/symfony/console/Application.php:936
Symfony\Component\Console\Application->doRunCommand() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Console/Application.php:132
Deployer\Console\Application->doRunCommand() at /Users/mac/Code/projectname/vendor/symfony/console/Application.php:240
Symfony\Component\Console\Application->doRun() at /Users/mac/Code/projectname/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /Users/mac/Code/projectname/vendor/deployer/deployer/src/Deployer.php:324
Deployer\Deployer::run() at phar:///usr/local/bin/dep/bin/dep:119
require() at /usr/local/bin/dep:4

Thanks for any help, much appreciated!

Yarn recipe not released yet

Q A
Issue Type Question / Feature Request
Deployer Version 5.1.3
Recipes Version 4.0.7
Local Machine OS Ubuntu Linux
Remote Machine OS Ubuntu Linux

Description

The recipes version 4 does not include yarn recipe yet.

Steps to reproduce

Should it release a recipes v4 with the yarn recipe or a v5 one with the yarn recipe (as the deployer v5 is already released)

Content of deploy.php

CONTENT

Output log

With enabled option for verbose output -vvv.

Copy composer vendor folders

Hi,

I have created a task that checks if vendor folder exists to copy it to new release instead of downloading everything again. If you think that this is useful tell me and I ll do a pull request.

task('copy_vendors', function () {
    $current_vendors = env('deploy_path') . '/current/vendor';
    if(file_exists($current_vendors)) {
        run("cp -ar $current_vendors {{release_path}}");
    }
})->desc('Copy vendor folder if already exists');

Rollbar recipe

Q A
Issue Type Feature Request
Deployer Version N/A
Recipes Version N/A
Local Machine OS N/A
Remote Machine OS N/A

Rollbar's recipe would need some improvements due to their official documentation, which says:

  • rollbar_username is optional param, but required in Deployer. It requires totally useless & hardcoded data for every person in the project. This should be an optional parameter in Deployer too.
  • comment which is also optional, but Deployer forces default value such as _{{user}}_ deploying `{{branch}}` to *{{target}}* which is also totally useless and duplicates content in Rollbar panel. This parameter should be empty by default and optional.

What do you think?

Migration to 3.0

Are deployphp/recipes ready for Deployer 3.0? πŸ˜„ 🍻

Backport Phinx recipes to 3.x branch

Phinx recipe is available in the "latest" branch.

In a legacy project we are currently migrate, we have to use the v3 of Deployer and the recipe is not available.

Is it possible to backport the Phinx recipes in the 3.x branch ?

Posting multiple messages using recipes is currently impossible

Q A
Issue Type Question
Deployer Version 6+
Recipes Version 6+
Local Machine OS OSX
Remote Machine OS Vagrant/centos6

Description

Currently all recipes don't have the possibility to post/send multiple requests to 3rd party libraries. This is because:

  • Once() is used in the recipes;
  • Recipes don't handle array values;

Question

Why is that? The recipe i'm currently using is Slack and I want to post deployer messages to two channels. I can fork the recipe and allow an array value to be distributed but all other recipes don't work this way. I can refactor the recipe in my own project and allow this change but future upgrades will then be impossible.

What are your thoughts on this?

env "bin/composer" in local:vendors, run remotely

I want to report that the "bin/composer" common recipe functionality work remotely and this could be a constraint for local:vendors command execution.

I propose something like

/**
 * Get composer from local system
 */
env('bin/composer', function () {
    return runLocally('which composer')->toString();
});

Maybe could be useful to put it in doc or directly in local recipe. What your opinion on that ?

Slack recipe depends on the project being present

Hi,

I'm deploying the project from a server that contains only the deploy.php file, with the vendor folder. It does not have the entire project with its .git folder there, because it's not needed in our setup.

However, in that case, the slack recipe fails, because it reads data using git (like branch, user, revision and so on). I'm fine with not having that information in the slack message (just "deployed to stage xyz" is fine).

Could you make that information gathering optional somehow? Thanks!

slack ignores branch option

Hi, the main deployer recipes like update_code.php are also checking if the branch option is set. Is there a reason why the option is ignored in the slack recipe? Otherwise I would like to do a PR for this. Thanks in advance πŸ™‚

Phinx recipes

Hello

It seem that phinx recipe is not working anymore with deployer 4.0.

Combine phar installation with recipes

Q A
Issue Type Question
Deployer Version 6.0.3
Recipes Version 6.0
Local Machine OS OSX
Remote Machine OS Linux

Description

I installed Deployer as described here. Now I need the NPM recipe, which I installed via composer require to the project and require it in the deploy.php

Content of deploy.php

require 'recipe/typo3.php';
require 'recipe/npm.php';

...

after('deploy:update_code', 'npm:install');

Output log

Warning: require(recipe/npm.php): failed to open stream: No such file or directory in /Users/$user/Sites/example.com/dev/deploy.php on line 5

Call Stack:
    0.0007     364416   1. {main}() /usr/local/bin/dep:0
    0.0140     541544   2. require('phar:///usr/local/bin/dep/bin/dep') /usr/local/bin/dep:4
    0.0230    1354504   3. Deployer\Deployer::run() phar:///usr/local/bin/dep/bin/dep:119
    0.0362    2341184   4. call_user_func:{phar:///usr/local/bin/dep/src/Deployer.php:319}() phar:///usr/local/bin/dep/src/Deployer.php:319
    0.0362    2341184   5. Deployer\Deployer::Deployer\{closure}() phar:///usr/local/bin/dep/src/Deployer.php:319
    0.0432    2351440   6. require('/Users/$user/Sites/example.com/dev/deploy.php') phar:///usr/local/bin/dep/src/Deployer.php:318

How can I get this to work?

Recipes Do's and Don'ts

This issue comes from #10, where rsync (as an alternative deployment method) exposes and overwrites certain tasks and even the deploy task.

We can either allow a recipe to override tasks, which is much easier for the end-user which is just plug and play.
On the other hand, for custom deploy scripts, overriding tasks can become an issue, where end-users want a specific task but it is overridden by a recipe.
Also, it could be argued that different deployment methods (such as rsync) could be on deployer itself (rather than recipes). But this will suffer from the same issue (overriding tasks and the deploy process)

Currently all recipes expose tasks and on the documentation say how/where they should be added to the deploy process.

This is a major discussion as it will steer the 3rd party recipes and usage of these in the deployer project.

Comments are welcome @deployphp/maintainer @Elfet @johnny-bit

Slack recipe broken with PHP 5.6 since 4.0.6

Null coalescing operator is used in 93b6fb2. This is a PHP 7 only feature ie. breaks the recipe with PHP 5.6.

$ php --version
PHP 5.6.30 (cli) (built: Jan 19 2017 22:50:24) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
$ dep deploy
PHP Parse error:  syntax error, unexpected '?' in /vagrant/vendor/deployer/recipes/slack.php on line 108

Newrelic recipe triggers a Symfony style error

the code on line https://github.com/deployphp/recipes/blob/master/newrelic.php#L34
Triggers the following error:

 [ERROR] Symfony\Component\Console\Exception\InvalidArgumentException: Incorrectly nested style tag found. in        
         /home/muller/.config/composer/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php:87             
         Stack trace:                                                                                                
         #0 /home/muller/.config/composer/vendor/symfony/console/Formatter/OutputFormatter.php(185):                 
         Symfony\Component\Console\Formatter\OutputFormatterStyleStack->pop(Object(Symfony\Component\Console\Formatte
         r\OutputFormatterStyle))                                                                                    
         #1 /home/muller/.config/composer/vendor/symfony/console/Application.php(653):                               
         Symfony\Component\Console\Formatter\OutputFormatter->format('<error>  d'</in...')                           
         #2 /home/muller/.config/composer/vendor/symfony/console/Application.php(127):                               
         Symfony\Component\Console\Application->renderException(Object(RuntimeException),                            
         Object(Symfony\Component\Console\Output\StreamOutput))                                                      
         #3 /home/muller/.config/composer/vendor/deployer/deployer/src/Deployer.php(190):                            
         Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput),               
         Object(Symfony\Component\Console\Output\ConsoleOutput))                                                     
         #4 /home/muller/.config/composer/vendor/deployer/deployer/bin/dep(120): Deployer\Deployer->run()            
         #5 {main} 

This seems triggerd by the '=>' after application_id

Composer package not up-to-date

Q A
Issue Type Bug
Deployer Version 5.1.3
Recipes Version 4.0.7
Local Machine OS N/A
Remote Machine OS N/A

Description

If you download the current ZIP distribution via Composer and unzip it, the rsync recipe does not reflect the current code in the repository. It's still an older version wich will not work in Deployer 5.

Steps to reproduce

  • Download ZIP ball
  • Unzip the ZIP ball
  • compare source code for recipe "rsync" with the current version in the repository

Several issues in discord

Q A
Issue Type Bug
Deployer Version 6.2
Recipes Version 6.1
Local Machine OS Ubuntu 17.10
Remote Machine OS Debian GNU/Linux 8 (jessie)

Description

I'll just want to notify you that in the Discord recipe the namespace Deployer; statement is missing. Without that it comes to this error [Error] Call to undefined function set() . I think there was also some API changes? The callback gets called once cause of config cache for callbacks result? And the placeholders in the array doesn't got replaced.

Solution

I edited the discord file and came to the following solution. This solution fix all the above issues.

<?php
/* (c) Lucas MezΓͺncio <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Deployer;

use Deployer\Task\Context;
use Deployer\Utility\Httpie;

set('discord_webhook', function () {
    return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack';
});

// Deploy messages
set('discord_notify_text', ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_');
set('discord_success_text', ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully');
set('discord_failure_text', ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_');

set('discord_type', 'discord_notify_text');

// Helpers
task('discord_send_message', function(){
    Httpie::post(get('discord_webhook'))->body(['text' => get(get('discord_type'))])->send();
});

// Tasks
desc('Just notify your Discord channel with all messages, without deploying');
task('discord:test', function () {
    set('discord_type', 'discord_notify_text');
    invoke('discord_send_message');
    set('discord_type', 'discord_success_text');
    invoke('discord_send_message');
    set('discord_type', 'discord_failure_text');
    invoke('discord_send_message');
})
    ->once()
    ->shallow();

desc('Notify Discord');
task('discord:notify', function () {
    set('discord_type', 'discord_notify_text');
    invoke('discord_send_message');
})
    ->once()
    ->shallow()
    ->isPrivate();

desc('Notify Discord about deploy finish');
task('discord:notify:success', function () {
    set('discord_type', 'discord_success_text');
    invoke('discord_send_message');
})
    ->once()
    ->shallow()
    ->isPrivate();

desc('Notify Discord about deploy failure');
task('discord:notify:failure', function () {
    set('discord_type', 'discord_failure_text');
    invoke('discord_send_message');
})
    ->once()
    ->shallow()
    ->isPrivate();

slack:notify:failure

Q A
Issue Type Feature Request
Deployer Version 6.0.3
Recipes Version 6.0.1
Local Machine OS OSX
Remote Machine OS Linux

Description

Could be possible to include a slack notification for deployment error?

Slack recipe no_text exception with 4.0.6

I use the following config to get rid of the new style deployment messages.

set("slack", [
    "token" => "xoxp-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx",
    "team" => "Example",
    "app" => "example",
    "channel" => "#example",
    "message" => "{$user_data['name']} deployed [{{app_name}}:{{branch}}] on {{stage}} at ({{host}})",
    "unset_text" => false,
    "attachments" => null
]);

This works up 4.0.5. However starting from 4.0.6 it fails with no_text exception.

$ dep deploy
βœ” Executing task test
βœ” Executing task deploy:prepare
βœ” Executing task deploy:lock
βœ” Executing task deploy:release
βœ” Executing task deploy:update_code
βœ” Executing task deploy:shared
βœ” Executing task deploy:writable
βœ” Executing task deploy:vendors
βœ” Executing task deploy:clear_paths
βœ” Executing task deploy:symlink
βœ” Executing task deploy:unlock
βœ” Executing task cleanup
βœ” Executing task success
➀ Executing task deploy:slack
βœ” Executing task deploy:failed

                      
  [RuntimeException]  
  no_text             
                      

Broken recipes with Deployer 5.x

Q A
Issue Type Bug // Question
Deployer Version 5.x
Local Machine OS N/A
Remote Machine OS N/A

Description

This is likely more of a question than a bug.

With the changes in 5.x there is at least one recipe broken that I know of (rsync) ... should the master branch here be inline with the 5.x changes in deployer ?

Broken rsync is due to getServer call

local recipe does not support parallel deployments

It already fails on this line of code

runLocally("cd {{local_deploy_path}} && if [ -h release ]; then rm release; fi");

in the local:release task in local.php.

@Elfet What is the best way to support / handle parallel releases? Maybe I can come up with a PR.

Create recipes page on deployer.org

What about creating recipes page on deployer.org? Which will be automatically parse this repository and what main information about all recipes (task list, parameters, env vars, doc blocks). βž• search of recipes?

New Relic for remote deployment

The current newrelic.php script is written to run the git commands locally, but this will not work if you deploy your stuff on a remote server. I would prefer an autodetect, but I am not sure if this is possible.

Bug in rsync:warmup

When I deploy my project, the rsync:warmup task seems to be wrong:

...
[preprod] > tail -n 15 .dep/releases
[preprod] < 20161201113554,1
[preprod] < 20161201123207,2
...
[preprod] > echo '20161201140430,3' >> .dep/releases
[preprod] > mkdir /path/to/releases/3
...
➀ Executing task rsync:warmup
[preprod] > rsync -rlz --delete /path/to/releases/1/ /path/to/releases/2/

It tries to rsync release 1 to release 2 instead of release 2 to release 3

I think it's because you have just change release management, no ?

Telegram fail report task

Q A
Issue Type Feature Request
Deployer Version N/A
Recipes Version N/A
Local Machine OS N/A
Remote Machine OS N/A

Description

Telegram recipe needs fail report and documentation for this feature.

A simpler way for notifying chats?

The idea around these recipes is to make tedious tasks easier, and the idea around chat integration is to notify everyone on the team when someone is doing something to production.

The 5 steps that should go into a chatroom is: Starting deploy, Successful deploy, Failed deploy, Attempting Rollback, Successful Rollback.

We've had a custom setup for notifying Hipchat for the above stages. This was a simple 22 lines of code, everything in the deploy.php file. Now, using the recipe for Hipchat, the simplest solution I could find increases that to 32 lines of code, and that excludes the part doing the notification. This is what I've ended up with:

// Hipchat
set('hipchat_token', '##########');
set('hipchat_room_id', 'RoomId');
set('hipchat_url', 'https://our.internal.hipchat.url.com/v1/rooms/message');

task('hipchat:prepare', function() {
    set('hipchat_color', 'yellow');
    set('hipchat_message', 'STARTING: {{user}} started deploying {{application}} from {{branch}} to {{target}}');
});
before('deploy:prepare', 'hipchat:prepare');
after('hipchat:prepare', 'hipchat:notify');

task('hipchat:success', function() {
    set('hipchat_color', 'green');
    set('hipchat_message', 'SUCCESS: {{user}} successfully deployed {{application}} from {{branch}} to {{target}}');
});
after('success', 'hipchat:success');
after('hipchat:success', 'hipchat:notify');

task('hipchat:fail', function() {
    set('hipchat_color', 'red');
    set('hipchat_message', 'FAILED: {{user}} failed to deploy {{application}} from {{branch}} to {{target}}');
});
after('deploy:failed', 'hipchat:fail');
after('hipchat:fail', 'hipchat:notify');

task('hipchat:rolling-back', function() {
    set('hipchat_color', 'red');
    set('hipchat_message', 'ROLLING BACK: {{user}} is rolling back {{application}} on {{target}}');
});
before('rollback', 'hipchat:rolling-back');
after('hipchat:rolling-back', 'hipchat:notify');

task('hipchat:rolled-back', function() {
    set('hipchat_color', 'purple');
    set('hipchat_message', 'ROLLED BACK: {{user}} successfully rolled back {{application}} on {{target}}');
});
after('rollback', 'hipchat:rolled-back');
after('hipchat:rolled-back', 'hipchat:notify');

Am I missing something, or can we work together to find a way to make this simpler?

A few ideas I had was, allowing to set env vars when calling before/after:

before('deploy:prepare', 'hipchat:notify', [
    'hipchat_color' => 'green',
    'hipchat_message' => 'SUCCESS: {{user}} successfully deployed {{application}} from {{branch}} to {{target}}',
]);

Another idea is to setup these 5 functions in the recipe, with maybe an env var of: set('hipchat_notify_all');

Let me know what you think, will be happy to help implement these.

Namepace-error when recipes are used together with deployer 4.x

If the recipes are used together with the deployer branch 4.x deployments fail with the message "Uncaught Error: Call to undefined function env()"

The background is that deployer 4.x introduces the Deployer-namespaces in functions.php. The recipes have to be adjusted accordingly. For instance env() should become \Deployer\env(). Since this is not backwards compatible this should be done in a new branch.

Call to a member function desc() on null - local.php

The following example from local.php fails on the after function with the error Call to a member function desc() on null

set('local_release_path', '/tmp/my_application');

/**
 * Main task
 */
task('deploy', [
    'deploy:prepare',
    'deploy:release',
    'local:update_code',
    'local:vendors',
    'deploy:symlink',
    'cleanup',
])->desc('Deploy your project');

after('local:vendors', function() {
    upload(get('local_release_path'), get('release_path'));
})->desc('Upload local to remote');

Cachetool - use env instead of set/get

I think that the cachetool recipe should use env() instead of get() to load cachetool options. It is quite likely to have different fpm settings for different servers. For example: we have fpm on our staging server listening to localhost:9001 but the production server can run on a different port or use unix sockets.

I could prepare a PR - to keep the backwards compatibility the recipe would use the env() value and fallback to the get() value.

Rsync recipe doesn't use SSH multiplexing

Q A
Issue Type Bug
Deployer Version ^6
Recipes Version ^6
Local Machine OS N/A
Remote Machine OS N/A

Description

Rsync reciple does not take ssh multiplexing into account.

Steps to reproduce

Configure a multiplexing deployment with rsync recipe. Using verbose output you will be able to see that the ssh command does not use ControlPath

Content of deploy.php

Will attempt to supply if required, just tricky to pull out atm

Output log

Will attempt to supply if required, just tricky to pull out atm


I'm not entirely sure if this should be resolved here, I've previously overwrote the rsync task to include the multiplexing options but I feel that maybe the sshArguments object pulled from the host should also have the multiplexing configuration applied to it, so potentially a bug in deployer package instead.

I'm happy to look at putting together a PR to fix this given some consensus on where the fix should be

local recipe with rsync and multiple servers crash on 'local:update_code',

The output with error message:

➀ Executing task local:update_code
↳ on [api1]
Run locally: git version
> git version 2.7.4 (Apple Git-66)
Run locally: ls /tmp/my_app/releases
> 20160915104759
20160915104759.1
Run locally: readlink /tmp/my_app/release
> /tmp/my_app/releases/20160915104759.1
Run locally: git clone -b master --recursive -q --reference /tmp/my_app/releases/20160915104759 --dissociate [email protected]:..... /tmp/my_app/releases/20160915104759.1 2>&1
> fatal: reference repository '/tmp/my_app/releases/20160915104759' is not a local repository.
Run locally: git clone -b master --recursive -q [email protected]:... /tmp/my_app/releases/20160915104759.1 2>&1
β€’ done on [api1]
↳ on [api2]
Run locally: git version
> git version 2.7.4 (Apple Git-66)
Run locally: ls /tmp/my_app/releases
> 20160915104759
20160915104759.1
Run locally: readlink /tmp/my_app/release
> /tmp/my_app/releases/20160915104759.1
Run locally: git clone -b master --recursive -q --reference /tmp/my_app/releases/20160915104759 --dissociate [email protected]:... /tmp/my_app/releases/20160915104759.1 2>&1
> fatal: destination path '/tmp/my_app/releases/20160915104759.1' already exists and is not an empty directory.
Run locally: git clone -b master --recursive -q git@g.... /tmp/my_app/releases/20160915104759.1 2>&1
> fatal: destination path '/tmp/my_app/releases/20160915104759.1' already exists and is not an empty directory.


  [RuntimeException]  


Exception trace:
 () at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/src/functions.php:335
 runLocally() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployphp/recipes/recipes/local.php:116
 {closure}() at n/a:n/a
 call_user_func() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/src/Task/Task.php:79
 Deployer\Task\Task->run() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/src/Executor/SeriesExecutor.php:43
 Deployer\Executor\SeriesExecutor->run() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/src/Console/TaskCommand.php:82
 Deployer\Console\TaskCommand->execute() at /Users/pfroebel/Projects/Mail-Deployment/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /Users/pfroebel/Projects/Mail-Deployment/vendor/symfony/console/Application.php:818
 Symfony\Component\Console\Application->doRunCommand() at /Users/pfroebel/Projects/Mail-Deployment/vendor/symfony/console/Application.php:186
 Symfony\Component\Console\Application->doRun() at /Users/pfroebel/Projects/Mail-Deployment/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/src/Deployer.php:101
 Deployer\Deployer->run() at /Users/pfroebel/Projects/Mail-Deployment/vendor/deployer/deployer/bin/dep:64

deploy [-p|--parallel]

The deploy.php

<?php

require '../vendor/deployphp/recipes/recipes/local.php';
require '../vendor/deployphp/recipes/recipes/rsync.php';
require 'recipe/composer.php';

serverList('../servers.yml');

set('repository', '[email protected]:.........');

env('deploy_path', '/tmp/my_app/v2.0');
env('branch', 'master');

env('local_deploy_path', '/tmp/my_app');

env('rsync_src', function() {
    $local_src = env('local_release_path');
    if(is_callable($local_src)){
        $local_src = $local_src();
    }
    return $local_src;
});

task('deploy', [
    'local:prepare',
    'deploy:prepare',
    'local:release',
    'deploy:release',
    'rsync:warmup',
    'local:update_code',
    'local:vendors',
    'rsync',
    'local:symlink',
    'deploy:symlink',
    'cleanup',
    'local:cleanup'
])->desc('Deploy your project');


And the serverlist.yml

api1:
  host: server1
  user: webdev
  stage: production
  forward_agent: yes

api2:
  host: server2
  user: webdev
  stage: production
  forward_agent: yes

What is going wrong with the setup?

Greetings Philipp

Telegram undefined variable

Q A
Issue Type Bug, Question, Feature Request
Deployer Version N/A
Recipes Version N/A
Local Machine OS N/A
Remote Machine OS N/A

Description

If you're reporting a bug, please include following information
Dunno who wrote this, but it should be fixed:
HP Notice: Undefined variable: TELEGRAM_TOKEN_HERE in /Users/ideea/Development/www/areto/tjenestetorget/tjenestetorget_v2/vendor/deployer/recipes/recipe/telegram.php on line 21

Notice: Undefined variable: TELEGRAM_TOKEN_HERE in /XXX/vendor/deployer/recipes/recipe/telegram.php on line 21
PHP Notice: Undefined variable: TELEGRAM_CHATID_HERE in /XXX/vendor/deployer/recipes/recipe/telegram.php on line 22

Notice: Undefined variable: TELEGRAM_CHATID_HERE in /XXX/vendor/deployer/recipes/recipe/telegram.php on line 22

Steps to reproduce

Content of deploy.php

CONTENT

Output log

With enabled option for verbose output -vvv.

Get ready for Deployer v4

Hi,

I think Deployer v4 is almost ready and it will be cool if recipes will be updated for it too.
ping @deployphp/maintainer

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.