rocketeers / rocketeer

Send your projects up in the clouds
http://rocketeer.autopergamene.eu/
MIT License
2.66k stars 217 forks source link

'rocketeer deploy --on' fails on one connection, but works on another #725

Open adc-diegocam opened 7 years ago

adc-diegocam commented 7 years ago

When running rocketeer deploy --on="staging", my code deploys correctly with no issues,

but when I deploy to production doing rocketeer deploy --on="production" I see a bunch of errors.

Why does this happen? Does Rocketeer expect my different servers to be on a certain versions when it comes to OS/PHP/SSH..?

What do these errors mean exactly?

I have tried setting the username/password on config.php, and I also tried doing it via SSH key, but both fail. (even though I can SSH into the servers normally)

Also, whenever I set the username/password, it doesn't seem to recognize what I type in config.php and asks again when running the command.

These are the errors:

PHP Warning:  unpack(): Type N: not enough input, need 4, have 1 in phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 2826
PHP Warning:  extract() expects parameter 1 to be array, boolean given in phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 2826
PHP Fatal error:  Uncaught Error: Call to undefined function utf8_decode() in phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php:2827
Stack trace:
#0 phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2771): Net_SSH2->_filter('\x00\x00\x17hostkeys-00@...')
#1 phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2974): Net_SSH2->_get_binary_packet()
#2 phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php(441): Net_SSH2->_get_channel_packet(256)
#3 phar:///usr/local/bin/rocketeer/vendor/illuminate/remote/Illuminate/Remote/SecLibGateway.php(86): Net_SFTP->login('valapps', Object(Crypt_RSA))
#4 phar:///usr/local/bin/rocketeer/vendor/illuminate/remote/Illuminate/Remote/Connection.php(231): Illuminate\Remote\SecLibGateway->connect('valapps')
#5 phar:///usr/local/bin/rocketeer/vendor/illuminate/remote/Illuminate/Remote/Connection.php(109): Illuminate\Remote\Connection->getGateway()
#6 [internal function]: Illuminate in phar:///usr/local/bin/rocketeer/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 2827

Here is my config.php file:

<?php

use Rocketeer\Services\Connections\ConnectionsHandler;

return [

    // The name of the application to deploy
    // This will create a folder of the same name in the root directory
    // configured above, so be careful about the characters used
    'application_name' => 'myapp.api',

    // Plugins
    ////////////////////////////////////////////////////////////////////

    // The plugins to load
    'plugins'          => [
        //'Rocketeer\Plugins\Slack\RocketeerSlack'
    ],

    // Logging
    ////////////////////////////////////////////////////////////////////

    // The schema to use to name log files
    'logs'             => function (ConnectionsHandler $connections) {
        return sprintf('%s-%s-%s.log', $connections->getConnection(), $connections->getStage(), date('Ymd'));
    },

    // Remote access
    //
    // You can either use a single connection or an array of connections
    ////////////////////////////////////////////////////////////////////

    // The default remote connection(s) to execute tasks on
    'default'          => ['staging'],

    // The various connections you defined
    // You can leave all of this empty or remove it entirely if you don't want
    // to track files with credentials : Rocketeer will prompt you for your credentials
    // and store them locally
    'connections' => [
        'staging' => [
            'host' => 'servername-staging.com',
            'username' => 'user',
            'password' => 'pass',
            'key' => '',
            'keyphrase' => '',
            'agent' => '',
            'db_role' => true,
        ],
        'production' => [
            'host'      => 'servername.com',
            'username'  => 'valapps',
            'password'  => '',
            'key'       => '',
            'keyphrase' =>'',
            'agent'     =>'',
            'db_role'   => true,
        ],
    ],

    /*
     * In most multiserver scenarios, migrations must be run in an exclusive server.
     * In the event of not having a separate database server (in which case it can
     * be handled through connections), you can assign a 'db_role' => true to the
     * server's configuration and it will only run the migrations in that specific
     * server at the time of deployment. test
     */
    'use_roles'        => false,

    // Contextual options
    //
    // In this section you can fine-tune the above configuration according
    // to the stage or connection currently in use.
    // Per example :
//     'stages' => array(
//      'staging' => array(
//          'scm' => array('branch' => 'staging'),
//      ),
//      'production' => array(
//        'scm' => array('branch' => 'master'),
//      ),
//     ),
    ////////////////////////////////////////////////////////////////////

    'on'               => [

        // Stages configurations
        'stages'      => [],
        // Connections configuration
        'connections' => [
            'staging' => [
                'scm' => [
                    'branch' => 'staging'
                ],
            ],
            'production' => [
                'scm' => [
                    'branch' => 'master'
                ]
            ],
        ],

    ],

];

Please help.

Anahkiasen commented 7 years ago

What version of Rocketeer is this and which PHP version are you running?

adc-diegocam commented 7 years ago

Hello. These are the versions im using on the server running the deployment:

adc-diegocam commented 7 years ago

Can you please follow up?

nilansanjaya commented 7 years ago

Not sure why, but there seems to be an easy fix until things get updated properly,

https://github.com/terrafrost/phpseclib/commit/684d6ee

diegocam commented 7 years ago

After some research on this error

PHP Fatal error: Uncaught Error: Call to undefined function utf8_decode() in...

we found this post: https://stackoverflow.com/questions/35701730/utf8-endecode-removed-from-php7

I ran sudo apt-get install php-xml and problem solved.

@Anahkiasen Its disappointing that you havent followed up on this. You have a good product but with your lack of attention its only a matter of time for it get bumped.

cuongtv2004 commented 7 years ago

@diegocam thanks. it's resolved for my problem