| Q | A |
| --- | --- |
| Issue Type | Bug |
| Deployer Version | master |
| Local Machine OS | Ubunut 14.04 LTS |
| Remote Machine OS | N/A |
I'm using deployer with identity files to authenticate to the remote hosts, which works as expected. I don't get asked for a password, when deploying. Now that I want to exclude the servers configuration to a yaml file as described in the documentation, I get asked for a password when running $ deb deploy …. The deploy process continues independent of what I type in as password.
I would expect that I don't get asked for a password as I don't get ask with the default way of configuring the server.
See below
deploy.phpThis is the basic deploy.php with server directly defined:
<?php
require 'recipe/composer.php';
set( 'repository', '[email protected]:vendor/project.git' );
env( 'release_name', date( 'Y-m-d-H-i-s' ) );
set('keep_releases', 3);
set( 'shared_files', [ '.env', 'robots.txt' ] );
set( 'shared_dirs', [ 'wp-content/uploads' ] );
env('composer_options', 'install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction');
server( 'testing.vendor', 'myhost.de', 22 )
->user( 'xxxxxx' )
->identityFile( '~/.ssh/id_rsa.pub', '~/.ssh/id_rsa' )
->env( 'deploy_path', '/var/www/project' )
->env( 'branch', 'master' );
This is the deploy.php with the included servers.yml:
<?php
require 'recipe/composer.php';
set( 'repository', '[email protected]:vendor/project.git' );
env( 'release_name', date( 'Y-m-d-H-i-s' ) );
set('keep_releases', 3);
set( 'shared_files', [ '.env', 'robots.txt' ] );
set( 'shared_dirs', [ 'wp-content/uploads' ] );
env('composer_options', 'install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress --no-interaction');
$server_config = __DIR__ . '/deploy-servers.yml';
serverList( $server_config );
Content of servers.yml:
testing.vendor:
host: myhost.de
port: 22
user: xxxxxx
identity_file:
public_key: ~/.ssh/id_rsa.pub
private_key: ~/.ssh/id_rsa
deploy_path: /var/www/project
branch: master
Output for server defined in deploy.php
$ wp-content/vendor/bin/dep deploy testing.vendor -vvv
➤ Executing task deploy:prepare
↳ on [testing.vendor]
> echo $0
< bash
<
> if [ ! -d /var/www/... ]; then mkdir -p /var/www/...; fi
> if [ ! -L /var/www/... ] && [ -d /var/www/... ]; then echo true; fi
> cd /var/www/... && if [ ! -d releases ]; then mkdir releases; fi
> cd /var/www/... && if [ ! -d shared ]; then mkdir shared; fi
• done on [testing.vendor]
✔ Ok [784ms]
Output for server defined in servers.yml:
$ wp-content/vendor/bin/dep deploy testing.vendor -vvv
➤ Executing task deploy:prepare
↳ on [testing.vendor]
[[email protected]] Password:
> echo $0
< bash
<
> if [ ! -d /var/www/... ]; then mkdir -p /var/www/...; fi
> if [ ! -L /var/www/... ] && [ -d /var/www... ]; then echo true; fi
> cd /var/www/... && if [ ! -d releases ]; then mkdir releases; fi
> cd /home/www/... && if [ ! -d shared ]; then mkdir shared; fi
• done on [testing.vendor]
✔ Ok [3s 390ms]
...
Are you missing password parameter?
In Deployer document:
testing.vendor:
host: myhost.de
port: 22
user: xxxxxx
identity_file:
public_key: ~/.ssh/id_rsa.pub
private_key: ~/.ssh/id_rsa
password: null
deploy_path: /var/www/project
branch: master
I tested both, with (an empty) and without password:
testing.vendor:
host: myhost.de
port: 22
user: xxxxxx
identity_file:
public_key: ~/.ssh/id_rsa_vendor.pub
private_key: ~/.ssh/id_rsa_vendor
password:
deploy_path: /var/www/...
branch: master
I think that when I'm using the servers.yml the behavior is always to ask for the key passphrase whether the key is already unlocked in the current user session or not.
If I start direct with the servers.yml as config, I always have to use the correct pass-phrase for the key to work.
I know it's been a couple of months but I ran into this briefly and what I used to get around it was to set password: "", null or nothing wouldn't work.
Even if I set password: "" I get asked about the password.
I'm using the 3.3.0 release and not master if that makes a difference. I did have issues with the id_rsa pair using the full format. This is an example of what I've gotten to work:
production:
host: server_ip_address
user: username
identity_file: ~
stage: production
deploy_path: "/var/www/html"
branch: master
Notice identity_file is just ~ with none of the child sections. Specifying id_rsa specifically caused weird detection issues where it wouldn't find the right ~/.ssh/id_rsa file.
This is an example of using a specified key that is not id_rsa:
production:
host: server_ip_address
user: username
identity_file:
public_key: "~/.ssh/custom_key.pub"
private_key: "~/.ssh/custom_key"
password: ""
stage: production
deploy_path: "/var/www/html"
branch: master
I'm using the same deployer version for both without the ssh2 extension. I didn't see that in your snippets but I had problems getting that working at all, which I just chalked up to user error.
I think in that case:
identity_file:
public_key: "~/.ssh/custom_key.pub"
private_key: "~/.ssh/custom_key"
dep must to ask for password. So if you don't want it, you need to specify it. Or if you password is "" empty string:
identity_file:
public_key: "~/.ssh/custom_key.pub"
private_key: "~/.ssh/custom_key"
password: ""
Most helpful comment
I know it's been a couple of months but I ran into this briefly and what I used to get around it was to set
password: "", null or nothing wouldn't work.