Fork me on GitHub
#cider
<
2018-09-25
>
Martin05:09:47

How does one control what alias cider run when using tools.deps?

Martin05:09:12

which has a bunch of dev dependencies

Martin05:09:50

when I jack-in, it runs clj without those deps

Martin05:09:15

how can I control how cider starts up?

kommen05:09:24

@martincharlesrichards I think you’re looking for cider-clojure-cli-global-options, some documentation about it here: https://cider.readthedocs.io/en/latest/up_and_running/#launch-an-nrepl-server-and-client-from-emacs

Martin07:09:45

thanks, so (setq cider-clojure-cli-global-options "-R:dev")

hawari07:09:20

Hello, does anybody has experience with running a nREPL server from a docker container? I was trying to connect to a nREPL server in my app within a docker container using cider-connect, but then it returns "Sync nREPL request timed out". I've exposed the nREPL port in the Dockerfile and binded the port to my host machine. Running the same server outside of docker and connect a cider client to it was successful, so I guess there's something with docker which I don't understand yet.

iarenaza08:09:56

@hawari.rahman17 We (Magnet Coop) do it all the time.

iarenaza08:09:05

We launch Leiningen to listen on 0.0.0.0:your-port-of-choice. If you launch it to listen on localhost or 127.0.0.1, then it isn't reachable from outside the docker container.

hawari08:09:06

Hi @iarenaza, I didn't run the repl via leiningen, but rather by embedding it in my application code like this: https://nrepl.readthedocs.io/en/latest/usage/#embedding-nrepl-starting-a-server Should I refrain from it and just run a nREPL server with leiningen? I asked because my final docker image tends to only have JVM inside it to run the uber jar I've built.

iarenaza08:09:18

We don't embed nREPL in our production apps, that's why we use leiningen (during development). In any case, it shouldn't matter if you embed it or launch it via leiningen. You should make sure your nREPL server is listening on a host + port combination that is reachable from outside the container. The thing is, if you don't specify a host address to listen on when starting the nREPL server, it uses localhost by default. And localhost is not reachable from outside the docker container (docker uses a separate network namespace for the host's loopback interface and the container's loopback interface, so they don't see each other).

hawari08:09:28

I see, I've tried to run the embed nREPL with :host "0.0.0.0" though it still doesn't work

iarenaza08:09:40

I have just checked the source code (couldn't find this info in their docs) and the keyword you need to use is :bind, instead of :host. See https://github.com/nrepl/nREPL/blob/master/src/clojure/nrepl/server.clj#L108-L109

bozhidar09:09:33

Yep, that’s true.

bozhidar09:09:15

I guess we should mention this in the docs.

hawari10:09:06

Oops, let me try that @iarenaza, I should've delved to the source code in the first place

hawari10:09:53

Ah, it works flawlessly now

hawari10:09:18

Thank you @iarenaza, for went out of your way digging in the source code

iarenaza11:09:11

@bozhidar I just created a pull request for this.

bozhidar12:09:39

@iarenaza Good man! I’ve added a few small remarks. Might also be a good idea to add a couple of code snippet alongside the extra explanations you’ve added.

bozhidar12:09:46

It seems to me that people often read only the code.

Macroz12:09:03

Cider doesn't support ClojureScript tests? What is the help wanted?

Macroz12:09:34

I regularly run the tests of the current ns (a binding that saves and fires up the tests)

bozhidar12:09:39

@macroz So you don’t use cider-test?

Macroz12:09:25

C-c-t-n says doesn't support ClojureScript to me

Macroz12:09:43

that was the closest issue I could find

Macroz12:09:12

I wonder if this is supposed to work and if so what do I have wrong

Macroz12:09:20

evaling (run-tests) works

bozhidar12:09:36

@macroz The point is that the middleware doesn’t support ClojureScript and you can’t get the nice CIDER test UI and all its features without it.

bozhidar12:09:21

If I recall correctly the middleware was written before cljs.test existed and never added support for it.

Macroz12:09:56

there is now clojure.test for clojurescript also?

bozhidar12:09:57

Likely the required changes should not be big.

Macroz12:09:06

I'm interested if there is something I could do

Macroz12:09:17

don't understand enough of the setup to know where to look

Macroz12:09:29

so to rephrase: test middleware was built before cljs, it may be possible to build it

bozhidar12:09:32

Note that you can’t evaluate any ClojureScript code in the middleware (currently), which is the real challenge with the ClojureScript support.

bozhidar12:09:31

The only thing we currently have access to is the ClojureScript compiler environment,.

bozhidar12:09:44

Yep, everything’s possible. It will just require some work.

Macroz12:09:17

thanks, looks like there is a lot to assimilate and do

bozhidar12:09:02

It’s not that much really, but I don’t have much time for OSS these days and we’re short on contributors in general.

Macroz12:09:34

finding some time to contribute is not a problem but grokking such a big piece of software takes time

rmuslimov17:09:15

One more thing I’m struggling right now, I updated cider and cider-nrepl to latest ‘0.18.0’ and renamed cider-refresh to cider-ns-refresh in my elisp.

(setq cider-ns-refresh-before-fn "reloaded.repl/stop"
      cider-ns-refresh-after-fn "reloaded.repl/go")
However, refresh fails with next exception initially and then doesn’t work
2018-09-25T17:09:18.330+0000 Bucephalus.local ERROR [clojure.tools.nrepl.server:286] - Unhandled REPL handler exception processing message {:op refresh, :print-length 50, :print-level 50, :pprint-fn clojure.pprint/pprint, :before reloaded.repl/stop, :after reloaded.repl/go, :session 86307587-a001-4181-bacf-c61e003920e4, :id 68}

rmuslimov17:09:35

Any suggestion what I’m doing wrong?

dominicm17:09:11

@rmuslimov I found a bug in cider-refresh the other day. How do you start cider?

dominicm17:09:21

And what kind of project is it?

rmuslimov17:09:08

That’s just clojure project (soap server), I’m starting cider by calling C-c M-j. I’m using reloaded.repl for system management

rmuslimov22:09:49

I have updated my ~/.lein/profiles.clj file from

{:repl {:plugins [[refactor-nrepl "0.2.4"]
                [cider/cider-nrepl "0.19.0-SNAPSHOT"]]}}
to
{:plugins [[refactor-nrepl "0.2.4"]
           [cider/cider-nrepl "0.19.0-SNAPSHOT"]]}
And code-reloading working in lein repl, however, all interactions with cider are dead now. If I start cider-jack-in connections stucks (never returns), if I do cider-connect and try to refresh I got user-error: 'cider-ns-refresh' requires the nREPL op "refresh". Please, install (or update) cider-nrepl 0.18.1-SNAPSHOT and restart CIDER but there is not that version 0.18.1-snapshot of cider-nrepl. Ah, cider is magic but maintaining projects with clojure and cider can be become time-expensive thing

rmuslimov23:09:48

And jack-in is stuck, because something dramatical happens inside of cider when I’m doing (inc 1) in repl

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: parse/deps-from-ns-decl, compiling:(cider/inlined_deps/toolsnamespace/v0v3v0_alpha4/clojure/tools/namespace/file.clj:64:26)
not sure what it means