Remote debug server

The developer guide recommends using a headless server when installing the development environment for rocket chat. But no reason is given for WHY.

This means remote debugging is required to put break points into the server code. I’m using vscode, so I’ve tried setting up a NFS shared folder and running

meteor npm run debug

on the host machine, but how is the debugger attached to the remote process? Must a separate empty project be created on the client with a launch configuration that targets the host IP address? There’s no documentation on this. Has anyone tried it?

I have made some progress on this now, so I’m going to outline the steps for my own future reference and for any other poor soul that attempts to remote debug rocket chat. Both my client and host machines are running Ubuntu 18.04. I cloned the rocket chat source from git into /home/remote_user/workspace/rocketchat.

i) start the rocket chat application on the remote server in debug mode
meteor npm run debug

ii) forward port 9229 on the client machine to the remote host via ssh
(by default node.js binds to port 9229 for debugging)
ssh -L 9229: remote_user@remote_server_ip

iii) mount an NFS folder share between the client and host machines
sudo mount remote_server_ip:/home/remote_user/workspace /nfs/workspace

iv) start vscode on the client and open folder /nfs/workspace/rocketchat

v) open file launch.json in vscode and add localRoot, remoteRoot to the configuration (attach to meteor debug)
“name”: “Attach to meteor debug”,
“type”: “node”,
“request”: “attach”,
“port”: 9229,
“address”: “localhost”,
“restart”: false,
“sourceMaps”: true,
“sourceMapPathOverrides”: {
“meteor://:computer:app/": "{workspaceFolder}/*", "meteor://💻app/packages/rocketchat:*": "{workspaceFolder}/packages/rocketchat-”,
“meteor://:computer:app/packages/chatpal:": "{workspaceFolder}/packages/chatpal-*", "meteor://💻app/packages/assistify:*": "{workspaceFolder}/packages/assistify-
“localRoot”: “${workspaceFolder}”,
“remoteRoot”: “/nfs/workspace/rocketchat”,
“protocol”: “inspector”

vi) start the vscode node.js debugger