0

我正在寻找一种通过命令行脚本轻松部署 nodejs 应用程序的方法。

我找到了一种解决方案: https ://github.com/Skookum/nimbus

我还听说整个事情都可以用 git 和 post commit hooks 来完成。

人们会推荐什么?

编辑:我将它部署到我自己的盒子里,我有根

4

2 回答 2

3

You have two options on a self hosted setup.

  1. Do it all yourself

    This entails git post-receive hooks. In short you setup your production box to host a copy of your repository, on your local machine you setup a remote, let's call the remote production.

    Now when you run git push production master on your local machine, the updates are sent and the server executes the post-receive hook on your server which runs whatever you wish.

    Actions you may want are: checking out/writing the data in the repo to files/folders (the git repo on the server is stored as a bare repo); restarting your webserver; notifying you that there's been a deployment etc.

    I'd suggest reading up on it at http://git-scm.com/book/en/Customizing-Git-Git-Hooks and taking a look at a few tutorials, this one (http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook/) looks prety legit.

  2. Use a service to manage it for you, http://www.deployhq.com/ is the only one that springs to mind but I'm sure there's other.

Good Luck and Happy Hacking :)

于 2012-12-18T23:42:48.750 回答
-2

有一个名为 shipit.js ( https://github.com/shipitjs/shipit ) 的工具允许您执行不同的部署任务,例如:

  • 将代码从 repo 移动到服务器
  • 重新启动服务器
  • 安装 node_modules
  • 等等

您创建一个配置文件,然后运行:npx shipit deploy并执行您指定的所有任务。如果发生故障,它具有回滚机制。

有一个很好的截屏视频:https ://youtu.be/8PpBySjkWEM 。

于 2019-03-18T20:53:04.083 回答