Hi,
today I tried using deployer with ssh2 php extension and found two things:
```
This can only be used with the ssh2 pecl extension.
// Switch to ext-ssh2
set('use_ssh2', true);
```
It should be set('ssh_type', 'ext-ssh2')
libssh2-php: /usr/lib/php5/20121212/ssh2.so extension=ssh2.so in /etc/php5/mods-available/ssh2.ini php -m shows ssh2sudo pear install channel://pecl.php.net/ssh2-0.12, it was successfull and ssh2.so file was updated set('ssh_type', 'ext-ssh2') ```
Executing task deploy:lock_project
PHP Fatal error: Class 'Ssh\Configuration' not found in phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php on line 47
PHP Stack trace:
PHP 1. {main}() /home/piotrek/Vhosts/deployer/deployer.phar:0
PHP 2. require() /home/piotrek/Vhosts/deployer/deployer.phar:3
PHP 3. Deployer\Deployer->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/bin/dep:62
PHP 4. Symfony\Component\Console\Application->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Deployer.php:91
PHP 5. Symfony\Component\Console\Application->doRun() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 6. Symfony\Component\Console\Application->doRunCommand() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 7. Symfony\Component\Console\Command\Command->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 8. Deployer\Console\TaskCommand->execute() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Deployer\Executor\SeriesExecutor->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Console/TaskCommand.php:116
PHP 10. Deployer\Task\Task->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Executor/SeriesExecutor.php:40
PHP 11. call_user_func() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Task/Task.php:66
PHP 12. {closure:/home/piotrek/Vhosts/deployer/tasks.php:14-17}() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Task/Task.php:66
PHP 13. run() /home/piotrek/Vhosts/deployer/tasks.php:16
PHP 14. Deployer\Server\Remote\SshExtension->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/functions.php:289
PHP 15. Deployer\Server\Remote\SshExtension->checkConnection() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php:111
PHP 16. Deployer\Server\Remote\SshExtension->connect() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php:102
```
Am I doing something wrong? Should I Install some extension other than pecl ssh2? Is it some kind of old code which was maybe valid some time ago and not now?
Hello!
It should be set('ssh_type', 'ext-ssh2')
Yes, correct. Can you create PR to fix docs?
And you also need to require herzult/php-ssh with composer.
Hi,
I can create PR but what if this functionality doesn't work? Should it be in docs?
Hello.
PR also created - https://github.com/deployphp/docs/pull/28
I try to connect via ssh config.
Ssh config writing with "ProxyCommand ssh node01 -W %h:%p" commands.
And all of proxy-connections equal 3. And after 1st proxy-connect i have this error:
"Shell on your server is not POSIX-compliant. Please change to sh, bash or similar. Usually, you can change your shell to bash by running: chsh -s /bin/bash"
What is it?
@elfet how should I inlclude herzult/php-ssh? I tried:
$ composer require herzult/php-ssh
Using version ^1.1 for herzult/php-ssh
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing herzult/php-ssh (v1.1.1)
Downloading: 100%
Writing lock file
Generating autoload files
Inside deployer.php:
// All Deployer recipes are based on `recipe/common.php`.
require 'recipe/symfony.php';
require 'tasks.php';
require 'vendor/autoload.php';
set('ssh_type', 'ext-ssh2');
//...
And I still get:
$ php deployer.phar deploy dev-open
Executing task deploy:lock_project
PHP Fatal error: Class 'Ssh\Configuration' not found in phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php on line 47
PHP Stack trace:
PHP 1. {main}() /home/piotrek/Vhosts/deployer/deployer.phar:0
PHP 2. require() /home/piotrek/Vhosts/deployer/deployer.phar:3
PHP 3. Deployer\Deployer->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/bin/dep:62
PHP 4. Symfony\Component\Console\Application->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Deployer.php:91
PHP 5. Symfony\Component\Console\Application->doRun() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 6. Symfony\Component\Console\Application->doRunCommand() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 7. Symfony\Component\Console\Command\Command->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 8. Deployer\Console\TaskCommand->execute() phar:///home/piotrek/Vhosts/deployer/deployer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Deployer\Executor\SeriesExecutor->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Console/TaskCommand.php:116
PHP 10. Deployer\Task\Task->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Executor/SeriesExecutor.php:40
PHP 11. call_user_func() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Task/Task.php:66
PHP 12. {closure:/home/piotrek/Vhosts/deployer/tasks.php:14-17}() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Task/Task.php:66
PHP 13. run() /home/piotrek/Vhosts/deployer/tasks.php:16
PHP 14. Deployer\Server\Remote\SshExtension->run() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/functions.php:289
PHP 15. Deployer\Server\Remote\SshExtension->checkConnection() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php:111
PHP 16. Deployer\Server\Remote\SshExtension->connect() phar:///home/piotrek/Vhosts/deployer/deployer.phar/src/Server/Remote/SshExtension.php:102
@pilotftzi You probably have some non POSIX compliant shell or it can't be detected. Can you log in to server using ssh and write what this command shows
echo $SHELL
?
I figured why. Because of phar. Phar does not contains php-ssh. So it will be working for Deployer installed with Composer.
Can any one update docs?
Ok, it seems to work when I'm using composer.json to install deployer. I'll make PR with instructions how to use ext-ssh2.
Btw. there is warning when installing deployer using composer:
Package guzzle/parser is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Hmm, need to check deps. Looks like one on deps use old deps. Can you create issue?
This is currently a big problem for me.
Since I'm using Laravel, I can't use composer (#316), and since I need to use ext-ssh2 I can't use deployer.phar.
You can build phar youself. I'm also will think about namespace for Deployer func.
@phaza Can't you use deployer independently of your project? I'm currently using composer from my local laptop to install new versions on servers (I have it in independent git repo). If you must install deployer on server, why not install it in your home directory or some other directory with write access. Mingling it with actual project code is not a good thing in my opinion. You should be able to update deploy tool without updating project code. Why not create git repository just for deployer so any project developer could get it and use it wherever he wants?
I don't install deployer on the server. I tried to add it as a development
requirement. IMO that makes sense since the deploy recipe is part of the
project too.
Anyway, I made my own deployer.phar with the necessary package included in
vendor.
On Tue, 16 Jun 2015 at 10:51 piotrekkr [email protected] wrote:
@phaza https://github.com/phaza Can't you use deployer independently of
your project? I'm currently using composer from my local laptop to install
new versions on servers (I have it in independent git repo). If you must
install deployer on server, why not install it in your home directory or
some other directory with write access. Mingling it with actual project
code is not a good thing in my opinion. You should be able to update deploy
tool without updating project code. Why not create git repository just for
deployer so any project developer could get it and use it wherever he wants?—
Reply to this email directly or view it on GitHub
https://github.com/deployphp/deployer/issues/337#issuecomment-112344662.
Most helpful comment
Hello.
PR also created - https://github.com/deployphp/docs/pull/28
I try to connect via ssh config.
Ssh config writing with "ProxyCommand ssh node01 -W %h:%p" commands.
And all of proxy-connections equal 3. And after 1st proxy-connect i have this error:
"Shell on your server is not POSIX-compliant. Please change to sh, bash or similar. Usually, you can change your shell to bash by running: chsh -s /bin/bash"
What is it?