質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

Capistrano

Rubyで書かれたサーバオーケストレーションで、複数のサーバでスクリプトを実行する際に用いられます。主な使用用途はWebアプリケーションのデプロイメントです。 アプリケーションのバージョンアップ自動化、およびデータベースの変更などもできます。

Q&A

解決済

2回答

1691閲覧

自動デプロイコマンド実行時エラーが表示されデプロイできない

sk48801728

総合スコア12

unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

Capistrano

Rubyで書かれたサーバオーケストレーションで、複数のサーバでスクリプトを実行する際に用いられます。主な使用用途はWebアプリケーションのデプロイメントです。 アプリケーションのバージョンアップ自動化、およびデータベースの変更などもできます。

0グッド

0クリップ

投稿2020/06/04 11:23

前提・実現したいこと

bundle exec cap production deployで自動デプロイをAWSのEC2サーバーから行った際、
以下エラーが発生しデプロイできません。

発生している問題・エラーメッセージ

[Deprecation Notice] Future versions of Capistrano will not load the Git SCM plugin by default. To silence this deprecation warning, add the following to your Capfile after `require "capistrano/deploy"`: require "capistrano/scm/git" install_plugin Capistrano::SCM::Git 00:00 git:wrapper 01 mkdir -p /tmp ✔ 01 ec2-user@18.180.70.170 0.120s Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 100.0% 02 chmod 700 /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh ✔ 02 ec2-user@18.180.70.170 0.116s 00:00 git:check 01 git ls-remote git@github.com:sakaokimiaki33/social-engineer-tree .git HEAD 01 aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD 01 aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 01 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head 01 bash: 行 1: .git: コマンドが見つかりません #<Thread:0x00007fa8e1499698@/Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 1: from /Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@18.180.70.170: git exit status: 127 (SSHKit::Runner::ExecuteError) git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: bash: 行 1: .git: コマンドが見つかりません (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@18.180.70.170: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: bash: 行 1: .git: コマンドが見つかりません Caused by: SSHKit::Command::Failed: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: bash: 行 1: .git: コマンドが見つかりません Tasks: TOP => deploy:check => git:check (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@18.180.70.170: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: bash: 行 1: .git: コマンドが見つかりません ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: INFO --------------------------------------------------------------------------- DEBUG [f8473ce7] Running [ -d $HOME/.rbenv/versions/2.5.1 ] as ec2-user@18.180.70.170 DEBUG [f8473ce7] Command: [ -d $HOME/.rbenv/versions/2.5.1 ] DEBUG [f8473ce7] Finished in 0.374 seconds with exit status 0 (successful). INFO [442ae972] Running /usr/bin/env mkdir -p /tmp as ec2-user@18.180.70.170 DEBUG [442ae972] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" ; /usr/bin/env mkdir -p /tmp ) INFO [442ae972] Finished in 0.120 seconds with exit status 0 (successful). DEBUG Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 0.0% INFO Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 100.0% INFO [161e138f] Running /usr/bin/env chmod 700 /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh as ec2-user@18.180.70.170 DEBUG [161e138f] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" ; /usr/bin/env chmod 700 /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh ) INFO [161e138f] Finished in 0.116 seconds with exit status 0 (successful). INFO [f3c23322] Running /usr/bin/env git ls-remote git@github.com:sakaokimiaki33/social-engineer-tree .git HEAD as ec2-user@18.180.70.170 DEBUG [f3c23322] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh" ; /usr/bin/env git ls-remote git@github.com:sakaokimiaki33/social-engineer-tree .git HEAD ) DEBUG [f3c23322] aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head DEBUG [f3c23322] bash: 行 1: .git: コマンドが見つかりません mb:social-engineer-tree kimiakisakao$ bundle exec cap production deploy [Deprecation Notice] Future versions of Capistrano will not load the Git SCM plugin by default. To silence this deprecation warning, add the following to your Capfile after `require "capistrano/deploy"`: require "capistrano/scm/git" install_plugin Capistrano::SCM::Git 00:00 git:wrapper 01 mkdir -p /tmp ✔ 01 ec2-user@18.180.70.170 0.107s Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 100.0% 02 chmod 700 /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh ✔ 02 ec2-user@18.180.70.170 0.113s 00:00 git:check 01 git ls-remote git@github.com:sakaokimiaki33/social-engineer-tree .git HEAD 01 Warning: Permanently added the RSA host key for IP address '13.114.40.48' to the list of known hosts. 01 aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD 01 aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 01 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head 01 bash: 行 1: .git: コマンドが見つかりません #<Thread:0x00007faffb84f140@/Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 1: from /Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /Users/kimiakisakao/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@18.180.70.170: git exit status: 127 (SSHKit::Runner::ExecuteError) git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: Warning: Permanently added the RSA host key for IP address '13.114.40.48' to the list of known hosts. bash: 行 1: .git: コマンドが見つかりません (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@18.180.70.170: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: Warning: Permanently added the RSA host key for IP address '13.114.40.48' to the list of known hosts. bash: 行 1: .git: コマンドが見つかりません Caused by: SSHKit::Command::Failed: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: Warning: Permanently added the RSA host key for IP address '13.114.40.48' to the list of known hosts. bash: 行 1: .git: コマンドが見つかりません Tasks: TOP => deploy:check => git:check (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@18.180.70.170: git exit status: 127 git stdout: aa68728ff1acb4fd2b0bb3633409f6dccc31605d HEAD aa68728ff1acb4fd2b0bb3633409f6dccc31605d refs/heads/master 9602c162b82b60ffced82c1903684381292ee4a9 refs/pull/1/head git stderr: Warning: Permanently added the RSA host key for IP address '13.114.40.48' to the list of known hosts. bash: 行 1: .git: コマンドが見つかりません ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: DEBUG [f6821bed] Running [ -d $HOME/.rbenv/versions/2.5.1 ] as ec2-user@18.180.70.170 DEBUG [f6821bed] Command: [ -d $HOME/.rbenv/versions/2.5.1 ] DEBUG [f6821bed] Finished in 0.366 seconds with exit status 0 (successful). INFO [d3d7586e] Running /usr/bin/env mkdir -p /tmp as ec2-user@18.180.70.170 DEBUG [d3d7586e] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" ; /usr/bin/env mkdir -p /tmp ) INFO [d3d7586e] Finished in 0.107 seconds with exit status 0 (successful). DEBUG Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 0.0% INFO Uploading /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh 100.0% INFO [42873045] Running /usr/bin/env chmod 700 /tmp/git-ssh-social-engineer-tree-production-kimiakisakao.sh as ec2-user@18.180.70.170

試したこと

stderr_pathのシェアが読み込まれていない?

再度bundle exec cap production deployを入力して実行するも同じエラーが表示される

補足情報(FW/ツールのバージョンなど)

ruby 2.5.1
Rails 5.2.4.2
capistrano 3.14.0

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

uncorn.rbファイル内の記述が一部インデントがずれていました

投稿2020/06/07 11:26

sk48801728

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

git: コマンドが見つかりません
とあるので、EC2にgitがinstallされていないのでは?

投稿2020/06/04 13:12

winterboum

総合スコア23329

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

sk48801728

2020/06/05 04:26

[ec2-user@ip-172-31-4-94 ~]$ sudo yum install git 読み込んだプラグイン:priorities, update-motd, upgrade-helper amzn-main | 2.1 kB 00:00:00 amzn-updates | 3.8 kB 00:00:00 パッケージ git-2.14.6-1.62.amzn1.x86_64 はインストール済みか最新バージョンです 何もしません [ec2-user@ip-172-31-4-94 ~]$ とあるのでgitはinstall済みのようです。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問