如何远程更新实时 Node.js Heroku 应用程序?

How do I update a live Node.js Heroku App remotely?

我有一个在 Heroku 上运行的 Node.js 应用程序

我上传到 Heroku 的 Node.js folders/files 也驻留在我的电脑上

每当我在我的计算机上更新 Node.js folders/files 时,我希望这些更新也应用到 Heroku 上的 folders/files。

我希望能够做到这一点,而不必每次都停止、更新和重新启动我的 Heroku 应用程序。

我所描述的基本上是一个等同于标准 ftp 连接的设置,每当我们对某些标准网站的静态文件进行 local to remote 更新时,我们都会使用该连接。

显然 Heroku 提供的 git 支持不会那样做。它需要停止应用程序(通过 运行 终端上的适当命令),然后我需要进行 git 推送(使用终端)更新 all 的文件(这需要永远),而不仅仅是需要更新的文件,然后需要重新启动应用程序(再次使用终端)。对于仍在开发中的应用程序来说,这非常令人沮丧,需要不断更新并且无法在本地进行测试(出于多种原因)。

只要在本地测试 Node.js 应用程序,就可以通过调用 supervisor app.js 而不是 node app.js 来启动该应用程序。

它的作用是允许应用程序更新,并且一旦发生这种情况(即,一旦我点击 "save")supervisor 会自动在本地重新启动应用程序。

我正在寻找与上述类似的东西,即将我的本地应用程序文件夹链接到我的远程应用程序文件夹并使用某种 supervisor 模式启动我的远程应用程序(在 Heroku 上),以便我本地文件夹已更新,我的远程文件夹也已更改,应用程序自动重启。

当前尝试测试 Heroku 应用程序(显然需要不断更新)是非常令人沮丧的。

在本地测试然后在 Heroku 上发布(永远)是行不通的,因为有些应用根本无法在 localhost.

上测试

如有任何帮助,我们将不胜感激!

The git support that apparently Heroku offers doesn't do that. It requires for the app to be stopped (by running the appropriate commands on the terminal), then I need to make a git push (using the terminal) that updates all of the files (which takes forever) and not just the ones that need to be updated, and then the app needs to be restarted (again using the terminal). This is extremely frustrating for an app that is still in development, requires constant updates and cannot be tested locally (for a number of reasons).

首先,您无需在 运行 git push heroku master 之前停止您的应用。只需推送,平台就会构建,然后使用新代码自动重启您的应用程序。其次,git 使用差异算法,因此您不会推送所有文件 - 实际上您只是推送差异(假设您正确使用 git)。第三,您不需要进行最后的手动重启——平台已经在推送时为您完成了。最后,我建议如果您的应用无法在本地进行测试,您可能需要重新考虑该应用的架构。听起来很不便携。或许可以参考 12factor.net 以获得良好的架构清单。

Testing it locally and then publishing it on Heroku (for good) will not do because some apps simply cannot be tested on localhost.

您正在构建哪种类型的应用程序无法在生产环境之外进行测试?

无论如何,我所知道的最接近您正在寻找的东西是 Dropbox Sync: