code-server icon indicating copy to clipboard operation
code-server copied to clipboard

How to use the binary with PM2

Open RayPS opened this issue 7 years ago • 6 comments

I want to run code-server as a system service so I was using PM2 to keep the process stay alive. pm2 start code-server seems not working

RayPS avatar May 07 '19 20:05 RayPS

pm2 start ./code-server

coadler avatar May 07 '19 21:05 coadler

I actually want to use with the ecosystem config file, here is my config but it doesn't work

module.exports = {
  /**
   * Application configuration section
   * http://pm2.keymetrics.io/docs/usage/application-declaration/
   */
  apps: [
    {
      name: 'code-server',
      script: 'code-server',
      env: {
        PASSWORD: 'mypassword',
        PORT: 8443,
      },
      args: [
        '--allow-http',
        '--port=8443',
        '--cert=path/to/cert.pem',
        '--cert-key=path/to/privkey.pem',
      ],
      interpreter: 'bash',
      exec_interpreter: 'none',
      exec_mode: 'fork_mode',
    },
  ],
}



RayPS avatar May 08 '19 00:05 RayPS

just change the script entry to point to the binary

e.g.

...
script: "./path/to/code-server",
...

coadler avatar May 08 '19 18:05 coadler

Hey I was experiencing an issue with PM2 as well, created an issue about it here #690 along with a work around for it. Hopefully this helps

xdarkzlightz avatar May 18 '19 05:05 xdarkzlightz

@xdarkzlightz Currently using exactly the same workaround, I'll leave this issue open until it don't need a workaround.

RayPS avatar May 18 '19 05:05 RayPS

Track it on GH-690 now. Closing this.

sr229 avatar Nov 07 '19 15:11 sr229