Deployer: Deployer on windows - problems

Created on 30 Nov 2017  路  5Comments  路  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Question
| Deployer Version | 6.0.0
| Local Machine OS | Windows 10
| Remote Machine OS | Ubuntu 16.04

Description

Hi,
I'm trying to use deployer for the first time, but I'm facing some problems. I didn't find my answer on other issues/forums.
I required deployer/deployer with composer. Then, I go to /vendor/bin folder and "dep init". So, the deploy.php is in the bin folder. Is it normal ?
Then I'm trying the 'dep deploy' command, but I have this error :

The command "export SYMFONY_ENV='prod'; echo $0" failed.
Exit Code: -1 (Unknown error)
'ssh' is not recognized as an internal or external command ...

I know the SSH error is not due to Deployer, but I don't understand how to do it on windows ?
The "command ... export ... failed" error is it related with the SSH one ?

Thanks a lot :)

Content of deploy.php

namespace Deployer;

require 'recipe/symfony3.php';

// Project name
set('application', 'backoffice');

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

// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); 

// Shared files/dirs between deploys 
add('shared_files', []);
add('shared_dirs', []);

// Writable dirs by web server 
add('writable_dirs', []);
set('allow_anonymous_stats', false);
set('ssh_multiplexing', false);

// Hosts
host('vps486717', 'xx.xx.xx.xx')
    ->user('root')
    ->identityFile('~/.ssh/id_rsa')
    ->set('deploy_path', '/var/www/resa');

// Tasks
task('build', function () {
    run('cd {{release_path}} && build');
});

Most helpful comment

deployer uses ssh to actually connect to the server. The error message means, that you have not installed it. There is a windows version of SSH on sourceforge: https://sourceforge.net/projects/sshwindows/

The problem is, with newer deployer versions the ssh command will again fail: The binary linked above is from 2004 (!) and there seems to be no newer version available (correct me on this if possible), and deployer uses one of the newer features of ssh.

What you can do (and how I am using it) is using the Ubuntu shell you can install via the windows store: https://www.microsoft.com/store/productId/9NBLGGH4MSV6
This will give a new shell (called "Bash on Ubuntu for Windows"). Use this whenever you're using deployer (you can find your drives in the directory /mnt/c/...).

You can check whether your ssh connection now works by executing ssh [email protected]. As soon as you get this to work, you can use deployer to do the deploying for you.

All 5 comments

deployer uses ssh to actually connect to the server. The error message means, that you have not installed it. There is a windows version of SSH on sourceforge: https://sourceforge.net/projects/sshwindows/

The problem is, with newer deployer versions the ssh command will again fail: The binary linked above is from 2004 (!) and there seems to be no newer version available (correct me on this if possible), and deployer uses one of the newer features of ssh.

What you can do (and how I am using it) is using the Ubuntu shell you can install via the windows store: https://www.microsoft.com/store/productId/9NBLGGH4MSV6
This will give a new shell (called "Bash on Ubuntu for Windows"). Use this whenever you're using deployer (you can find your drives in the directory /mnt/c/...).

You can check whether your ssh connection now works by executing ssh [email protected]. As soon as you get this to work, you can use deployer to do the deploying for you.

I tried it a long time after my question ... but it works ! Thanks a lot @famoser :)
I have to specify my passphrase both, after deploy:prepare and deploy:update_code. Is it normal ?

Thanks again :)

I'll always use rsa keys to authenticate, that way I do not need to type in any passwords anymore. Here's how it works, use the Ubuntu shell or similar:

  1. cat ~/.ssh/id_rsa.pub to ensure you already have created an rsa ssh key for yourself, if none ("No such file or directory"):
    1.1 ssh-keygen -t rsa -b 4096 -C "[email protected]" to generate a new key
    1.2 eval $(ssh-agent -s) to start the ssh agent
    1.3 ssh-add ~/.ssh/id_rsa to add the key to your ssh agent
  2. add own ssh key to the server with ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] (the last time you'll need to your password)
  3. connect to server the with ssh [email protected] to verify all went well

This kind of got off topic, if you feel comfortable (and indeed can do so, not sure who is allowed to do this), consider closing the issue.

I'm sorry, my message wasn't clear ... :)
It's my private key passphrase that I need to repeat both.
Thanks :)

Closing this issue as inactive. If you still have this problem, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sweebee picture sweebee  路  3Comments

timkley picture timkley  路  4Comments

JonasDoebertin picture JonasDoebertin  路  4Comments

osbulbul picture osbulbul  路  3Comments

chouex picture chouex  路  4Comments