- Newest
- Most votes
- Most comments
I manually created the zip folder to see if at least it will work this way. So i created a folder (my-app) with a .platform, app.jar & the Procfile, i zipped the content of the folder as per the documentation.
.platform => .platform/nginx/conf.d/client_max_body_size.conf app.jar => application Procfile => web: java -jar app.jar
I made sure the Procfile has no new line at the end, has the necessary file permission 644 cause i read somewhere that this could be an issue.
I connected to the ec2 instance and i could see the Procfile and app.jar file put in the environment correctly and i was also able to run the Procfile command manually.
But nevertheless i was getting this error message from the elastic beanstalk log files
[ERROR] An error occurred during execution of command [self-startup] - [CheckProcfileForJavaApplication]. Stop running the command. Error: there is no Procfile and no .jar file at root level of your source bundle
Now today morning the most weird thing happened, i logged in to the environment to continue from where i left of, i noticed the Procfile and the .jar file were gone, also the instance was updated from t4g.micro to t4g.large... anw i did the same thing uploading the same zip, and this time it worked... :) i don't know what is going on but this is really weird.
Anw i verified that the nginx configuration is correctly put under the /etc/nginx/conf.d directory and indeed the configuration took effect.
I am still left to wonder what i was doing wrong yesterday since this morning i did exactly the same thing... maybe i was too tired
So this can be one workaround for the people trying to deploy their app using a jar file, the optimal solution would be to package the app in such a way automatically but this has to do more with maven and the pom file rather than elastic beanstalk, still it would be good if aws could provided an example project.
I haven't seen any ProcFile in my project structure, is it required for this process? if yes, how do I create it?
Hello, I understand that you want to change the max upload size for nginx reverse proxy. Below are the steps to achieve the same :
- To extend the Elastic Beanstalk default NGINX configuration, add the .conf configuration file client_max_body_size.conf that includes the following:
client_max_body_size 50M; Note: In the preceding example, the value of the client_max_body_size is updated to 50M. Substitute any value in place of 50 as per your requirements.
- Copy the .conf configuration file client_max_body_size.conf to a folder named .platform/nginx/conf.d/ in your application source bundle. The Elastic Beanstalk NGINX configuration includes .conf files in this folder automatically. Make sure to create this path if it doesn't exist in your source bundle. The following example shows the structure of the .platform directory and .conf file in the application zip file: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html#:~:text=Platform%20script%20tools-,Application%20example%20with%20extensions,-The%20following%20example
Here instead of custom.conf you would put your client_max_body_size.conf file.
The file client_max_body_size.conf has a path like this: my-app/.platform/nginx/conf.d/client_max_body_size.conf.
This example link also shows the project structure consisting of JAR files, Procfiles and your nginx configuration file.
-
Deploy your code and the new .platform/ directory together as a new application version in your Elastic Beanstalk environment.
-
After the deployment is completed, log in to the instance running on the Elastic Beanstalk environment. After logging in, check that the settings to the NGINX server are applied. To do this, use the following command:
$ sudo nginx -T | egrep -i "client_max_body_size"
The output of the command :
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful client_max_body_size 50M;
If you have any further query regarding the behaviour of your Beanstalk environment I would suggest you to open a case with AWS Support and share your environment ID there so that they can assist you further.
Everything you wrote i had already went through, doesn't really help someone to solve the issue but thank you for trying, also an answer is already accepted on this thread. for anyone looking for a helpful and detailed answer have a look at this -> https://repost.aws/questions/QUd2Eb1oVBSEOTX_LAuP8cWA/java-maven-deployed-in-elastic-bean-stalk-how-to-install-3rd-party-package-wkhtmltopdf
Relevant content
- Accepted Answerasked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
I do something similar but I use Apache instead nginx, but I do something very similar to overwrite the existing apache config file 00_application.conf ; I put the replacement file in the .platform/httpd/conf.d/elasticbeanstalk direct which starts at the root of the artifact ( .war or .zip file ) . It took a while to get it exactly right, I ended up configuring the beanstalk instances so that I could get to them using the SSM agent so I was able to ssh onto them and troubleshoot and check the results.