简体   繁体   中英

Continuous deployment for Node.js… Is there a standard?

I need to learn how to automatically deploy nodejs applications (MEAN stack). However, with all the stuff out there...

  • Gulp,
  • Mocha,
  • Webpack,
  • Browserify,
  • Require,
  • Flightplan,
  • Jenkins,
  • SemaphoreCI...

I am really confused. What is the standard way to do this?

Automate System/Server Setup through Ansible

I think you should have a look at Ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy check out github repo

Ansible is a simple agentless tool which runs purely on ssh.

It consists of a collection of roles which can be included in the definition of a host. A role, in turn, is composed of tasks

A simple task looks like as follows:

//Download  and unpacking node js 
name: Download and unpack nodejs
unarchive: src={{nodejs_tarball_url}} dest={{nodejs_path}} copy=no

//Installing node-gyp on system 
name: Install node-gyp
npm: name=node-gyp global=yes executable={{nodejs_bin_path}}/npm state=present

// More task as per need for e.g setting up mongodb, setting redis etc. 

Checkout some examples to get rid of this.

Pre Deployment Tasks

For pre deployment task like test case running, bundling,minification etc, Integrate some kind of javascript task runners like Grunt

Continuous Integration and Continuous Deployment

  1. Circle Ci
  2. Jenkins

this is JS, mate, there is no standard way :)

To deploy NodeJS app, you don't really need much, for example, if you deploy to Heroku, its just get your commit from the branch you set up and then just run npm install and whatever you wrote in configuration.

With Angular its more complicated, you usually need to bundle it, compile LESS and do other tricks.

As an outcome I would suggest to use some MEAN generator like yeoman https://github.com/angular-fullstack/generator-angular-fullstack to understand how it might work and , probably, you can use something like that in your own project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM