当我尝试将带有PM2的节点部署到Heroku时,连接超时

时间:2016-06-24 19:05:03

标签: node.js heroku npm pm2

我尝试关注this tutorial ..

我已使用ViewPager

在heroku中创建并添加了密钥
heroku keys:add

问题

当我执行命令ssh -vT git@heroku.com debug1: Next authentication method: publickey debug1: Offering RSA public key: C:/Users/rider/.ssh/heroku debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: Authentication succeeded (publickey). Authenticated to heroku.com ([50.19.85.156]:22). debug1: channel 0: new [client-session] debug1: Entering interactive session. shell request failed on channel 0 result ..

pm2 deploy ecosystem.json production setup

我的项目文件

Procfile

λ pm2 deploy ecosystem.json production setup
--> Deploying to production environment
--> on host serve-provaninja.herokuapp.com
ssh: connect to host <myhost>.herokuapp.com port 22: Connection timed out

  setup paths failed

Deploy failed

ecosystem.json

web: node main.js && pm2 logs all

main.js

{
  "apps" : [{
    "name"       : "Project name",
    "script"      : "index.js"
  }],

  "deploy" : {
      "production" : {
        "user" : "git",
        "host" : "<myhost>.herokuapp.com",
        "ref"  : "origin/master",
        "repo" : "git@github.com:<myproject>.git",
        "path" : "/var/www/production",
        "post-deploy" : "npm install --production && pm2 startOrRestart ecosystem.json —env production"
      }
    }
}

1 个答案:

答案 0 :(得分:0)

我使用启动脚本在heroku中启动了我的pm2进程,类似于您已经拥有的。

这是我遵循的教程: http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/

编辑:添加一些细节,我不相信有一种方法可以轻松地进入heroku dyno。因为dyno形成是一个动态生成的架构,并且没有静态机器或ip进入,ssh不能以你想要的方式开箱即用