Elastic Beanstalk Degraded error not showing any details with Laravel install - amazon-web-services

I'm currently uploading a Laravel package to Elastic Beanstalk and I am receiving a "Degraded" error with no details. Here is what I've done.
When I upload the package status is Ok when I go to the url provided by EB I get a "forbidden" message on my browser.
This is to be expected since the actual path for Laravel is /public.
I then go to Configuration: Software then I modify Document root to /public this then gives me a Degraded errorunder Health Degraded Causes there are no errors. I've also followed AWS way of enabling the enhanced monitoring and it still doesn't show anything. Any ideas what I'm doing wrong?

I found the solution for this. The problem was that I was manually compressing my directory with .zip
According to AWS Documentation it should be done like so:
~/myapp$ zip ../myapp.zip -r * .[^.]*
More details found here:
creating a source bundle

Related

Hosting svelte-kit on aws amplify

I’ve been trying to deploy my svelte-kit project to aws amplify but whenever I do, despite the build and deploy stages being successful, the page returns a 404 error. I’ve changed the build settings to '/build' which is the output directory I've specified, and I'm using svelte-js/adapter-node but have tried a few other adapters. When I download the build artifacts from aws the build is the exact same as what is produced locally (by npm run build).
Build Log Image
Amplify Domain returns: "No web page was found for the web address:"
I've attatched an image of the end of the amplify build, which includes the warning 'no index.html found' as svelte-kit doesn't seem to produce an index.html. Does anyone know how to fix this issue? Anyway to deploy a dynamic svelte project to amplify is what I'm looking for.
I flipped over to using adapter-static (and svelte kit) and it seems to work for me.

Amazon MQ Workshop Unable to complete setup

I followed the setup guide for Cloud9 IDE Workspace setup for Amazon MQ workshop. When I ran ./setup.sh
I got the following output but the setup could not be completed:
Installing jq...
Updating java to 1.8...
Updating maven to 3.6...
There was no error, just the 3 lines and I waited forever.
Apparently, the setup file tried to download maven from http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz but the site could not be reached.
The solution was to edit setup.sh file and replace the URL with the direct link from apache website
https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

AWS Elastic Beanstalk with docker incorrect version

