How can I connect to a REPL session running on a remote server that I can access, for example via SSH?
This might be obvious to network specialists but took me a while to find out so documenting it here.
On the remote server, when launching your REPL application instead of just lein repl
force binding to a port:
lein repl :start :port 40000
On your machine, connect to the remote server the normal way (for example via ssh). Then connect to your application this way:
lein repl :connect localhost:40000
That's it!
I just want to sum up the two answers above. It works on my machine:
On the remote machine
lein repl :start :port 40000
On the local machine
# SSH tunnel on one shell
ssh -NL 40000:localhost:40000 username@host
# Connect to the remote repl on another shell
lein repl :connect localhost:40000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With