Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployer V5 upload method ignores custom ssh port #1224

Closed
ArturSitdikov opened this issue May 19, 2017 · 4 comments
Closed

Deployer V5 upload method ignores custom ssh port #1224

ArturSitdikov opened this issue May 19, 2017 · 4 comments

Comments

@ArturSitdikov
Copy link

Q A
Issue Type Bug
Deployer Version 5.0.0
Local Machine OS Max OS X Sierra 10.12.4
Remote Machine OS Centos 7.3

Description

Just downloaded deployer.phar from site, adjusted deployer.php from v4.3

Steps to reproduce

Just try to upload local file to remote host with custom ssh port.

Content of deploy.php

<?php
namespace Deployer;
require 'recipe/yii2-app-basic.php';


// Configuration
//set('default_stage', 'dev');
set('keep_releases', '5');
set('ssh_type', 'native');
set('ssh_multiplexing', true);

set('repository', '[email protected]/some.git');

add('shared_files', []);
add('shared_dirs', ['vendor', 'web/uploads', 'web/assets']);

add('writable_dirs', ['web/assets', 'web/uploads']);

add('clear_paths', [
    'tests/',
]);

// Servers

host('some-server.com')
    ->user('user')
    ->port(22222)
    ->identityFile('~/.ssh/id_rsa')
    ->set('deploy_path', '/home/user')
    ->stage('dev');

// Tasks
desc('Uploading configs from local machine');
task('config:upload', function () {
    upload('config/db-dist.php', '{{release_path}}/config/db.php');
    upload('web/index-dist.php', '{{release_path}}/web/index.php');
})->onStage('dev');

after('deploy:update_code', 'config:upload');

desc('Restart PHP-FPM service');
task('php-fpm:restart', function () {
    run('sudo systemctl restart php-fpm.service');
});
after('deploy:symlink', 'php-fpm:restart');

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

Output log

[Symfony\Component\Process\Exception\ProcessFailedException]                                                  
  The command "rsync -azP  config/db-dist.php [email protected]:/home/user/releases/19/config/db.php"  
   failed.                                                                                                      
  Exit Code: 255(Unknown error)                                                                                 
  Working directory: /Users/Megatron/project/                                                           
  Output:                                                                                                       
  ================                                                                                              
  Error Output:                                                                                                 
  ================                                                                                              
  ssh: connect to host some-server.com port 22: Connection refused                                              
  rsync: connection unexpectedly closed (0 bytes received so far) [sender]                                      
  rsync error: unexplained error (code 255) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/  
  rsync/io.c(453) [sender=2.6.9]                              

I've even tried adding some options for upload method:

upload('config/db-dist.php', '{{release_path}}/config/db.php', ['timeout'=>null,'options'=> "'ssh -p 22222'"]);

But this doesn't work too.

@antonmedv
Copy link
Member

Duplicate #1218
Try master or:

upload('config/db-dist.php', '{{release_path}}/config/db.php', ['timeout'=>null,'options'=> "-e 'ssh -p 22222'"]);

@ArturSitdikov
Copy link
Author

Using 'options' doesn't help at all.
Used master and now all files uploaded, but for each file I need to enter passphrase to my private key 😞 any solutions for this?

@antonmedv
Copy link
Member

Use ssh-agent?

@ArturSitdikov
Copy link
Author

All works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants