docker-compose build failing during Elastic Beanstalk deployment - amazon-web-services

Whenever I try to deploy my React-Flask app on elastic beanstalk, the deployment fails and the events on the EB console says:
"Unsuccessful command execution on instance id(s)..."
So I checked through the full logs and I found this error in eb-engine.log:
[WARN] failed to execute command: docker-compose build, retrying...
I think this is what's causing the deployment to fail. Any idea why docker-compose build is failing? It builds fine locally. Thanks!

Related

AWS App Runner "Create Failed" on health check

I'm creating my first app on AWS App Runner. I have a simple nginx Docker image that works locally by serving html on localhost:8080.
When I try to deploy it, the result is "Create Failed". Upon digging into the CloudWatch logs, I see that the health check failed. The health check is configured to ping the root of the service "/" at port 8080.
I was able to resolve this by deleting my App Runner app (this is currently the only way to change the configuration-- see this issue), then creating a new one and specifying the health check to ping port 80.
Are you getting this error:
10-21-2021 02:13:32 PM [AppRunner] Health check on port '80' failed. Service is rolling back. Check your configured port number. For more information, read the application logs.
10-21-2021 02:07:40 PM [AppRunner] Performing health check on port '80'.
10-21-2021 02:07:30 PM [AppRunner] Provisioning instances and deploying image.
10-21-2021 02:07:20 PM [AppRunner] Successfully pulled image from ECR.
10-21-2021 02:04:58 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
10-21-2021 02:04:57 PM [AppRunner] Service creation started.
If you are building on an M1 mac by chance? If so that's probably the reason. The image that's being built is of the ARM architecture, and App Runner or Fargate is an x86 runtime.
Aws is working on fixing this issue here: #1949
In the meantime, there's a workaround, you can prefix copilot commands with the DOCKER_DEFAULT_PLATFORM=linux/amd64
For example:
DOCKER_DEFAULT_PLATFORM=linux/amd64 copilot deploy
So basically when you build your docker image just use:
You can use buildx (mobi) which suipport cli for platform.
docker build --platform linux/amd64 -t your-docker-image-name .
Hope that helps, and sorry for the trouble 🙏

Django with postgresql deployment on aws elastic beanstalk

I’ve been trying to deploy a django application with postgresql db on aws elastic beanstalk and i ran into many issues that i surfed and solved. Now the application uploads fine however the environment is still not green and I constantly am receiving 502 bad gateway nginx. I’ve checked nginx logs which say 111 connection refused etc. I’ve tried changed the port to 8001 from 8000 but didn’t work out. Somebody please guide me on how to deploy my application successfully.
Here are some of the common errors logfiles. Try checking them out
--- Common Dbug Errors ---
$ eb logs
--Files (after eb ssh):
$ eb ssh
1.sudo nano /var/log/cfn-init.log
2.sudo nano /var/log/cfn-init-cmd.log (see command output and error from config)
And are you using AWS RDS to for PostgreSQL?
Here is a detailed explanation and some common error fixes discuss in this blog

Elastic Beanstalk not deploying and cannot find error in error logs

I am having an issue getting my application to deploy on the elastic beanstalk. It works on my local machine flawlessly however when I try to deploy to beanstalk it fails and rolls back to the sample application. Then when I check the error.log file it is empty. Also when I check the node.js file the only output is
> Elastic-Beanstalk-Sample-App#0.0.1 start /var/app/current
> node app.js
Server running at http://127.0.0.1:8081/
I don't understand how to find the error it sends when deploying to the server. Where should I be looking?
The reason it was deleting my logs is I had rolling with additional batch enabled. Thereby deleting my logs on rollback. As far as the error was concerned it was an error in my code that caused it to require a module that didn't exist
It appears that you are running the app with the HOST set to localhost (127.0.0.1). The localhost is accessible only to internal processes on your Beanstalk instance. Change the host to 0.0.0.0 so that the app can be accessed from other IP addresses.

Docker container runs local, but not on AWS Elastic BeanStalk

I created Docker container with flash and gunicorn. I tested it locally successfully and pushed it without any problems to Docker hub. I also have AWS EB CLI installed so I tested it with eb local run. Everything worked fine.
I used the following link to deploy it on AWS Elastic BeanStalk. When I visit URL of the application, I am getting HTTP ERROR 504. I looked at log file and there are any error messages.
How can I further troubleshoot this issue?

node command does not work on beanstalk created with nodejs preconfiguration

I have an issue, I create a beanstalk with nodejs configuration and after it is in running status I ssh to the ec2 created by beanstalk. So my assumtion is that nodejs and npm are already installed in that ec2 but when I run
node --version
npm --version
I get the following errors:
-bash node:: command not found
-bash npm:: command not found
What am I missing here? Does this mean that I need to install node manually?
Yes, You have to setup nodejs.
Check the documentation for how to setup the nodejs environment for beanstalk.
This is a complete guide on how to setup an Express app on elastic beanstalk.