前提・実現したいこと
引き続きローカルで作成したRailsアプリをEC2経由でAWSへデプロイしようと試みております。
下記サイトを参考にしながら進めております
※capistrano導入に関してはサイト1、2を参考にしています。
現在デプロイに関する設定が一通り完了したのでcapistano
を導入しようと進めております。
そちらも諸々設定を完了させたのでいよいよデプロイに入ろうとしたのですがそこでエラーがいくつか発生しているような状況です。
発生している問題・エラーメッセージ(デプロイコマンド時の内容全てを載せています)
※文字数の関係で上手くいっているだろう箇所は省いています
ec2-user:~/environment/toreka (master) $ bundle exec cap production deploy 00:11 bundler:config 01 $HOME/.rbenv/bin/rbenv exec bundle config --local deployment true 01 You are replacing the current local value of deployment, which is currently nil ✔ 01 ec2-user@54.249.173.184 0.407s 02 $HOME/.rbenv/bin/rbenv exec bundle config --local path /var/www/git_toreka/shared/bundle 02 You are replacing the current local value of path, which is currently nil ✔ 02 ec2-user@54.249.173.184 0.255s 03 $HOME/.rbenv/bin/rbenv exec bundle config --local without development:test 03 You are replacing the current local value of without, which is currently nil ✔ 03 ec2-user@54.249.173.184 0.235s 00:13 bundler:install The Gemfile's dependencies are satisfied, skipping installation 00:13 deploy:assets:precompile 01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile 01 yarn install v1.22.5 01 info No lockfile found. 01 [1/4] Resolving packages... 01 [2/4] Fetching packages... 01 [3/4] Linking dependencies... 01 [4/4] Building fresh packages... 01 success Saved lockfile. 01 Done in 0.09s. 01 01 # 01 # Fatal error in Evacuation 01 # Allocation failed - process out of memory 01 # 01 01 bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile #<Thread:0x0000000002af1778@/home/ec2-user/environment/toreka/vendor/bundle/ruby/2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 1: from /home/ec2-user/environment/toreka/vendor/bundle/ruby/2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /home/ec2-user/environment/toreka/vendor/bundle/ruby/2.5.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@54.249.173.184: rake exit status: 133 (SSHKit::Runner::ExecuteError) rake stdout: yarn install v1.22.5 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 0.09s. rake stderr: # # Fatal error in Evacuation # Allocation failed - process out of memory # bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@54.249.173.184: rake exit status: 133 rake stdout: yarn install v1.22.5 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 0.09s. rake stderr: # # Fatal error in Evacuation # Allocation failed - process out of memory # bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile Caused by: SSHKit::Command::Failed: rake exit status: 133 rake stdout: yarn install v1.22.5 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 0.09s. rake stderr: # # Fatal error in Evacuation # Allocation failed - process out of memory # bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile Tasks: TOP => deploy:assets:precompile (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@54.249.173.184: rake exit status: 133 rake stdout: yarn install v1.22.5 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 0.09s. rake stderr: # # Fatal error in Evacuation # Allocation failed - process out of memory # bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: DEBUG [40b78d88] Running if test ! -d /var/www/git_toreka/releases/20210121031636; then echo "Directory does not exist '/var/www/git_toreka/releases/20210121031636'" 1>&2; false; fi as ec2-user@54.249.173.184 DEBUG [40b78d88] Command: if test ! -d /var/www/git_toreka/releases/20210121031636; then echo "Directory does not exist '/var/www/git_toreka/releases/20210121031636'" 1>&2; false; fi DEBUG [40b78d88] Finished in 0.050 seconds with exit status 0 (successful). INFO [7c035e49] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile as ec2-user@54.249.173.184 DEBUG [7c035e49] Command: cd /var/www/git_toreka/releases/20210121031636 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" RAILS_ENV="production" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile ) DEBUG [7c035e49] yarn install v1.22.5 DEBUG [7c035e49] info No lockfile found. DEBUG [7c035e49] [1/4] Resolving packages... DEBUG [7c035e49] [2/4] Fetching packages... DEBUG [7c035e49] [3/4] Linking dependencies... DEBUG [7c035e49] [4/4] Building fresh packages... DEBUG [7c035e49] success Saved lockfile. DEBUG [7c035e49] Done in 0.09s. DEBUG [7c035e49] # # Fatal error in Evacuation # Allocation failed - process out of memory # DEBUG [7c035e49] bash: line 1: 3660 Trace/breakpoint trap $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile ec2-user:~/environment/toreka (master) $
試したこと
❶yarnの導入
SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@54.249.173.184:
上記のようなエラーが発生していたためEC2上にyarn
をインストールしました。
yarn導入にあたり参考にしたサイト
Complete! [root@ip-172-31-36-245 ~]# yarn --version 1.22.5
❷SSH鍵の登録
SSHKit::Runner::ExecuteError: Exception while executing
で検索をかけるとこちらのサイトがヒットし、再起動するとSSH鍵が消えてしまうとのことだったので
ec2-user:~/environment $ cd ~/.ssh ec2-user:~/.ssh $ ssh-add ~/.ssh/torekabodymake_keypair.pem Could not open a connection to your authentication agent. ec2-user:~/.ssh $ eval "$(ssh-agent)" Agent pid 16072 ec2-user:~/.ssh $ ssh-add ~/.ssh/torekabodymake_keypair.pem Identity added: /home/ec2-user/.ssh/torekabodymake_keypair.pem (/home/ec2-user/.ssh/torekabodymake_keypair.pem)
上記実行してみましたがエラー文に記載しましたようにエラーを吐いてしまっているような状況です。
同じようなエラー内容が繰り返されていたり検索にかけても今一つ解決に足りるピースが見つかっていないような状況でございます。
恐れ入りますがcapistrano周りで詳しい方おりましたらご教授願います。
よろしくお願い致します。
その他
amazonlinux2
EC2
AWS
Cloud9
Rails5.2
ruby2.5.1
mysql8
追記
回答1件
あなたの回答
tips
プレビュー