【发布时间】:2021-03-30 11:01:47
【问题描述】:
我正在使用 CodeDeploy 将我的 Rails 应用程序部署到生产环境。如果我将手动部署代码,即转到 CodeDeploy 仪表板并提供提交 ID 并开始部署,则设置运行良好。我正在尝试自动化这个过程。然后,当将新实例添加到 Amazon ELB 时,CodeDeploy 应该部署最后一次成功的部署。完成此设置后,我收到此错误:
[stdout]Retrying `git clone 'https://github.com/charusat09/blazer.git' "/home/ec2-user/web-app/vendor/bundle/ruby/2.4.0/cache/bundler/git/blazer-8d8d6c852e45320db5b464988b7414ae28b41" --bare --no-hardlinks --quiet` due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/charusat09/blazer.git' "/home/ec2-user/web-app/vendor/bundle/ruby/2.4.0/cache/bundler/git/blazer-8d8d6c852e45320db5b464988b7414ae28b41" --bare --no-hardlinks --quiet` in directory /home/ec2-user/web-app has failed.
[stderr]sh: git: command not found
产生这个错误是因为我在我的 Gemfile 文件中使用了分叉的 gem:
gem 'blazer', github: 'charusat09/blazer', branch: 'master'
当 CodeDeploy 尝试安装此 gem 时,它抛出了上述错误。
为了解决这个错误,我在prepare.sh文件中执行bundle install之前安装了GIT:
sudo yum install -y git
bundle install --deployment --without development test
而且,这个设置就像一个魅力。
问题:
我需要帮助来了解我应该从 CodeDeploy 安装 GIT 等软件包吗?或者这样的安装应该发生在其他地方?
感谢您的意见。
【问题讨论】:
标签: deployment rubygems amazon-elb aws-code-deploy