将分支部署到localhost:port是什么意思?

时间:2015-04-13 12:08:55

标签: git deployment loopbackjs strongloop

我正在检查StrongLoop或LoopBack框架(不知道有什么区别,它们让它非常混乱)。我玩他们的slc deploy命令。 slc deploy -h说:

Deploy a node application to a StrongLoop process manager

Examples:

Deploy 'deploy' branch to localhost:
        slc deploy

Deploy 'deploy' branch to a remote host:
        slc deploy http://prod1.example.com

Deploy to a remote host, on a non-standard port, using authentication:
        slc deploy http://user:pass@prod1.example.com:8765

Deploy 'production' branch to localhost:
        slc deploy http://localhost production

我尝试部署到localhost。现在没有任何slc ctl ...命令可以工作。我在浏览器中看不到localhost站点,没有运行服务器。这是我做的:

C:\Users\user\sbox\strongloop\hi>slc deploy
Counting objects: 4295, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3925/3925), done.
Writing objects: 100% (4295/4295), 6.27 MiB | 4.12 MiB/s, done.
Total 4295 (delta 695), reused 0 (delta 0)
To http://127.0.0.1:8701/default
 * [new branch]      deploy -> deploy
Deployed `deploy` to `http://127.0.0.1:8701`

C:\Users\user\sbox\strongloop\hi>slc ctl status
Command status failed with Error: connect ECONNREFUSED

它说Deployed 'deploy' to 'http://127.0.0.1:8701'。这是什么意思?我尝试在浏览器中打开http://127.0.0.1:8701,但得到: enter image description here

现在没有任何slc ctl ...命令有效。输出为Command status failed with Error: connect ECONNREFUSED

我的问题是:

  1. “将分支部署到localhost”是什么意思?运行此命令后发生了什么?

  2. 为什么在将分支部署到localhost后得到Command status failed with Error: connect ECONNREFUSED

  3. 如何回滚所有东西?

1 个答案:

答案 0 :(得分:1)

当它显示Deployed 'deploy' to 'http://127.0.0.1:8701'时,表示您已将deploy分支部署到127.0.0.1:8701上运行的PM实例。请注意,这是PM的网址,而不是您的应用。

作为开发人员,您的应用监听的端口取决于您。通常编写您的应用程序以使用PORT环境变量来确定您的应用应该监听哪个端口。

要在pm下运行时为您的应用设置环境变量,您可以使用slc ctl env-set PORT=3000之类的内容。根据您的设置,您可能需要使用slc ctl -C http://127.0.0.1:8701 env-set PORT=3000-C URL也需要相同的slc ctl status选项。