Remote debugging on Heroku
For today's adventure, I'm going to try setting up remote debugging on a Heroku dyno. If anyone has gotten this to work (or determined that it will not work), I'd love to hear about it.
So here's what I've found so far.
I found instructions on SSH tunneling to my dyno at https://devcenter.heroku.com/articles.... Heroku does not permit a straight "ssh" command, but it does have a command to set up port forwarding from the local host to the dyno. (heroku ps:forward
). It does not look like that command also sets up the reverse tunnel :(
So I think the set of steps that I will need is:
- Set a value for kSecurityToken in my wingdbstub.py
- Add wingdbstub.py to my git repository, so that it gets pushed with the rest of my deployment
- Set up the appropriate DNS & Firewall rules so that the dyno can open a connection to my development host
Do I need to add some base level of Wing code (the "remote" stuff) into my git repo so that it gets installed on the dyno?
Comments
Remote debugging is hard without a reverse tunnel, but it is possible to establish the connection from the IDE using the Debug > Processes > Attach to Process dialog. You'd set up a forward tunnel and then connect to the local end of the tunnel.
Setting up a reverse connection without the SSH tunnel, particularly over the open internet, is _not_ something that we recommend. Wing relies on the SSH tunnel for encryption and authentication.
okay, so how would I do that? Is it
That should be pretty much it. You can see if the debugger is connected to the IDE using (not sys._wing_debugger.ChannelClosed()). The port to attach to is defined by kAttachPort in wingdbstub.py
hmm...I'm trying to make sure I can make this work locally before I add the remote complication.
urls.py
My mistake -- the attach protocol doesn't work like I thought. It still requires a way for the debugger to connect back to the IDE.. We'll see if we can change this in a future release, but for now it won't work with Heroku.