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/
Related
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?
So I have a node js app I would like to deploy to EC2.
I'm planning on creating multiple instances of it and put it beyond Nginx for load balancing.
I know I can use AWS Beanstalk but I think it's over provisioning stuff I don't need.
My question is about the app update process. I thought of two options.
The first one is to create a bare git repository on the EC2 and every time I push some changes, it will hook into the after receive event, create new instances of the app and update Nginx to switch to the new instances.
Another option is to work with Amazon ECR and containers. Every time I update my app image at ECR, it will send an event to the EC2 machine (I'm not sure it is even possiable) to create new instances of the app and again, tell the Nginx to switch.
Which one do you think is preferred?
Here is the deployment method we used
1)Created git bare repo in ec2 server and its tracked with production branch.
2)in the post-receive hook
#!/bin/sh
git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
cd /var/www/domain.com && npm install && forever restart app.js
3)In the nginx configuration
{
proxy_pass:https://localhost:3000
}
Note:
You can customise post hook to check if its first deployment then run npm install otherwise run npm update.
I hope this will help to solve your issues
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
I've an existing NodeJS application developed and the builds are running on Jenkins . Can anyone help me know on how to deploy the application on remote server and how the packaging is done for node js.
I've a requirement for automated deployment for node js application . So want to know the tools and process to do deployment . how to move forward after jenkins build .
Jenkins and Udeploy is your key, We are currently using both to make a continuous delivery and deployment.
nice link for git and jenkins
another link
I am a node.js developer. I have used Heroku and Joyent's no.de platform before .
For both of these platforms , the deployment used to be simple
git push heroku master ( Heroku )
git push joyent master ( Joyent's node)
The above commands used to do the magic . They enabled me to push the code from my local machine to the cloud server, deploy it and automatically restart the server .
Now I am planning to use Amazon AWS as its more configurable to my needs. How do I setup a similar thing on Amazon EC2 for continuos deployment ?
I am using an Ubuntu AMI.
Is there any tool that help me achieve this ?
If there are any resources/tutorials that might help me - please let me know.
Thanks !
That auto-deploy mechanism is implemented with Git Hooks. The most likely hook used is post-update.
It's a simple bash script that is executed on a git push; put one in a git repository on your EC2 server including the code to re-run NPM (if needed) and restart your code.
That's should do it. :)
Use roco - deployment solution inspired by capistrano, working great with express/railwayjs + git + upstart. If you have another env feel free to customize it using Roco.coffee
It also can be simply configured with post-update hook to work exacty as in heroku and joyent.
Here is tiny tutorial for this tool: http://node-js.ru/4-deploy-with-roco
Check out AWS Elastic Beanstalk
It lets you deploy your application to an amazon ec2 instance by running:
git aws.push --environment testing
// or
git aws.push --environment production
The documentation page contains a lot of quality information to get your started!