# Remote debug server

**URL:** <https://forums.rocket.chat/t/remote-debug-server/7011>\
**Category:** Development\
**Created:** [May 19, 2020, 11:47pm UTC](https://forums.rocket.chat/t/remote-debug-server/7011 "2020-05-19T23:47:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddy](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@toddy](https://forums.rocket.chat/u/toddy)\
**Post date:** [May 19, 2020, 11:47pm UTC](https://forums.rocket.chat/t/remote-debug-server/7011/1 "2020-05-19T23:47:57Z")

</div>

The developer guide [https://docs.rocket.chat/developer-guides/quick-start/](https://docs.rocket.chat/developer-guides/quick-start/) 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?

---

<div class="post-metadata">

**Author:** ![toddy](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@toddy](https://forums.rocket.chat/u/toddy)\
**Post date:** [May 21, 2020, 2:29am UTC](https://forums.rocket.chat/t/remote-debug-server/7011/2 "2020-05-21T02:29:22Z")

</div>

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:127.0.0.1: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://💻app/_": "{workspaceFolder}/\*", "meteor://💻app/packages/rocketchat:\*": "{workspaceFolder}/packages/rocketchat-_”,  
“meteor://💻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
