Amazon AWS Elastic Beanstalk NodeJS app - node.js

I have created a NodeJS app in Amazon AWS Elastic Beanstalk. Everytime I deploy the app I get following error (in logs):
2016-09-06T15:56:48.332Z] INFO [17369] : Command processor returning results:
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"/bin/sh: npm: command not found. \ncontainer_command 01-install-dependencies in .ebextensions/install.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":127,"events":[]}]}
Any idea what must be causing it?

When deploying a NodeJS application to elastic beanstalk npm install is run automatically for you. You haven't posted the contents of your 01-install-dependencies but guessing from the name and the error message that script runs npm install.
I did some investigation a while back into which npm scripts are automatically run by elastic beanstalk - npm scripts on elastic beanstalk

Related

How to hide `/var/app/current` source code in elastic beanstalk?

I am trying to deploy a basic react application in elastic beanstalk and when I inspect the browser I can see the source code:
The content of the react app is the default one from create-react-app with default package.json scripts.
The platform on elastic beanstalk is that one Node.js 16 running on 64bit Amazon Linux 2/5.6.3.
Despite I tried to add GENERATE_SOURCEMAP=false in npm build script, and try to configure nginx using proxy.conf, I'm unable to hide the var/app/current folder that is being deployed and has the source code of my react application.
Does someone know how avoid source code to be exposed on elastic beanstalk when deploying it in Node.js platform?

How to run Strapi v4 on AWS ElasticBeanstalk

I'm trying to run Strapi (v.4.4.3) on AWS ElasticBeanstalk with a Node.js v16 runtime environment. The build is performed by using AWS CodePipeline.
The build is completed successfully however the deployment to AWS ElasticBeanstalk (EB) times out with no particular error in the logs. I've checked all available AWS EB logs.
Locally the code can be built and is running fine.
Is there anyone facing the same issue or did find a solution to this behaviour?

Running pm2 on Elastic Beanstalk in cluster mode

I've been trying to run pm2 on AWS Elastic Beanstalk's node web service environment but without luck. I start up the express api via: ./node_modules/.bin/pm2 start server.js -i 0 but the server never comes out of a Degraded state. I can run this same command locally just fine. I have ssh'd into the aws instance and looked in the logs, but I don't see any errors. It would be a big help if I could chat with someone that has successfully run pm2 on eb via cluster mode.
Thanks!
I have successfully deploy pm2 on aws elastic beanstalk, it has more than one way to achieve.
You may either add an installation command to the .elasticbeanstalk/config.yml file for pm2 global installation or simply install pm2 into your app and follow the instruction of the link below (recommended way).
https://gist.github.com/Unitech/4c8ea564aa8bf0a389c5
As for the first method, in your config.yml file, simply add the following line(the link above doesn't require this) :
container_commands:
0_install_pm2:
command: "npm install pm2 -g"
You need to manually handcode the start command for your app with this method.

Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version

I have today a strange issue for Amazon Elastick BeanStalk: for my instances I cannot upload application:
XXX#-Vostro-2520:~/git_projects/ProjectBlog (test-env)$ git aws.push --environment Project-Blog-test
Updating the AWS Elastic Beanstalk environment Project-Blog-test...
Error: Failed to create the AWS Elastic Beanstalk application version
I did test it for 2 instances: PHP and RoR apps.
I solved this on my own:)
Amazon EB allows only for 500 Application Versions. So I logged in to console -> Elastick BeanStalk -> Action -> View Application Versions
On these page I selected and deleted some of olded files uploaded to Amazon EB. After it I was able to upload new versions with EB scripts.
Heads up that the error may also appear if you have invalid characters in the commit description. Not sure what these are to AWS, but I got the same error with the characters "http://".

Deploy yeoman node.js application to Elastic Beanstalk

I have a NodeJS application that I developed using a Yeoman generator that I'm attempting to deploy to an Elastic Beanstalk instance. I'm fairly new to this stack so my apologies if the question seems scattered. I was able to deploy my application using this process: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html. However, when I hit my homepage I just have a blank Node application. I'm guessing this is because the deploy comes straight from my Git repository and my Grunt build process hasn't been run. Is there any way to tell Elastic Beanstalk to run Grunt build after receiving the deployable?
You'll need to setup Grunt to run with a deployment hook on AWS. This is done with container commands.
Checkout this answer: How to automatically restart delayed_job when deploying a rails project on Amazon Elastic Beanstalk?
And this relevant blog post: http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/

Resources