実現したいこと
GitHub ActionsのDeployがうまくいかず
Error: Process completed with exit code 255.
のエラーが発生。解消して本番環境でアプリを動作させたい。
※就活準備段階のPF修正で、本当に困っております。
どうか御助力頂けると助かります...(/ _ ; )
前提
・railsアプリをGithub ActionsでCI/CD設定し、デプロイ済み。
・修正したい箇所があったので、修正、Cloud9へのpushは問題なくできている。
※ 修正段階で、新たなGemを入れようとしたがエラーが出たのでGemの記述はコメントアウト状態にした経緯あり。
GitHub Actions Deployでのエラーメッセージ
エラーメッセージ Run echo "$PRIVATE_KEY" > private_key && chmod 600 private_key echo "$PRIVATE_KEY" > private_key && chmod 600 private_key ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOST_NAME} 'cd SNACKERS && git pull origin main && ~/.rbenv/shims/bundle install && ~/.rbenv/shims/bundle exec rails assets:precompile RAILS_ENV=production && ~/.rbenv/shims/bundle exec rails db:migrate RAILS_ENV=production && if [[ -e tmp/pids/puma.pid ]];then sudo kill $(cat tmp/pids/puma.pid); echo kill puma process;fi && ~/.rbenv/shims/rails s -e production' shell: /usr/bin/bash -e {0} env: PRIVATE_KEY: *** USER_NAME: *** HOST_NAME: *** ssh: connect to host *** port 22: Connection timed out Error: Process completed with exit code 255.
EC2 git status実行後のコンソール上のエラーメッセージ
On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) vendor/bundle/ruby/3.1.0/bin/bundle vendor/bundle/ruby/3.1.0/bin/bundler vendor/bundle/ruby/3.1.0/cache/bundler-2.3.7.gem vendor/bundle/ruby/3.1.0/cache/mysql2-0.5.5.gem vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0/mysql2-0.5.5/ vendor/bundle/ruby/3.1.0/gems/bundler-2.3.7/ vendor/bundle/ruby/3.1.0/gems/mysql2-0.5.5/ vendor/bundle/ruby/3.1.0/specifications/bundler-2.3.7.gemspec vendor/bundle/ruby/3.1.0/specifications/mysql2-0.5.5.gemspec nothing added to commit but untracked files present (use "git add" to track)
試したこと
本番環境でコンフリクトが起きてるのかと想定
こちらの記事https://qiita.com/wak10/items/a71759389b9cd14559ac
を参考にec2上のアプリディレクトリを削除してデプロイし直そうと思いましたが、サーバー起動準備段階のbundle exec rails assets:precompile RAILS_ENV=productionを実施すると、/usr/bin/env: ruby_executable_hooks: No such file or directoryのエラーが出て解決できず。
補足情報(FW/ツールのバージョンなど)
・Ruby 3.1.2
・Rails 6.1.7.3
・本番環境 Nginx/Puma/Linux2/AWS EC2/MySQL

あなたの回答
tips
プレビュー