1

So I guess pm2 and SSH aren't configured correctly to work with each other on my machine. I'm perfectly able to SSH into my remote server manually using ssh user@hostname.

The server is a DigitalOcean server running Ubuntu 16.04 if that makes a difference(I'm very much still a beginner so I'm not sure what information is important for this question).

The command and error:

jon@jon-AllSeries:~/Workspace/forumerly$ sudo pm2 deploy production setup
--> Deploying to production environment

--> on host 162.243.197.96
  ○ hook pre-setup
Permission denied (publickey).
 
  setup paths failed
 
Deploy failed

My ecosystem.config.js file:

module.exports = {
  /**
   * Application configuration section
   * http://pm2.keymetrics.io/docs/usage/application-declaration/
   */
  apps : [

    // First application
    {
      name      : 'forumerly',
      script    : 'app.js',
      env_production : {
        NODE_ENV: 'production'
      }
    },

  ],

  /**
   * Deployment section
   * http://pm2.keymetrics.io/docs/usage/deployment/
   */
  deploy : {
    production : {
      user : 'deploy',
      host : '162.243.197.96',
      ref  : 'origin/master',
      repo : 'https://github.com/jonlove/forumerly.git',
      path : '~/forumerly',
      'post-deploy' : 'nvm install && npm install && pm2 reload ecosystem.config.js --env production'
    },
  }
};

I can't figure out how to fix this or even what to try. SSH works flawlessly, but pm2 is getting permission denied.

Jon Love
  • 13
  • 1
  • 6

1 Answers1

1

According to TFM, you need to add a key entry.

EEAA
  • 109,363
  • 18
  • 175
  • 245