babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2021-05-16T03:47:52.331200Z

Anyone have an example of reagent.dom.server working in babashka?

2021-05-16T05:20:48.331400Z

Hehe nevermimd, reagent.dom.server is a cljs file 😛

dabrazhe 2021-05-16T17:16:48.333600Z

Has someone managed to run a ring or httpkit server with bb in docker? I want to try it on aws fargate.

grazfather 2021-05-16T17:23:35.333900Z

How can I get the CWD easily in bb?

lispyclouds 2021-05-16T17:27:59.334Z

(System/getProperty "user.dir")

lispyclouds 2021-05-16T17:46:28.334300Z

would this help? https://github.com/babashka/babashka/blob/master/examples/file-server.clj

borkdude 2021-05-16T17:58:42.334600Z

Yes, httpkit is built in so that shouldn't be a problem :)

grazfather 2021-05-16T18:39:17.334900Z

Thank you!

dabrazhe 2021-05-16T21:34:29.336100Z

This will likely help, will have a look. Now to create the docker file : )

dabrazhe 2021-05-16T21:35:24.336300Z

Which version of httpkit is built in bb? I can't seem to be able to stop the server with /server-stop! getting some protocol error.

borkdude 2021-05-16T21:41:12.336700Z

@dennisa I think the newest one. I'm getting the same error with clojure:

$ clojure -Sdeps '{:deps {http-kit/http-kit {:mvn/version "2.5.3"}}}' -M /tmp/httpkit.clj
Syntax error (IllegalArgumentException) compiling at (/tmp/httpkit.clj:3:1).
No implementation of method: :-server-stop! of protocol: #'org.httpkit.server/IHttpServer found for class: clojure.lang.AFunction$1

borkdude 2021-05-16T21:43:54.336900Z

@dennisa It seems it works like this:

(def server (srv/run-server (fn [_])))
(server)

borkdude 2021-05-16T21:44:27.337100Z

(def server (srv/run-server (fn [_])))
(server :timeout 100)

borkdude 2021-05-16T21:46:07.337300Z

It seems the return value depends on:

If :legacy-return-value? is
    true  (default)     ; Returns a (fn stop-server [& {:keys [timeout] :or {timeout 100}}])
    false (recommended) ; Returns the HttpServer which can be used with `server-port`,
                        ; `server-status`, `server-stop!`, etc.