nREPL

Want to be able to connect to your clojure Ring-based web-app as it’s running and read/edit its code in real time? No problemo.

Add the clojure.tools.nrepl dependency, and defonce the server somewhere in your handler with a port of your choice. Now you can just ssh into the web app’s box and use your repl of choice (I use Leiningen for simplicity) to play around with things. Really convenient for debugging, since with Clojure you almost never attach a traditional step-through debugger to running applications.

For bonus points you can use cemerick’s Drawbridge to enable logging into your app through the existing HTTP(S) routes. No need to expose additional ports and figure out how to secure that properly (since default nREPL is passwordless, as far as I can tell. That will only work until the first nmap). What’s neat is that you can in fact keep using the same auth mechanisms you already have in place, except this time for administrative REPL access.

nREPL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s