NodeJs deployment on remote server - node.js

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

Related

How to deploy my Node server to ec2 using Jenkins?

I have probably been Googling this the wrong way...
I have a Node express server.
I want to deploy it using Jenkins to ec2.
What are my options?
if I want to upload the code manually, I use ssh... but I want it to
be done from Jenkins.
Yes the server is on a git repo.
I would like a devops flow
I recommend you , to do it step by step :
Step 1 : Configure correctly a jenkins job ready to build your app in remote ec2 machine.
Install this plugin in your jenkins platform : Publish Over SSH Plugin
Using this plugin add new remote server under Publish over SSH section in Manage Jenkins >> Configure System option.
Now create some jenkins job. Then, in build section add a step called : Send files or execute commands over SSH
Just select your configured server and enter your commands in Exec command section :
For a simple node js express, this code could be enough or just copy-paste your existing code:
https://gist.github.com/jrichardsz/38b335f6a5dc8c67a386fd5fb3c6200e
That is all. Just test with "build" option and verify if your application goes well.
At this point, this job is functional. The flow could be :
push your changes to your git provider
login to jenkins and manually execute the created job (this step is replaced with webhook configuration)
Note: If and only if this step has no errors, you can start with the following step.
Step 2 : Implement a simple devops flow by configuring a webhook in your git provider, which automatically triggers the jenkins job (create in step 1) when you perform a git push.
This guide could be help you with the required configurations :
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
You'll have to use AWS CodeDeploy jenkins plugin. This apply to any type of code. Node, java etc
See AWS article
Setting Up the Jenkins Plugin for AWS CodeDeploy
Jenkins Plugin
Github Link

How can I deploy my nodejs app into openshift without using github?

I have built a nodejs app and now I want to deploy it into openshift.
I don't want to use github because I should create private repository which I cannot.
Also I cannot use 'rhc' since I am new user.
Is there any way to do that?
I cannot find any tutorial about that.
For OpenShift 3, you can use a binary input source build.
First create a binary input build.
oc new-build --name myapp --strategy=source --binary --image-stream=nodejs:latest
Now start a new build and upload source code from the current directory.
oc start-build myapp --from-dir=.
Once the build has completed, deploy the image created by the build.
oc new-app myapp
You can then expose the service.
oc expose svc/myapp
Every time you want to make a change, you will need to run the same oc start-build command in the directory where your source code is.
Is there any other code repo you are using? SVN? If SVN, you can use pipelines with Jenkins.
If not, put the nodejs app in a docker container and push it to the docker hub.
I don't see anybody to suggest this so I will do - you can equally well deploy code from gitlab, pagure, bigbucket, or any other git hosting service.
In fact you can even run your own git server inside OpenShift.
oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/gitserver/gitserver-persistent.yaml
oc env dc/git -p ALLOW_ANON_GIT_PULL=false
oc policy add-role-to-user edit -z git
oc get route # to see your git server URL
Now you should be able to push/pull from that server using your OpenShift username and token (also any other users you add to the project). From buildconfigs and other pods you can also use simply git as the hostname of your git server, because this should resolve to the IP of the service with the same name (again only within the same OpenShift project).
Read the template YAML (the URL after oc create) for more options you can use like REQUIRE_GIT_AUTH.
Of course it is good to keep a git mirror/backup somewhere else as with any other git service.
HTH
P.S. Forgot to say, you need to install an OpenShift v3 cluster by yourself or subscribe to OpenShift Online (which unfortunately may take awhile ATM).

Deploy ember application in Bluemix

I am trying to deploy an existing ember-nodejs application into bluemix environment. I tried the following steps.
bluemix api https://api.ng.bluemix.net
bluemix login -u username -o org_name -s space_name
cf push app_name
I also tried the above command with an ember build pack from the list of
compatible CF build packs
cf push app_name -b https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks
Uploading is successful, but the application doesnt start up. Is there a recommended way of deploying ember-node js application?
Update
It was a memory issue. I removed the other running apps and tried the cf push command again. The node modules got installed and the application also started without any fuss.
According to the user, this was actually a memory issue. Once he stopped the other running apps, his node modules were installed and the application started without any further errors. There are no issues specific to deploying ember-nodejs applications in the Bluemix environment.

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/

How do I enable continuous deployment of Node.js applications to Amazon EC2?

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!

Resources