gpt4 book ai didi

ruby - 使用 CF 模板更新 AWS 堆栈

转载 作者:行者123 更新时间:2023-12-03 07:27:27 24 4
gpt4 key购买 nike

希望大家注意安全!

我有一个托管在 AWS Beanstalk 上的 Ruby on Rails 应用程序。我正在使用 CloudFormation 模板来更新任何堆栈,例如 Ruby 版本、Linux 平台升级等。

我试图将Linux盒子升级到2.11.7,将Ruby升级到2.6.6并且然后将 ElasticSearch 升级为 7.4

我在 CloudFormation YML 模板中进行了这些更改,然后运行 ​​aws cloudformation update-stack 命令来应用这些更改。

虽然更改需要一些时间,但我不小心从 Web AWS 控制台单击了重建环境,结果,之前配置的所有设置(例如 SQS负载均衡器) 等,已被新设置取代。

现在,每当我尝试执行 update-stack 命令时,它都会失败并出现以下错误:

2020-06-09 15:25:44 UTC+0530
WARN
Environment health has transitioned from Info to Degraded. Command failed on all instances.
Incorrect application version found on all instances. Expected version "code-pipeline-xxxxxxxxxx" (deployment 2377). Application update failed 40 seconds ago and took 79 seconds.

2020-06-09 15:25:03 UTC+0530
INFO
The environment was reverted to the previous configuration setting.

2020-06-09 15:24:44 UTC+0530
INFO
Environment health has transitioned from Ok to Info. Application update in progress on 1 instance. 0 out of 1 instance completed (running for 39 seconds).

2020-06-09 15:24:30 UTC+0530
ERROR
During an aborted deployment, some instances may have deployed the new application version.
To ensure all instances are running the same version, re-deploy the appropriate application version.

2020-06-09 15:24:30 UTC+0530
ERROR
Failed to deploy application.

2020-06-09 15:24:30 UTC+0530
ERROR
Unsuccessful command execution on instance id(s) 'i-xxxxxxxxxx'. Aborting the operation.

2020-06-09 15:24:30 UTC+0530
INFO
Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

2020-06-09 15:24:30 UTC+0530
ERROR
[Instance: i-xxxxxxxxxx] Command failed on instance. Return code: 18 Output: (TRUNCATED)...g: the running version of Bundler (1.16.0) is older than the version that created the lockfile (1.17.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Your Ruby version is 2.6.6, but your Gemfile specified 2.6.5. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

2020-06-09 15:24:19 UTC+0530
INFO
Deploying new version to instance(s).

2020-06-09 15:23:45 UTC+0530
INFO
Updating environment developWeb's configuration settings.

2020-06-09 15:23:36 UTC+0530
INFO
Environment update is starting.

我可以确认我已经设置了 Ruby-2.6.6。我不确定它从哪里获取旧版本的 Ruby?

有什么办法可以解决这个问题吗?或者强制应用模板更改?

对此的任何帮助将不胜感激。

[更新]:当我尝试从 Rails 控制台连接到 ElasticSearch 时,我得到:

Faraday::ConnectionFailed: Failed to open TCP connection to old-elasticsearch-host-name.es.amazonaws.com:80 (Hostname not known: old-elasticsearch-host-name.es.amazonaws.com)
from /opt/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:949:in `rescue in block in connect'
Caused by SocketError: Failed to open TCP connection to old-elasticsearch-host-name.es.amazonaws.com:80 (Hostname not known: old-elasticsearch-host-name.es.amazonaws.com)
from /opt/rubies/ruby-2.6.6/lib/ruby/2.6.0/net/http.rb:949:in `rescue in block in connect'
Caused by Resolv::ResolvError: no address for old-elasticsearch-host-name.es.amazonaws.com
from /opt/rubies/ruby-2.6.6/lib/ruby/2.6.0/resolv.rb:94:in `getaddress'

elasticsearch 实例的新 URL 不同,但它仍然从 ELASTICSEARCH_HOST ENV 变量中获取旧 URL。

来 self 的 CF 模板的信息:

我现在可以根据请求提供信息。请标记我以查看 CF 模板中有哪些内容

最佳答案

这是一个配置问题。

每当我运行 aws update-stack 命令时,它都会转到 s3 并提取 zip(源代码)代码,并且在 Gemfile 中,该邮政编码的 ruby​​ 版本设置为 2.6。 5.

所以,我上传了源代码的新副本,然后执行 update-stack 命令并且它起作用了

关于ruby - 使用 CF 模板更新 AWS 堆栈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62280778/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com