簡體   English   中英

使用 CF 模板更新 AWS 堆棧

[英]Update AWS stack with CF template

希望大家注意安全!

我在 AWS Beanstalk 上托管了一個 Ruby on Rails 應用程序。 我正在使用 CloudFormation 模板來更新任何堆棧,例如 Ruby 版本、Linux 平台升級等。

我正在嘗試升級, Linux框到2.11.7Ruby2.6.6然后ElasticSearch7.4

我在 CloudFormation YML 模板中進行了這些更改,然后我運行了aws cloudformation update-stack命令來應用這些更改。

雖然更改需要時間,但我不小心從 Web AWS 控制台單擊了Rebuild Environment ,結果,之前配置的所有設置,如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。

來自我的 CF 模板的信息:

我現在可以根據要求提供信息。 請標記我以查看我在 CF 模板中的內容

這是一個配置問題。

每當我運行aws update-stack命令時,它都會轉到 s3 並拉取 zip(源代碼)代碼,並在該 zip 代碼的 Gemfile 中將 ruby 版本設置為。

所以,我上傳了源代碼的新副本,然后執行了 update-stack 命令,它工作了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM