1

使用 laravel 5.8 envoy 命令,我部署在远程服务器上,并在命令行中设置密码,例如:

envoy run Hostels2Deploy --lardeployer_password=111 --app_version=0.105a

和特使文件:

@setup
    $server_login_user= 'lardeployer';
    $lardeployer_password = isset($lardeployer_password) ? $lardeployer_password : "Not Defined";
@endsetup

@servers(['dev' => $server_login_user.':'.$lardeployer_password.'@NNN.NN.NNN.N'])


@task('clean_old_releases')
    echo "Step # 81";
    echo 'The password is: {{ $lardeployer_password }}';
    echo 'The $server_login_user is: {{ $server_login_user }}';
    echo "Step # 00 app_version ::{{ $app_version }}";

    cd {{ $release_number_dir }}
    # php artisan envoy:delete-old-versions  Hostels2Deployed
@endtask

@macro('Hostels2Deploy',['on'=>'dev'])
    clean_old_releases
@endmacro

使用@servers 块中的凭据,我希望我不必手动输入密码,但在命令行中我会看到输入密码的提示。我输出 $server_login_user 和 $lardeployer_password 变量,它们具有有效值。

哪个是有效路径?

4

1 回答 1

0

我在我的操作系统的 /home/user/.ssh/config 中找到了一个使用 ssh 密钥添加行的决定:

Host laravelserver
    IdentityFile ~/.ssh/id_rsa
    HostName NNN.NN.NNN.N
    Port 22
    User lardeployer

并在特使文件中连接到此服务器,例如:

@servers(['dev' => ['laravelserver'] )

Aslo on remote user in file authorized_keys lardeployer's public key 必须添加。

并重新启动服务:

sudo systemctl restart ssh
于 2019-10-01T15:56:41.027 回答