elasticbeanstalk fail to deploy web environment /var/pids/web.pid: no such file or directory - amazon-web-services

I would like to deploy a JAVA application (based on PlayFramework 1.x) on AWS Beanstalk.
I am using a web server environment based on Corretto 8 running on 64bit Amazon Linux 2/3.1.6.
I also added a load balancer in the environment.
During the deployment, my hooks work well (database schema evolutions for example) then comes the time to launch the web server.
The deployment fails with the following error:
[ERROR] update processes [web cfn-hup nginx healthd] pid symlinks failed with error Read pid source file /var/pids/web.pid failed with error:open /var/pids/web.pid: no such file or directory
[ERROR] An error occurred during execution of command [app-deploy] - [Track pids in healthd]. Stop running the command. Error: update processes [web cfn-hup nginx healthd] pid symlinks failed with error Read pid source file /var/pids/web.pid failed with error:open /var/pids/web.pid: no such file or directory
I don't use any specific configuration for nginx.
I run the JAVA application on the default port (5000).
I saw on the AWS forums and stackoverflow that some people had this problem on worker environments but I don't use this configuration.
Have you ever encountered this problem?

Your web.service is not able to start. You might be missing a manifest in your jar, or you might be missing the main class in your manifest file.

Related

OnPrem TeamCity on Windows cannot pull chnged from Bitbucket repos anymore

All of a sudden the latest version of TeamCity 2021.2 (build 99542) on Windows cannot pull changes from Bitbucket git repos anymore with the following error:
org.eclipse.jgit.errors.TransportException
Session.connect: java.io.IOException: End of IO Stream Read
I have:
updated Java version to amazon-corretto-11.0.13.8.1
Regenerated SSH key
but no luck. Agent is running as a Windows service.
Any suggestions?
More detailed error:
Failed to collect changes,
error:
org.eclipse.jgit.errors.TransportException:
git#bitbucket.org:[**]/[**].git:
Session.connect:
java.io.IOException:
End of IO Stream Read,
VCS root:
"git#bitbucket.org:[**]/[**].git" {instance id=38, parent internal id=18, parent id=[**]/[**], description: "git#bitbucket.org:[**]/[**].git#refs/heads/test"}

ClassNotFoundException - when building the image & push it to GCR using jib-maven-plugin in BitBucket pipeline

I am getting the below error in my GCP Cloud Run service:
Error: Could not find or load main class com.sdas.demo.sd.Application
Caused by: java.lang.ClassNotFoundException: com.sdas.demo.sd.Application
What I was doing:
I have a spring boot application where I used jib-maven-plugin. In BitBucket pipeline, I was executing the below command:
mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service
After that deploying this GCR image to Cloud Run using gcloud command from BitBucket pipeline. This deployment failed with the error that 'Could not load main class'.
But if I run the mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service from my computer git bash for the same spring boot application code and then deploy it to Cloud Run (via gcloud command or via console or via pipeline); it's deployed successfully.
I used 'mainClass' tag under jib-maven-plugin in pom.xml. But still it is unable to find or load the main class.
Can anyone help how to identify the problem? Is this a classpath issue or environment issue?
Issue sorted now.
Root cause:
'No resources found to compile' - I found this message in the build log. This message remind me something wrong within the application package.
My system is running on Windows 10 and my application directory starting with 'Java.com.demo.sdas' (J in capital). Since Windows is case in sensitive; it is not causing an issue.
BitBucket pipeline running on Linux server and it is case sensitive. Thus it is unable to find the application directory starting with 'Java.com.demo.sdas'.
Solution: Renamed the directory as 'java' and then everything is working as expected.

Deploy docker container fails on AWS Beanstalk

