来自GitHub的DigitalOcean上简单的node.js应用程序部署 [英] Simple node.js app deployment on DigitalOcean from GitHub

查看:158
本文介绍了来自GitHub的DigitalOcean上简单的node.js应用程序部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Github上有一个node.js应用程序。现在我使用Heroku来托管它,但我想给DigitialOcean一个试试看($ 5 /月更实惠)。

我习惯于使用Heroku,其中



当我注册DO并开始探索它时,似乎方式太多和太多的步骤来部署我的应用程序。我研究过寻找一种更简单的方法(类似于我在Heroku中关注的方法),但所有博客和YouTube视频都经历了同样乏味的过程。



我知道我是懒惰,但我只需要点击几下应用程序部署。有人知道更好(更聪明)的方式,我可以在Github上部署我的应用程序吗?

与Heroku。使用像Digital Ocean或Vultr这样便宜的服务总是很诱人,并且只支付价格的一小部分(特别是使用可以在几个月内免费的优惠券链接 - Digital Ocean Vultr )但拥有自己的VPS意味着你需要自己管理它。简化这个过程就是您在使用Heroku时所付出的代价。但它并不一定是那么糟糕。



下面是一个很好的教程,介绍如何做到这一点:





看到这个教程列表 - 在标题中搜索那些带有部署的人:


$ b

基本上,您可以在这里考虑几个选项:


  1. 使用git进行半手动部署 - 您可以在您的VPS上安装git服务器,并在您想部署新版本时推送它。

  2. 使用git自动部署 - 您可以将部署过程添加到您的CI脚本中(1)中手动执行的操作,但是在所有测试通过后


  3. 您可以使用ssh或自定义API从服务器上的git中触发pull

  4. 您可以在CI脚本中执行(3)
  5. 您可以添加自定义webhook在GitHub中通知你的服务器有关新版本,然后你的服务器可以取出代码并重新启动。

  6. in(5)


I have a node.js application on my Github. Right now I am using Heroku for hosting it but I want to give DigitialOcean a try (the $5/month is more affordable).

I am used to using Heroku, where I just go create an app > connect it to my github account > deploy from the master branch > boom app deployed.

When I signed up for DO and started exploring it seemed way too much and too many steps to get my app deployed. I researched around to find a simpler way (similar to one I follow in Heroku) but all the blogs and YouTube videos go through the same tedious process.

I know I am being lazy but I just need a few clicks app deployment. Does anyone know a better (smarter) way I can deploy my app on DO from Github?

解决方案

It will not be as easy with Heroku. It is always tempting to use cheaper services like Digital Ocean or Vultr and pay only fraction of the price (especially using coupon links that can make it free for months - Digital Ocean, Vultr) but having your own VPS means that you need to manage it yourself. Simplifying that process is what you pay for when you're using Heroku. But it doesn't have to be that bad.

Here is a good tutorial on how to do it:

And see this list of tutorials - search for those with "deploy" in the title:

Basically you have few options that I would consider here:

  1. A semi-manual deploy with git - You can install a git server on your VPS and push to it whenever you want to deploy a new version

  2. Automatic deploy with git - You can add a deployment process to you CI scripts that will do what you do manually in (1) but after all tests pass

  3. You can trigger a pull from git on the server with ssh or a custom API

  4. You can do (3) in your CI scripts

  5. You can add a custom webhook in GitHub to notify your server about new version and your server may then pull the code and restart

  6. You can add a custom webhook in CI and do the same as in (5)

这篇关于来自GitHub的DigitalOcean上简单的node.js应用程序部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