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

Host key verification failed. #16

Open
sluxzer opened this issue Mar 13, 2021 · 0 comments
Open

Host key verification failed. #16

sluxzer opened this issue Mar 13, 2021 · 0 comments

Comments

@sluxzer
Copy link

sluxzer commented Mar 13, 2021

Hey there, i'm really new on deployer, and running it on github actions.

i got this error, and trying to solve this for hours, follow others instruction but the error still exist

i'm using package: https://github.com/lorisleiva/laravel-deployer
but it's not the problem, because i success run it manually, the problem on deploy

because i'm new on this kind of thing, i just don't know how to debug it.

In Client.php line 103:

[Deployer\Exception\RuntimeException (-1)]
The command "rm -f /var/www/xxx-staging/.dep/deploy.lock" failed.

Exit Code: -1 (Unknown error)

Host Name: staging.xxx.co.id

================
Host key verification failed.

Step To Reproduce:
1 . Create an SSH private key ssh-keygen -t rsa -b 4096 -m pem , then add id_rsa to github secrets
2. Add another Secret called SSH_KNOWN_HOSTSssh-keyscan rsa -t , then add id_rsa to github secrets

Things i've done

  • [failed] Disabling Host Check Checking ssh-disable-host-key-checking: true
  • change user to http_user
  • others that i'm forgot

Detail Running

Run php artisan deploy staging -o git_tty=false -vvv
  php artisan deploy staging -o git_tty=false -vvv
  shell: /usr/bin/bash -e {0}
  env:
    SSH_AUTH_SOCK: /tmp/ssh-auth.sock
    DOT_ENV: ***
  
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < HEAD
✈︎ Deploying HEAD on xxx.co.id with firstdeploy strategy
• done on [staging.mazda.xylo.co.id]
➤ Executing task deploy:prepare
[staging.xxx] > echo $0
[staging.xxx] < ssh multiplexing initialization
[staging.xxx] < Host key verification failed.
➤ Executing task deploy:failed
• done on [staging.xxx.xxx]
✔ Ok [0ms]
➤ Executing task deploy:unlock
[staging.xxx] > rm -f /var/www/xxx/.dep/deploy.lock
[staging.xxx] < ssh multiplexing initialization
[staging.xxx] < Host key verification failed.

In Client.php line 103:

  [Deployer\Exception\RuntimeException (-1)]                                
  The command "rm -f /var/www/xxx/.dep/deploy.lock" failed.  

  Exit Code: -1 (Unknown error)                                             

  Host Name: xxx.co.id                                       

  ================                                                          
  Host key verification failed.

deploy-staging.yml

name: CI/CD

on:
  push:
    branches:
      - development

jobs:
  deploy-staging:
    name: Deploy Project to STAGING Server
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/development'
    steps:
      - uses: actions/checkout@v1
      - name: Setup PHP
        uses: shivammathur/setup-php@master
        with:
          php-version: 7.4
          extension-csv: mbstring, bcmath, imagick
      - name: Composer install
        run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
      - name: Composer autoload
        run: composer dump-autoload
      - name: Artisan
        run: php artisan optimize
      - name: Setup Deployer
        uses: atymic/deployer-php-action@master
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
          ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
      - name: Deploy to Prod
        env:
          DOT_ENV: ${{ secrets.DOT_ENV_STAGING }}
        run: php artisan deploy staging -o git_tty=false -vvv

deploy.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default deployment strategy
    |--------------------------------------------------------------------------
    |
    | This option defines which deployment strategy to use by default on all
    | of your hosts. Laravel Deployer provides some strategies out-of-box
    | for you to choose from explained in detail in the documentation.
    |
    | Supported: 'basic', 'firstdeploy', 'local', 'pull'.
    |
    */

    'default' => 'firstdeploy',

    /*
    |--------------------------------------------------------------------------
    | Custom deployment strategies
    |--------------------------------------------------------------------------
    |
    | Here, you can easily set up new custom strategies as a list of tasks.
    | Any key of this array are supported in the `default` option above.
    | Any key matching Laravel Deployer's strategies overrides them.
    |
    */

    'strategies' => [
        //
    ],

    /*
    |--------------------------------------------------------------------------
    | Hooks
    |--------------------------------------------------------------------------
    |
    | Hooks let you customize your deployments conveniently by pushing tasks
    | into strategic places of your deployment flow. Each of the official
    | strategies invoke hooks in different ways to implement their logic.
    |
    */

    'hooks' => [
        // Right before we start deploying.
        'start' => [
            //
        ],

        // Code and composer vendors are ready but nothing is built.
        'build' => [
            'npm:install',
            'npm:production',
        ],

        // Deployment is done but not live yet (before symlink)
        'ready' => [
            'artisan:storage:link',
            'artisan:view:clear',
            'artisan:config:cache',
        ],

        // Deployment is done and live
        'done' => [
            //
        ],

        // Deployment succeeded.
        'success' => [
            //
        ],

        // Deployment failed.
        'fail' => [
            //
        ],

        // After a deployment has been rolled back.
        'rollback' => [
            //
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Deployment options
    |--------------------------------------------------------------------------
    |
    | Options follow a simple key/value structure and are used within tasks
    | to make them more configurable and reusable. You can use options to
    | configure existing tasks or to use within your own custom tasks.
    |
    */

    'options' => [
        'application' => env('APP_NAME', 'Laravel'),
        'repository' => '[email protected]:xxx/xxx.git',
        'git_tty' => true,
        'ssh_multiplexing' => true
    ],

    /*
    |--------------------------------------------------------------------------
    | Hosts
    |--------------------------------------------------------------------------
    |
    | Here, you can define any domain or subdomain you want to deploy to.
    | You can provide them with roles and stages to filter them during
    | deployment. Read more about how to configure them in the docs.
    |
    */

    'hosts' => [
        'staging.mazda.xylo.co.id' => [
            'deploy_path' => '/var/www/xxx-staging',
            'stage' => 'staging',
            'user' => 'root',
        ],
        'mazda.xylo.co.id' => [
            'deploy_path' => '/var/www/xxx',
            'stage' => 'production',
            'user' => 'root',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Localhost
    |--------------------------------------------------------------------------
    |
    | This localhost option give you the ability to deploy directly on your
    | local machine, without needing any SSH connection. You can use the
    | same configurations used by hosts to configure your localhost.
    |
    */

    'localhost' => [
        //
    ],

    /*
    |--------------------------------------------------------------------------
    | Include additional Deployer recipes
    |--------------------------------------------------------------------------
    |
    | Here, you can add any third party recipes to provide additional tasks,
    | options and strategies. Therefore, it also allows you to create and
    | include your own recipes to define more complex deployment flows.
    |
    */

    'include' => [
        'recipe/laravel.php',
        'recipe/rsync.php',
    ],

    /*
    |--------------------------------------------------------------------------
    | Use a custom Deployer file
    |--------------------------------------------------------------------------
    |
    | If you know what you are doing and want to take complete control over
    | Deployer's file, you can provide its path here. Note that, without
    | this configuration file, the root's deployer file will be used.
    |
    */

    'custom_deployer_file' => false,

];

Help me please :)

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

1 participant