英文:
Application source bundle doesn't work when uploaded to AWS Elastic Beanstalk
问题
我正在尝试上传一个在Linux 2 Coretto 11环境中运行的Java/Spring Boot应用程序。当我上传独立的JAR文件时,一切正常,但后来我开始创建一个应用程序包,以便我可以配置环境,特别是client_max_body_size
。
看起来应用程序正在启动,但是之后发生了一些错误,没有太多信息(日志)。在EB控制台中,我不断收到以下错误:在中止的部署过程中,一些实例可能已经部署了新的应用程序版本。为了确保所有实例都运行相同的版本,请重新部署适当的应用程序版本。
我将包上传为.zip文件-它包含了JAR文件,一个Procfile文件和一个包含配置文件的.ebextensions目录(~/.ebextensions/01_files.config),这三者都在zip文件的根目录中。后两者如下所示:
Procfile:web: java -Dfile.encoding=UTF-8 -Xms2g -Xmx2g -jar DocumentSummarizer-1.0-SNAPSHOT.jar
配置文件:
01_files.config
配置文件的YAML缩进正确(2个空格)。
我觉得我已经尝试了从StackOverflow和Amazon文档中找到的各种方法来实现这个目标,所以现在我感到很困惑。任何帮助都将不胜感激。
更新:
u/Marcin的回答是正确的(需要将nginx设置放在.platform/nginx/conf.d/mynginx.conf中)。在那之后,我遇到的第二个问题是在值后面没有分号。我以为只有在有多个值时才需要,但是除非在每个值后面都有一个分号,否则它不会正常工作(例如client_max_body_size 20MB;
)。
英文:
I'm trying to upload a Java/Spring Boot app that runs in a Linux 2 Coretto 11 environment. Everything worked fine when I uploaded the standalone JAR files, but I started creating an application bundle instead so I could configure the environment, specifically client_max_body_size
.
It looks like the app is starting but then some error happens with not much info (logs). In the EB console, I keep getting the 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.
I uploaded the bundle as a .zip file- It contains the JAR, a Procfile, and an .ebextensions directory containing a config file (~/.ebextensions/01_files.config), all three of which are in the root directory of the zip file. The latter two are shown below:
Procfile: web: java -Dfile.encoding=UTF-8 -Xms2g -Xmx2g -jar DocumentSummarizer-1.0-SNAPSHOT.jar
config file:
01_files.config
The config file has proper indentation for YAML (2 spaces).
I feel like I've tried every variation from StackOverflow and Amazon's documentation to accomplish this goal, so I'm just beating my head against the wall at this point. Any help would be greatly appreciated.
Update:
u/Marcin's answer was correct (nginx settings needed to be in .platform/nginx/conf.d/mynginx.conf). The second issue that I dealt with for a while after that was not having a semicolon after the value. I thought it was only necessary if you have multiple values, but it won't work properly unless there's one after each value (i.e. client_max_body_size 20MB;
).
答案1
得分: 1
可能的原因是您正在使用基于Amazon Linux 2(AL2)的EB环境。如果是这种情况,则您的01_files.config不正确。
对于AL2,nginx
设置应该在.platform/nginx/conf.d/
中提供,而不是.ebextentions
。因此,例如,您可以创建以下配置文件:
.platform/nginx/conf.d/mynginx.conf
其中内容为:
client_max_body_size 20M
请注意,可能还有许多其他问题,尤其是如果您遵循了任何针对AL1的指令。原因是AL1和AL2之间有许多差异。
英文:
A likely reason is that you are using EB env based on Amazon Linux 2 (AL2). If this is the case, then your the 01_files.config is incorrect.
For AL2, the nginx
settings should be provided in .platform/nginx/conf.d/
, not .ebextentions
. Therefore, for example, you could create the following config file:
.platform/nginx/conf.d/mynginx.conf
with the content of:
client_max_body_size 20M
Please note, that there could be many other issues, which are not apparent yet, especially if you followed any instructions for AL1. The reason is that there are many differences between AL1 and AL2.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论