Procfile issues with AWS Elastic Beanstalk on Amazon Linux 2

I’m running into an issue updating the demo.moqui.org server which uses AWS Elastic Beanstalk and runs on a Java SE server. This is the approach described in the Run & Deploy guide where the moqui plus runtime .war file is renamed to a .zip file and then uploaded, and just like old school Heroku stuff the AWS Java SE image looks at the Procfile in the .zip file to see what to run.

This worked fine until the recent Amazon Linux 2 based Java SE image, which also uses the Amazon Corretto distro of OpenJDK. That is a necessary update because the old Elastic Beanstalk images are deprecated, and because only the Amazon Linux 2 and Corretto option supports Java 11.

The exact “Platform” name is: 64bit Amazon Linux 2 v3.2.15 running Corretto 11

Relevant docs:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-platform.html
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-procfile.html

What is happening now, according to the EB log file, is that when parsing the Procfile there is an error and then the server start process quits. Here is the error message:

“failed to generate rsyslog file with error Procfile could not be parsed”

There isn’t much more in the logs, only 2 ERROR level messages and the next one just says it is stopping because of this error.

Googling around I wasn’t able to find anything like this, and I don’t see anything invalid in the Procfile either. As random guesses I’ve tried two things that did not work:

  1. trim the file down to just the “web: …” line (remove the comments) so that it just contains web: java -cp . MoquiStart port=5000 conf=conf/MoquiProductionConf.xml
  2. the docs mention executable JAR files a bunch so I was wondering if maybe something is parsing the Procfile to find the JAR file(s) used… so I made some changes to MoquiStart.java to allow it to run from an executable JAR file inside the .zip file (which is the executable WAR file) so that when it is expaneded the Procfile has java -jar start.jar ... instead of java -cp ... with the main class to run

My next uninformed guess is to try a different version of the platform, ie the previous version of the Corretto 11 image to see if perhaps there is some sort of bug in the current version.

Does anyone have any idea what the solution to this might be, or even what the problem is?

Has anyone run into issues with the OOTB Procfile or using the moqui-plus-runtime.war file renamed to a .zip file like this?

1 Like

I made another attempt, using a minimal Procfile (web: ./Procstart.sh plus a newline) and a Procstart.sh file (with java -cp . MoquiStart port=5000 conf=conf/MoquiProductionConf.xml).

This time I copied the text from the eb-engine.log log file:

2022/06/06 22:39:34.876190 [INFO] Generating rsyslog config from Procfile
2022/06/06 22:39:34.876229 [ERROR] failed to generate rsyslog file with error Procfile could not be parsed
2022/06/06 22:39:34.876237 [ERROR] An error occurred during execution of command [app-deploy] - [GetToggleForceRotate]. Stop running the command. Error: failed to generate rsyslog file with error Procfile could not be parsed 

2022/06/06 22:39:34.876241 [INFO] Executing cleanup logic
2022/06/06 22:39:34.876323 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment successfully used commands in the 'Procfile' to start your application.","timestamp":1654555171528,"severity":"INFO"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1654555174876,"severity":"ERROR"}]}]}

Then I made one more attempt and that was to remove the newline from the end of the Procfile, and then it worked!

So, for future reference using the newer Elastic Beanstalk Java SE image (on Amazon Linux 2 and Corretto 11) do NOT include a trailing line ending in the Procfile, and possibly also do not use any comments. I’ll try more variations over time.

2 Likes

It’s funny how software can be so specific about the things that are needed.