简体   繁体   English

持续部署Node.js…是否有标准?

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

I need to learn how to automatically deploy nodejs applications (MEAN stack). 我需要学习如何自动部署nodejs应用程序(MEAN堆栈)。 However, with all the stuff out there... 但是,所有的东西都在那里...

  • Gulp, 喝一杯
  • Mocha, 摩卡咖啡
  • Webpack, Webpack,
  • Browserify, Browserify,
  • Require, 要求,
  • Flightplan, 飞行计划,
  • Jenkins, 詹金斯
  • SemaphoreCI... 信号量...

I am really confused. 我真的很困惑。 What is the standard way to do this? 这样做的标准方法是什么?

Automate System/Server Setup through Ansible 通过Ansible自动化系统/服务器设置

I think you should have a look at Ansible 我认为您应该看看Ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy check out github repo Ansible是一个非常简单的IT自动化平台,可让您的应用程序和系统更易于部署,请查看github repo

Ansible is a simple agentless tool which runs purely on ssh. Ansible是一个简单的无代理工具,仅在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 对于预部署任务,例如测试用例的运行,捆绑,缩小等,请集成某种Javascript任务运行程序,例如Grunt

Continuous Integration and Continuous Deployment 持续集成和持续部署

  1. Circle Ci 圆词
  2. Jenkins 詹金斯

this is JS, mate, there is no standard way :) 这是JS,队友,没有标准方法:)

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. 部署NodeJS应用程序实际上并不需要太多,例如,如果部署到Heroku,它只需从您设置的分支中获取提交,然后运行npm install以及您在配置中编写的内容即可。

With Angular its more complicated, you usually need to bundle it, compile LESS and do other tricks. 随着Angular变得更加复杂,您通常需要将其捆绑,编译LESS并执行其他技巧。

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. 结果,我建议使用一些yeoman这样的MEAN生成器https://github.com/angular-fullstack/generator-angular-fullstack来了解它可能如何工作,并且也许可以在自己的项目中使用类似的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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