简体   繁体   English

Elastic Beanstalk 在环境变量更新时失败

[英]Elastic Beanstalk fails on environment variables update

I've deployed my Spring boot application to an ELB with Corretto 11 running on 64bit Amazon Linux 2/3.0.1 platform.我已经将我的 Spring 启动应用程序部署到一个 ELB,其中Corretto 11 running on 64bit Amazon Linux 2/3.0.1平台上运行。

When I am trying to add a new Environment Variable from the AWS Console ( Configuration -> Software ) and I hit Apply the update fails and rollbacks to the previous configuration.当我尝试从 AWS 控制台( Configuration -> Software )添加新的环境变量并点击Apply时,更新失败并回滚到以前的配置。

This what I get from the AWS Console on my environment dashboard这是我从环境仪表板上的 AWS 控制台获得的信息在此处输入图像描述

Here are some of the logs that might be useful以下是一些可能有用的日志在此处输入图像描述

The interesting part is when I create a fresh new environment and upload my .jar file and add the environment variables at the instantiation of my environment it works (meaning the environment variables are set correctly).有趣的部分是当我创建一个全新的环境并上传我的.jar文件并在我的环境实例化时添加环境变量时它起作用(意味着环境变量设置正确)。 The problem occurs when I try to update my environment variables when then environment already exists.当我在环境已经存在时尝试更新我的环境变量时,就会出现问题。 Am I missing something?我错过了什么吗?

I tried to use $ eb setenv after the $ eb deploy from my circleci but I still get the same error.$ eb deploy从我的 circleci 之后,我尝试使用$ eb setenv ,但我仍然遇到同样的错误。

I've been digging into this.我一直在研究这个。 And now I know why it fails.现在我知道它为什么失败了。

The reason is that when you add the env variable to your EB, the EB engine is going to download last application version , unzip and replaces it as current application.原因是当您将 env 变量添加到您的 EB 时,EB 引擎将下载上一个应用程序版本,解压缩并将其替换为当前应用程序。

This means, no deployment hooks nor .ebextenstions scripts are not executed .这意味着,不会执行no deployment hooks.ebextenstions脚本。 Therefore, if you do any application setup during deployment it is not going to be re-applied, leading to failure.因此,如果您在部署期间进行任何应用程序设置,它不会被重新应用,从而导致失败。

This is based on my own observations using Python 3.7 running on 64bit Amazon Linux 2/3.0.3 and single-instance EB type.这是基于我自己使用Python 3.7 running on 64bit Amazon Linux 2/3.0.3single-instance EB 类型上的观察。

I found a workaround.我找到了解决方法。 If you set your deployment to immutable, this will go away as it's gonna create a band new ec2 instance for you.如果您将部署设置为不可变,这将 go 消失,因为它将为您创建一个新的 ec2 实例。 Not the best solution if you have quota limitation but it works.如果您有配额限制但它有效,则不是最佳解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM