Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 使用CF模板更新AWS堆栈_Ruby_Amazon Web Services_Amazon Cloudformation - Fatal编程技术网

Ruby 使用CF模板更新AWS堆栈

Ruby 使用CF模板更新AWS堆栈,ruby,amazon-web-services,amazon-cloudformation,Ruby,Amazon Web Services,Amazon Cloudformation,希望大家都安全 我有一个托管在AWS Beanstalk上的Ruby on Rails应用程序。我正在使用CloudFormation模板来更新任何堆栈,例如Ruby版本、Linux平台升级等 我正在尝试升级,Linuxbox到2.11.7和Ruby到2.6.6,然后ElasticSearch到7.4 我在CloudFormation YML模板中进行了这些更改,然后运行aws CloudFormation update stack命令应用这些更改 虽然更改需要时间,但我无意中从Web AWS控

希望大家都安全

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

我正在尝试升级,Linuxbox到
2.11.7
Ruby
2.6.6
,然后ElasticSearch
7.4

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

虽然更改需要时间,但我无意中从Web AWS控制台单击了重建环境,因此,以前配置的所有设置(如SQS负载平衡器等)都被新设置替换

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

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\u主机
ENV变量中提取旧URL

来自我的CF模板的信息:


我现在可以根据要求提供信息。请标记我以查看CF模板中的内容这是一个配置问题

每当我运行
aws update stack
命令时,它都会转到s3并提取(源代码的)zip代码,并且在Gemfile中,该zip代码的ruby版本被设置为2.6.5


因此,我上传了源代码的新副本,然后执行了updatestack命令,它工作了

这是一个配置问题

每当我运行
aws update stack
命令时,它都会转到s3并提取(源代码的)zip代码,并且在Gemfile中,该zip代码的ruby版本被设置为2.6.5


因此,我上传了源代码的新副本,然后执行了updatestack命令,它成功了

我想知道AWS Beanstalk是否由CloudFormation管理。也许你可以共享你的模板?你的堆栈现在处于什么状态?你是说@Marcin的状态?在AWS控制台中,我的web和worker环境都处于红色状态,我指的是CloudFormation堆栈。我知道您在堆栈中做了一些更新,但同时修改了cloudformatio堆栈之外的资源?那么堆栈更新失败了?@Marcin是的,我在堆栈中做了一些更新,执行了CF update stack命令,然后我重建了环境(这是我在CF stack之外做的,即从AWS控制台),从这一步开始,每次尝试运行update stack命令都失败了。我想知道AWS Beanstalk是否由CloudFormation管理。也许你可以共享你的模板?你的堆栈现在处于什么状态?你是说@Marcin的状态?在AWS控制台中,我的web和worker环境都处于红色状态,我指的是CloudFormation堆栈。我知道您在堆栈中做了一些更新,但同时修改了cloudformatio堆栈之外的资源?那么堆栈更新失败了?@Marcin是的,我在堆栈中做了一些更新,执行了CF update stack命令,然后我重建了环境(这是我在CF stack之外做的,即从AWS控制台),从这一步开始,每次尝试运行update stack命令都失败了