[英]Update AWS stack with CF template
Hope everyone is keeping safe!希望大家注意安全!
I have a Ruby on Rails application hosted on AWS Beanstalk.我在 AWS Beanstalk 上托管了一个 Ruby on Rails 应用程序。 I am using CloudFormation template, to update any stack for eg, Ruby version, Linux Platform upgrade etc.
我正在使用 CloudFormation 模板来更新任何堆栈,例如 Ruby 版本、Linux 平台升级等。
I was trying to upgrade, Linux box to 2.11.7
and Ruby to 2.6.6
and then ElasticSearch to 7.4
我正在尝试升级, Linux框到
2.11.7
和Ruby到2.6.6
然后ElasticSearch到7.4
I was doing these changes in CloudFormation YML template and then I ran aws cloudformation update-stack
command to apply these changes.我在 CloudFormation YML 模板中进行了这些更改,然后我运行了
aws cloudformation update-stack
命令来应用这些更改。
While the changes took time, I accidentally clicked on Rebuild Environment from Web AWS Console as a result, all the previously configured settings like SQS , Load balancer etc., were replaced by new settings.虽然更改需要时间,但我不小心从 Web AWS 控制台单击了Rebuild Environment ,结果,之前配置的所有设置,如SQS 、负载均衡器等,都被新设置替换了。
Now, whenever I am trying to execute the update-stack
command, it fails with below errors:现在,每当我尝试执行
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.
I can confirm that I have Ruby-2.6.6 set.我可以确认我设置了 Ruby-2.6.6。 I am not sure from where it is picking up the old version of Ruby?
我不确定它从哪里获取旧版本的 Ruby?
Is there any way I can fix this?有什么办法可以解决这个问题吗? OR forcefully apply template changes?
或强制应用模板更改?
Any help on this would be highly appreciated.对此的任何帮助将不胜感激。
[UPDATE]: When I try to connect to ElasticSearch from Rails console, I get: [更新]:当我尝试从 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'
The new URL of elasticsearch instance is different but it is still picking up the old URL from ELASTICSEARCH_HOST
ENV variable. elasticsearch 实例的新 URL 实例有所不同,但它仍然从
ELASTICSEARCH_HOST
ENV 变量中获取旧的 URL。
Information from my CF template:来自我的 CF 模板的信息:
I can now provide info as per request.我现在可以根据要求提供信息。 please tag me to see what I have in CF template
请标记我以查看我在 CF 模板中的内容
This was a config issue.这是一个配置问题。
Whenever I was running aws update-stack
command, it was going to s3 and pulling the zip (of the source code) code and in Gemfile of that zip code ruby version was set to 2.6.5.每当我运行
aws update-stack
命令时,它都会转到 s3 并拉取 zip(源代码)代码,并在该 zip 代码的 Gemfile 中将 ruby 版本设置为。
So, I'd uploaded the fresh copy of the source code and then executed the update-stack command and it worked所以,我上传了源代码的新副本,然后执行了 update-stack 命令,它工作了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.