I have a simple application (docker) that I want to deploy through the AWS beanstalk.
U have a zip arhive with 2 files:
+simple.jar
+Dockerfile
Dockerfile contains these records:
FROM openjdk:11
WORKDIR /usr/app
COPY ./ ./
EXPOSE 80
CMD ["java", "-jar", "simple.jar"]
I am getting this error during dpeloyment
[ERROR] An error occurred during execution of command [app-deploy] - [Run Docker Container]. Stop running the command. Error: open file failed with error open /opt/elasticbeanstalk/deployment/.aws_beanstalk.current-container-id: no such file or directory
local build through "docker build" works and application is available on the port 80.
So I am not sure what to do and how to debug the problem more deeply.
So problem was solved by changing the Platform branch from
"Docker running on 64but Amazon Linux 2" to
"Docker running on 64but Amazon Linux".
It has different versions, but actually why it is not running needs more deep investigation.
I experienced this issue when my deployment had a ".ebextensions" directory. Removing the directory solved the issue.
AWS Notes
On Amazon Linux 2 platforms, instead of providing files and commands in .ebextensions configuration files, we highly recommend that you use Buildfile. Procfile, and platform hooks whenever possible to configure and run custom code on your environment instances during instance provisioning. For details about these mechanisms, see Extending Elastic Beanstalk Linux platforms.

AWS Beanstalk Platform .NET Core running on 64bit Amazon Linux 2/2.0.2 Publish Version Error

, I am trying to Publish my Elastic Beanstalka .NetCore Project Using Azure DevOps Pipeline, But Azure DevOps Pipeline also comes up to Beanstalk Publish without any problem in Restore, Build, Publish Steps, but I get the following error in AWS Beanstalka Log file.
Project .Net Core 2.2
In the Document of AWS: https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.dotnetlinux
[INFO] Executing instruction: RunAppDeployPreBuildHooks
[INFO] The dir .platform/hooks/prebuild/ does not exist in the application. Skipping this step...
[INFO] Executing instruction: CheckProcfileForDotNetCoreApplication
[INFO] checking application and updating executable file permissions...
[INFO] checking Procfile...
[ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: there is no .runtimeconfig.json file for your single application. Please provide a valid application
I am having the same issue.
I don't know if this is the answer, as I am new to AWS, but I have found:
The instructions at https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html only work if you create the Environment with a Windows server. It doesn't actually come right out and say that. It says:
For Platform, select the platform and platform branch that match the language used by your application.
But in the next section, it says:
IIS is the web server that runs the application on the Amazon EC2
instances in your Elastic Beanstalk environment.
And IIS only runs on Windows. So this implies the instructions are for Windows.
If you want to use Linux, just use the site.zip file these instructions have you create and upload that. You don't need the manifest file or the zip-within-zip. Just upload the site.zip.

when start application on cloudfoundry got error of 310, "web.xml not found"

Today when I tried to run the sample application hello-java which from git#github.com:SpringSource/cloudfoundry-samples.git, I got the following errors when start the application,
Starting hello-java-from-linux-1... FAILED
CFoundry::AppStagingError: 310: Staging failed: 'Staging task failed:
Staging plugin failed: /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:28:in block in stage_application': Web application staging failed: web.xml not found (RuntimeError)
from /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:22:inchdir'
from /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:22:in stage_application'
from /var/vcap/packages/stager/bin/run_plugin:19:in'
I've checked the target war "hello-java-1.0.war" built by maven, the web.xml has been already packaged under WEB-INF.
Here is the pom.xml of the sample application,
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.cloudfoundry.samples
hello-java
1.0
war
javax.servlet
servlet-api
2.5
provided
And here are the vmc version and maven version info,
- vmc 0.4.7,
- Apache Maven 3.0.4
Can anyone help on how to solve the issue? Thanks a lot!
BTW, I've searched the cloudfoundry support site, and found some tips to check log files, however seems that I cannot get log files to check the real error, I ran into the following issues when tried to get the log files.
[niy#niy-fedora hello-java]$ vmc files hello-java-from-linux-1 logs
Getting file contents... FAILED
CFoundry::AppStopped: 305: Operation not permitted on a stopped app
For more information, see ~/.vmc/crash
When deploying a java or spring WAR with vmc it's important to be in the same directory as the WAR file at the time you execute vmc.