0
votes

I have s Spring Boot application which is being compiled into a WAR format and which will be deployed to Amazon's Elastic Beanstalk. This application is being built using mvnw.

In order to utilize logging and certain configuration capabilities on Elastic Beanstalk, I need the ability to include -- in the root folder of the Spring Boot application, a folder called .ebextensions.

Apparently, because this folder is not part of the classpath specified in the Spring Boot configuration, mvnw does not include it when it does the build. Worse, placing it in the resources folder won't work either because Elastic Beanstalk, upon startup, will only look for the folder in the WAR file's root folder.

Is there some way to configure mvnw so that it will put .ebextensions into its proper place? Or is there some deployment procedure that I can use in order to .ebextensions included upon deployment of the WAR file? Or is there a standard way of deploying a Spring Boot application to Elastic Beanstalk that will allow the application to include the .ebextensions file?

1
It doesn't work if you put the .ebextensions directory in src/main/webapp? This is where the root content of a WAR file comes from.Steve C
No. The .ebextensions file cannot be there. It needs to be in the root folder of the expanded .WAR file. In other words, if the WAR is expanded to tomcat/webapps/someapp, the .ebextensions file must be in the tomcat/webapps/someapp folder.Factor Three
All files and directories in src/main/webapp are copied to the root of the WAR when maven builds it. For example, I expect that you have a src/main/webapp/WEB-INF directory? If you expand your resulting WAR file that WEB-INF directory will appear in the root. It is no different for your .ebextensions directory.Steve C
I was suggesting that you put .ebextensions in src/main/webapp - not src/main/webapp/WEB-INF. The latter was an example.Steve C
No, Steve, actually it is quite different. I attempted what you suggested before coming here for help. What happens is that mvnw places the WEB_INF folder correctly, but ignores .ebextensions when creating the WAR file. If it hadn't ignored .ebextensions, my question wouldn't be here. I suspect that there needs to be some configuration in the POM file I need to do. I am looking into that...Factor Three

1 Answers

0
votes

You can use the following procedure. Create a deployment script (sh) that build a zip with the required files:

zip -r your-app.zip your-app.war .ebextensions
eb deploy

And in the file .elasticbeanstalk/config.yml just specify the file to upload:

deploy:
  artifact: your-app.zip