This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-02
Channels
- # admin-announcements (3)
- # architecture (5)
- # beginners (10)
- # boot (223)
- # cider (13)
- # cljsjs (2)
- # cljsrn (50)
- # clojure (208)
- # clojure-austin (16)
- # clojure-belgium (1)
- # clojure-india (1)
- # clojure-poland (13)
- # clojure-russia (130)
- # clojure-spec (27)
- # clojure-uk (144)
- # clojurescript (135)
- # css (2)
- # cursive (10)
- # datavis (1)
- # datomic (29)
- # dirac (9)
- # funcool (2)
- # hoplon (41)
- # jobs (3)
- # leiningen (6)
- # om (37)
- # onyx (20)
- # pedestal (1)
- # planck (1)
- # proton (4)
- # re-frame (45)
- # reagent (17)
- # rethinkdb (16)
- # ring-swagger (19)
- # schema (5)
- # specter (93)
- # sql (16)
- # test-check (33)
- # untangled (7)
I am attempting to run boot in Docker. I can create my image, and then run my development
task. I -p to expose the port that nREPL is running on. However, when I try to connect using cider-connect
to my docker container, I get a
[nREPL] Connection closed unexpectedly (connection broken by remote peer)
progn: Sync nREPL request timed out (op clone id 1)
Does anyone have success connecting to NREPL running in a Docker container from emacs?
@samedhi: did you try something like nc
or telnet
to see if the port mapping is correct?
@micha: no, I did not. Note sure how to proceed there. Working down that line though, I am noticing that I get the same message regardless of whether or not I have the repl running. However, if I actually close the container, I get the usual
[nREPL] Establishing direct connection to localhost:6800 ...
: [nREPL] Direct connection failed
are you using lein-ring
?
if so what version?
Which probably indicates that somehow docker has opened the port, but the result I am getting does not necessary have anything to do with the repl.
@timothypratley: Nope, using boot.
oh right
@micha: does this seem reasonable?
Stephens-MacBook-Pro:~ stephen$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3dd83b017b67 firengine:0.1 "/docker-entrypoint.b" 3 minutes ago Up 3 minutes 0.0.0.0:6800->6800/tcp, 0.0.0.0:7800->7800/tcp, 0.0.0.0:8080->8080/tcp, 8000/tcp cranky_turing
Stephens-MacBook-Pro:~ stephen$ docker exec -it cranky_turing /bin/bash
root@3dd83b017b67:/app# telnet localhost 6800
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]’
Stephens-MacBook-Pro:~ stephen$ telnet localhost 6800
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
Ah, I was reporting the .nrepl-port in the docker container again. Sorry. There is also a matching file in my local filesystem left over from when I have run on my local machine, I suppose it will use that one.
So, running from my Mac.
Stephens-MacBook-Pro:~ stephen$ boot repl -c
lojure.lang.ExceptionInfo: Assert failed: host and/or port not specified for REPL client
(and h p)
data: {:file
"/var/folders/f8/brrq5_n902jdb7m3bb8vsvsh0000gn/T/boot.user3392206988170510241.clj",
:line 17}
java.lang.AssertionError: Assert failed: host and/or port not specified for REPL client
(and h p)
boot.repl-client/client repl_client.clj: 10
...
clojure.core/apply/invokeStatic core.clj: 646
clojure.core/apply core.clj: 641
boot.pod/eval-fn-call pod.clj: 328
boot.pod/call-in* pod.clj: 379
...
boot.pod/call-in* pod.clj: 382
boot.task.built-in/fn/fn/fn built_in.clj: 393
...
clojure.core/deref/invokeStatic core.clj: 2228
clojure.core/deref core.clj: 2214
boot.task.built-in/fn/fn/fn/fn built_in.clj: 397
boot.task.built-in/fn/fn/fn/fn built_in.clj: 394
boot.core/run-tasks core.clj: 938
boot.core/boot/fn core.clj: 948
clojure.core/binding-conveyor-fn/fn core.clj: 1938
...
Stephens-MacBook-Pro:~ stephen$
Running from within the container.
root@3dd83b017b67:/app# boot repl -c
ConnectException Connection refused
java.net.PlainSocketImpl.socketConnect (PlainSocketImpl.java:-2)
java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:350)
java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:204)
java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:188)
java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392)
java.net.Socket.connect (Socket.java:589)
java.net.Socket.connect (Socket.java:538)
java.net.Socket.<init> (Socket.java:434)
java.net.Socket.<init> (Socket.java:211)
clojure.tools.nrepl/connect (nrepl.clj:184)
clojure.core/apply (core.clj:646)
clojure.core/apply (core.clj:641)
Bye for now!
Stephens-MacBook-Pro:firengine stephen$ docker build -t firengine:0.1 .; docker run -it --rm -p 8080:8080 -p 7800:7800 -p 6800:6800 -e FIRENGINE_URL=$FIRENGINE_URL -v /Users/stephen/firengine:/app -v /Users/stephen/.m2:/root/.m2 firengine:0.1 /bin/bash
Sending build context to Docker daemon 18.35 MB
Step 1 : FROM
---> f0882ff41177
Step 2 : EXPOSE 6800
---> Using cache
---> 953c3d126660
Step 3 : EXPOSE 7800
---> Using cache
---> 66683f71eead
Step 4 : EXPOSE 8000
---> Using cache
---> 4a4f72233f1f
Step 5 : EXPOSE 8080
---> Using cache
---> a756c09a3cf5
Step 6 : RUN apt-get update
---> Using cache
---> 368ac22c49ea
Step 7 : RUN apt-get install curl -y
---> Using cache
---> 21a2123c727b
Step 8 : RUN cd /usr/local/bin && curl -fsSLo boot && chmod 755 boot
---> Using cache
---> 1485779636f3
Step 9 : WORKDIR /app
---> Using cache
---> 5360a2ad0943
Step 10 : ADD app.yaml app.yaml
---> Using cache
---> d895e454e121
Step 11 : ADD boot.properties boot.properties
---> Using cache
---> b50a44188ccf
Step 12 : ADD build.boot build.boot
---> Using cache
---> 6487476d0976
Step 13 : ADD html html
---> Using cache
---> 1bc2016e691d
Step 14 : ADD service_account.json service_account.json
---> Using cache
---> a3f3ebf7773c
Step 15 : ADD src src
---> Using cache
---> 36985ae79c30
Step 16 : ENV BOOT_AS_ROOT yes
---> Using cache
---> 20359ce4a54c
Step 17 : RUN boot deps
---> Using cache
---> a59c1a3123ac
Step 18 : CMD boot production
---> Using cache
---> 718a690aabd0
Successfully built 718a690aabd0
root@3ea72558eb2b:/app# boot development
Starting reload server on
Writing adzerk/boot_reload/init982.cljs to connect to ...
Writing boot_cljs_repl.cljs...
Compiling 1/1 firengine.datastore...
Started HTTP Kit on
Starting file watcher (CTRL-C to quit)...
Adding :require adzerk.boot-reload.init982 to main.cljs.edn...
nREPL server started on port 6800 on host 127.0.0.1 -
Adding :require adzerk.boot-cljs-repl to main.cljs.edn...
Compiling ClojureScript...
? js/main.js
Writing target dir(s)...
Elapsed time: 13.318 sec
Stephens-MacBook-Pro:firengine stephen$ boot repl -c
SocketException The transport's socket appears to have lost its connection to the nREPL server
clojure.tools.nrepl.transport/bencode/fn--1615/fn--1616 (transport.clj:95)
clojure.tools.nrepl.transport/bencode/fn--1615 (transport.clj:95)
clojure.tools.nrepl.transport/fn-transport/fn--1587 (transport.clj:42)
clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
java.lang.Thread.run (Thread.java:745)
Bye for now!
… Yeah, it seems like things might be “seeing” each other ok, don’t really have any clear ideas on how to proceed beyond this.
@micha: I appreciate your help though. Getting late, but maybe I will try to figure out how I can start boot nrepl on 0.0.0.0 instead of 127.0.0.1, I have had odd issues where that seems to fix things with Docker in the past.
I have tried to create a minimal reproducing case here. https://github.com/samedhi/boot-nrepl-docker
if nrepl is listening on 127.0.0.1 that would definitely cause a problem with exposing the service
you can get around that by connecting to docker's interface address from the host, but binding to 0.0.0.0 seems easier
I just did the same thing, a boot repl running within docker, using the following Dockerfile. Built with docker build -t torgeir-boot-repl .
, ran with docker run --name torgeir-boot-repl -d -p 9000:9000 torgeir-boot-repl -i
, connected from emacs with cider, works like charm.
FROM adzerk/boot-clj:latest
ENV BOOT_VERSION=2.6.0
ENV BOOT_CLOJURE_VERSION=1.8.0
RUN boot repl
ENTRYPOINT ["/usr/bin/boot", "repl", "--bind", "0.0.0.0", "--port", “9000"]
the repl task's -e option only accepts one form, correct? if I want to do multiple, I'd have to wrap in do
?
Example: boot -d com.rpl/specter repl -e "(do (use 'com.rpl.specter) (use 'com.rpl.specter.macros))"
I’m trying to config clojure.tools.logging
with Boot, but I don’t think Boot is picking my log4j.properties
?
is there any way I can check if the file is being correctly added to the classpath?
(require [
hrm. so it’s there
I can’t see any logs though 😞
hah! datomic bundles the no-op logger 🙂
Hi, if I have a dependencies with native library and I want to aot compile my program. where should I load the native library(I mean clojure.lang.RT/loadLibrary)? The aot
compile always throws exception for this library has already loaded. I
this may be relevant: https://github.com/boot-clj/boot/issues/484
it's not really something that's related to boot, it's just how the JVM handles native library loading
(ns app.main-shim
(:gen-class))
(defn -main [& args]
(require 'app.main)
(apply (resolve 'app.main/-main) args))
I also found an issue with discussing java.library.path
that is different from the one in lein.
@doglooksgood: yes although we need to understand the situation better
@micha & @torgeir: Thanks for your help last night. I used :bind to set my docker host ip address to “0.0.0.0” Seems to work now. I should say that I receive a warning about nrepl incompatibilities when I cider-connect
to my docker boot repl
instance that I do not get when I connect to the same boot repl
instance natively. I don’t see any side effect of this though, and I think it may be false as I am seeing CIDER and nREPL both have version numbers attached to them.
Connected to nREPL server -
;; CIDER 0.12.0 (Seattle), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_72-internal
<elided for brevity>
;; `cider-repl-display-help-banner' to nil.
;; ======================================================================
WARNING: CIDER's version (0.12.0) does not match cider-nrepl's version (nil). Things will break!
Also, here is a project that demonstrates this warning difference. https://github.com/samedhi/boot-nrepl-docker
@samedhi: Sounds like the REPL instance running in Docker isn’t loading the CIDER middleware?
@micha With app.main-shim
, should app.main
be compiled into a .class
file in the uberjar?
When I execute jar with java -jar project.jar
I meat
Exception in thread "main" java.io.FileNotFoundException: Could not locate opencv_clj/main__init.class or opencv_clj/main.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
How can I include this clj file? I only found the class of shim
in jar.understand, the file in resource-paths will be copied and file in source-paths will be compiled
getting a weird behavior on windows; (System/getProperty "fake.class.path") contains a lot of paths that start with /
everytime I try to cider-jack-in to my boot project I get lein.bat being used instead of boot.exe
@typedeph: (setq cider-preferred-build-tool “boot")
@oahner: this is the code that's building that https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L168
@typedeph: ah I forgot to say you need to be on CIDER 0.13
hrm weird
; boot.build
(set-env!
:source-paths #{"src"}
:dependencies '[[org.clojure/data.json "0.2.6"]])
FileNotFoundException Could not locate boot/search.clj__init.class or boot/search.clj.clj on classpath. clojure.lang.RT.load (RT.java:456)
file is
(ns search
(:require [clojure.data.json :as json]))
(defn bfs
[]
nil)
(defn dfs
[]
nil)
unfortunately we get this: IllegalArgumentException Cannot open <nil> as a Reader.
(defn load
"Loads Clojure code from resources in classpath. A path is interpreted as
classpath-relative if it begins with a slash or relative to the root
directory for the current namespace otherwise."
same as above with slight token changes: FileNotFoundException Could not locate search__init.class or search.clj on classpath. clojure.lang.RT.load (RT.java:456)
progress I think? CompilerException java.io.FileNotFoundException: Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath., compiling:(search.clj:1:1)
tried the first one, not sure why clojure 1.4 was retrieved in the process:
Retrieving maven-metadata.xml from (1k)
Retrieving clojure-1.4.0.jar from (3341k)
require
will compile the clj source file and set up the namespace in the global namespace registry and stuff
also, this sounds like a dumb question (sorry I am a newbie) but is there anyway to kill a cider repl without buffer kill