2017-01-06 11 views
2

Deployer 4.0.2でデプロイするのに問題があり、私よりも経験豊富な人の助けが必要です。Deployer - ttyは存在せず、askpassプログラムも指定されていません - Deployerを使用してデプロイする方法

サーバーのUbuntu 16.04に私のリポジトリを展開したいと考えています。

私はデプロイヤもインストールした開発環境としてlaravel homesteadを使用しています。そこから私はリモートサーバにsshします。

rootユーザーで自分のコードを展開できました。RuntimeExceptionが私の展開を中止するまで私はコードを展開できました。私はスーパーユーザの権限を与えたgeorgeと呼ばれる別のユーザーを作成作っ

Do not run Composer as root/super user! See https://getcomposer.org/root for details 

。ローカルマシンから私の公開鍵を新しく生成した ~/.ssh/authorized_keysファイルにコピーしました。これにより、SSH経由でサーバにアクセスする権限が与えられました。私は、新しいユーザーと dep deployを実行すると

はまだ:

Host key verification failed. 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights 
and the repository exists. 

今では~/.ssh/id_rsa.pubキーにアクセスすることはできません新しいユーザーgeorge次のようになります。

server('production', '138.68.99.157') 
    ->user('george') 
    ->identityFile() 
    ->set('deploy_path', '/var/www/test'); 

を私は別のRuntimeExceptionが得ます。そこで私はそれらをルートフォルダから私のホームフォルダにコピーし、Github SSH設定に公開鍵を追加します。

cp root/.ssh/id_rsa.pub home/george/.ssh/id_rsa.pub 
cp root/.ssh/id_rsa home/george/.ssh/id_rsa 

以前と同じエラーが発生します。

は最後に、私は、許可ホストの私のリストにgithubのを追加する必要がありました:

ssh-keyscan -H github.com >> ~/.ssh/known_hosts 

のみ次RuntimeException

[RuntimeException] 
sudo: no tty present and no askpass program specified 

を得るために、私はdeploy.php

にこのコードをコメントするために管理しました
// desc('Restart PHP-FPM service'); 
// task('php-fpm:restart', function() { 
//  // The user must have rights for restart service 
//  // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service 
//  run('sudo systemctl restart php-fpm.service'); 
// }); 
// after('deploy:symlink', 'php-fpm:restart'); 

最終的に展開プロセスを完了するために、今私は尋ねるもし私がphp-fpmのrestartが本当に必要であれば、私はこのデプロイメントツールのデバッグを続けますか?それとも私はそれなしで生きてもいいですか?

もし私がそれを必要とすれば、誰かが私が必要なものを理解するのを助けることができますか?そしておそらくラグジュアリーはRuntimeExceptionの解決策を提供するでしょうか?

答えて

1

これを試してみてください:

->identityFile('~/.ssh/id_rsa.pub', '~/.ssh/id_rsa', 'pass phrase') 

それは私のために素晴らしい作品ません - askpassパッケージプログラムの必要性を。
私の経験では明白です。

phpfmの再起動タスクについては、以前は見ていませんでした。必要ではありません。:)

EDIT:

パスワードを提供おそらくあなたは、あなたがソース管理下にそれを維持する場合は、あなたのDeployerのコードビットをリファクタリングするべき良い兆候です。

私はではなく、で、ソース管理に送信するサイト固有のデータをロードしています。私deploy.php

# Site Configuration 
# ------------- 
prod_1: 
    host: hostname 
    user: username 
    identity_file: 
     public_key: /home/user/.ssh/key.pub 
     private_key: /home/user/.ssh/key 
     password: "password" 
    stage: production 
    repository: https://github.com/user/repository.git 
    deploy_path: /var/www 
    app: 
     debug: false 
     stage: 'prod' 

そして、::

stage.ymlの最初のビットにあなたがserverListを使用する場合、それはdeploy.php

でサーバーの設定を置き換え、という

if (!file_exists (__DIR__ . '/deployer/stage/servers.yml')) { 
    die('Please create "' . __DIR__ . '/deployer/stage/servers.yml" before continuing.' . "\n"); 
} 
serverList(__DIR__ . '/deployer/stage/servers.yml'); 
set('repository', '{{repository}}'); 

set('default_stage', 'production'); 

お知らせ

関連する問題