I'm deploying a docker image from Github to AWS elastic beanstalk using travis. That part goes OK, the actual deployment exits with 0 and there is a .zip file in the S3 bucket.
The issue is that, since this is my first time using AWS I created the app using the Sample Application since the code is deployed from Github, and after the deployment I get the health status as degraded (red exclamation sign) with this message:
ERROR
During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
If I go to Causes I find this:
Application deployment failed at 2020-05-01T16:01:58Z with exit status 1 and error: Engine execution has encountered an error.
Incorrect application version "travis-e55e05342a8cc16f3f28f8e184735667a9531ffa-1588311901" (deployment 4). Expected version "Sample Application" (deployment 1).
I even deleted the sample application and re-deployed the one that was uploaded and got that particular error. As you can see in the last message I've deployed this 3 times already, getting the same result.
Finally I downloaded the zip file from the S3 bucket and I found inside basically the src and public folders along with all the files in the root folder such as package.json, .gitignore all the docker files, etc.
EDIT
I created two separate repos in github to test this.
The first repo is a static page in a Docker container, quite simple. I create an environment in EB and start everything with the sample app. Then I push the changes to github, travis does it's thing and deploys the app to AWS. This works fine and the app's env is updated with no errors. This is the repo:
https://github.com/rhernandog/docler-static-page-aws
The second repo is a simple react app. Same procedure, create the environment in EB with the sample app. Push the code to github, travis does it's thing and deploys to AWS. This fails and I keep getting the same error:
Environment health has transitioned from Info to Degraded. Command failed on all
instances. Incorrect application version found on all instances. Expected version
"Sample Application" (deployment 1). Application update failed 1 second ago and
took 2 minutes.
This is the repo for the react app:
https://github.com/rhernandog/react-docker-awseb
In terms of Docker, everything works fine in my local machine.
EDIT 2
Based on #stefansundin suggestion I re-deployed the app to EB and check the logs. I ended looking at the full logs for more information and found this:
/var/log/cfn-hup.log
2020-05-14 17:07:42,605 [WARNING] Action for aws-eb-command-handler exited with 1, returning FAILURE
The only place where I found an error was in the engine log file:
/var/log/eb-engine.log
2020/05/14 17:07:42.514601 [INFO] Executing instruction: Docker Specific Build Application
2020/05/14 17:07:42.514605 [INFO] start build docker app
2020/05/14 17:07:42.514615 [INFO] fetch image name
2020/05/14 17:07:42.514639 [INFO] authenticate with ECR if the image is in an ECR repo
2020/05/14 17:07:42.514644 [INFO] pull docker image if update is not false in dockerrun.aws.json
2020/05/14 17:07:42.514657 [INFO] Running command /bin/sh -c docker pull node:12-alpine AS builder
2020/05/14 17:07:42.558923 [ERROR] "docker pull" requires exactly 1 argument.
So basically this is complaining about this in the dockerfile: FROM node:12-alpine AS builder. You can see the whole file in the repo: https://github.com/rhernandog/react-docker-awseb/blob/master/Dockerfile
The point is: Why this doesn't happen in my local machine? And how can I actually get the files from the build command and copy them to the nginx folder?
That is actually the only error I found in the log files.
I solved the issue here:
AWS Elastic Beanstalk Docker Does not support Multi-Stage Build
it is a stage-naming problem of multi-stage Dockerfile. Just use an Unamed one
I also got a similar error in my node app:
Incorrect application version "travis-e55e05342a8cc16f3f28f8e184735667a9531ffa-1588311901" (deployment 4). Expected version "Sample Application" (deployment 1)
What turned out to be an issue with my building and deployment scripts were corrected (debugged in Jenkins) the application successfully deploys in beanstalk with no error.
Turns out the issue was not with Beanstalk or app version but with the build mechanism. Something to look into when nothing else works :)
I had the same issue for java app in docker container.
I tried all the recommendations from this topic, links from this topic and nothing helped.
In the end, the following action helped:
Enable enhanced health panel https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-enable.html#health-enhanced-enable-console
Go to the extended panel of the desired environment
Select the instance that crashed due to this "version" issue and click reboot
Additionally:
In one of the cases, I had to delete all previous versions (section on the left panel) and push a new one and only after that make the above recommendations.
Also make sure you have sufficient rights to deploy (codepipeline/deployment)
AWS Docs say that
To solve this issue, start another deployment. You can redeploy a previous version that you know works, or configure your environment to ignore health checks during deployment and redeploy the new version to force the deployment to complete.
You can also identify and terminate the instances that are running the wrong application version. Elastic Beanstalk will launch instances with the correct version to replace any instances that you terminate. Use the EB CLI health command to identify instances that are running the wrong application version.
Can you try to delete the instances that runs your applications and start a fresh install?
Also, you can use CodePipeline to deploy your codes to Elastic Beanstalk, you can use your S3 folder for the source stage and skip the build process if your code is build on travis and deploy using the deploy stage to install your new app to your Elastic Beanstalk. There might be some misconfiguration while installing the new app to your environment.
I suggest you to terminate your instances and start new instances sorry if I got your question wrong.
I haven't used Docker on Elastic Beanstalk. When my Ruby on Elastic Beanstalk deployments fail, I find that I usually find the problem if I request the 100 last lines from the logs. If you navigate to "Logs" -> "Request Logs" -> "Last 100 Lines", that may help you.
If that fails, I SSH in to the instance and look in the logs in /var/log. Maybe docker ps and docker logs may help you.
While creating a new webserver environment on platform branch select "Docker running on 64bit Amazon Linux" it will work.

Update Parse-Server-Example

I thought it would be a topic to find easily on the web, but I couldnt find a solution..
I deployed the parse-server-example on AWS Elastic Beanstalk according to the original documentation and it works perfectly. Can anyone give me a hint how to update this server to the newest version? I try to use the parse-dashboard and I get the error "server version too low".
I cloned the parse server with eb cli already. But I do not know how / which files to update.
Thanks for any hint!
In package.json, you update the version next to 'parse-server'. I think by default this is '~2.0'?
Parse Dashboard requires Parse-Server to be '>=2.1.4', HOWEVER, currently I'm having issues when changing the parse-server version, it breaks my AWS server instance. Currently have an issue open on GitHub (https://github.com/ParsePlatform/parse-server-example/issues/109#issuecomment-198001722), so keep an eye on that.
But yeah, that's where you update your Parse-Server version, I believe!
Once you've done this locally on your machine, you obviously need to deploy the updates to AWS via the Beanstalk Dashboard, as this will install/update any node modules from package.json.

Where can I find the equivalent of detailed Heroku logs on AWS?

I have a ruby application that I used to deploy and run on Heroku, but recently switched to AWS by using Opsworks. The application is running just fine, but I had a question about detailed error logs.
On Heroku, I could just type heroku logs and get detailed logs that would help me troubleshoot errors I saw in my application. However, I can't quite find the equivalent in AWS. I've tried going into my ec2 instance and into /var/log/ to find the detailed logs I need. The closest thing I found was going into the /ngninx folder and viewing the [app_name].com.acess.log file. I get logs, but they are not nearly as detailed as what I saw on Heroku.
As a result, troubleshooting is really difficult so far on AWS. Does anyone know of a location to some detailed logs or a way to enable some if they do not exist by default?
Any insight would be really helpful : )
You can find the log on AWS OpsWorks by doing something like this :
sudo su deploy
cd /srv/www/[app_name]/shared/log/
There you can find the logs, for example probably a production.log or unicorn.stdout.log