biff

A web framework + self-hosted deployment solution for Clojure. Repo: https://github.com/jacobobryant/biff. Docs: https://biff.findka.com
2020-06-13T02:31:39.104200Z

I cloned Biff cd’d to example did ./task setup ./task dev - got repl connected, and did a build of app but nothing at localhost:8080 got some warnings in terminal but nothing looked fatal. Did I miss something?

2020-06-13T03:32:25.106Z

no, that should be everything. Did you see a System started message in the terminal? Could you check if there's a file at biff/example/www/localhost/index.html? Would you mind pasting the output of ./task dev here?

2020-06-13T11:50:38.106200Z

example git:(master) ✗ ./task dev system | Tmux socket name: overmind-example-dVQVZT69AyewrKw79q2PBY system | Tmux session ID: example system | Listening at ./.overmind.sock cljs | Started with pid 65979... repl | Started with pid 65978... cljs | shadow-cljs - config: /Users/tmb/Coding/Clojure/biff/example/shadow-cljs.edn cljs | shadow-cljs - starting via “clojure” 07:41:29.353 [main] INFO crux.hash.jnr - dlopen(libgcrypt.dylib, 9): image not found cljs | 07:41:29.378 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider 07:41:29.444 [main] INFO crux.hash - Using libcrypto (OpenSSL) for ID hashing. cljs | 07:41:30.315 [main] DEBUG io.undertow - starting undertow server io.undertow.Undertow@7908c1f0 cljs | 07:41:30.325 [main] INFO org.xnio - XNIO version 3.7.2.Final cljs | 07:41:30.342 [main] INFO org.xnio.nio - XNIO NIO Implementation Version 3.7.2.Final cljs | 07:41:30.456 [main] INFO org.jboss.threads - JBoss Threads version 2.3.2.Final cljs | 07:41:30.473 [XNIO-1 I/O-1] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-1’, selector http://sun.nio.ch.KQueueSelectorImpl@32a6a05e cljs | 07:41:30.473 [XNIO-1 I/O-3] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-3’, selector http://sun.nio.ch.KQueueSelectorImpl@707f743e cljs | 07:41:30.473 [XNIO-1 I/O-4] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-4’, selector http://sun.nio.ch.KQueueSelectorImpl@7ad70a22 cljs | 07:41:30.473 [XNIO-1 I/O-2] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-2’, selector http://sun.nio.ch.KQueueSelectorImpl@44890e76 cljs | 07:41:30.474 [XNIO-1 I/O-5] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-5’, selector http://sun.nio.ch.KQueueSelectorImpl@55f9d9e2 cljs | 07:41:30.474 [XNIO-1 I/O-6] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-6’, selector http://sun.nio.ch.KQueueSelectorImpl@570f52b4 cljs | 07:41:30.475 [XNIO-1 I/O-7] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-7’, selector http://sun.nio.ch.KQueueSelectorImpl@4f3554df cljs | 07:41:30.475 [XNIO-1 I/O-8] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 I/O-8’, selector http://sun.nio.ch.KQueueSelectorImpl@686f03d0 cljs | 07:41:30.475 [XNIO-1 Accept] DEBUG org.xnio.nio - Started channel thread ‘XNIO-1 Accept’, selector http://sun.nio.ch.KQueueSelectorImpl@1df72839 cljs | 07:41:30.478 [main] DEBUG io.undertow - Configuring listener with protocol HTTP for interface 0.0.0.0 and port 9630 cljs | shadow-cljs - server version: 2.8.40 running at http://localhost:9630 cljs | shadow-cljs - nREPL server started on port 7890 07:41:34.802 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider Starting :biff.core/toggle-nrepl :example/core :biff/init :biff/console :biff/web-server 07:41:37.510 [main] DEBUG crux.memory - :pool-allocation-stats {:allocated 131072, :deallocated 0, :in-use 131072} repl | 07:41:37.525 [crux-tx-consumer] INFO crux.tx - Started tx-consumer repl | 07:41:37.528 [crux-tx-consumer] DEBUG crux.memory - :pool-allocation-stats {:allocated 262144, :deallocated 0, :in-use 262144} WARNING: An illegal reflective access operation has occurred repl | WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/Users/tmb/.m2/repository/org/jboss/xnio/xnio-nio/3.3.6.Final/xnio-nio-3.3.6.Final.jar) to constructor http://sun.nio.ch.KQueueSelectorProvider() repl | WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2 repl | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations repl | WARNING: All illegal access operations will be denied in a future release 07:41:37.936 INFO [org.projectodd.wunderboss.web.Web] (main) Registered web context / repl | System started. cljs | 07:42:38.016 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - Attempting websocket handshake with io.undertow.websockets.core.protocol.version13.Hybi13Handshake@62886b56 on HttpServerExchange{ GET /api/ws} cljs | 07:42:38.017 [XNIO-1 I/O-7] DEBUG io.undertow.request - Upgrading request HttpServerExchange{ GET /api/ws} cljs | 07:42:38.145 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1 cljs | 07:42:38.155 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1 cljs | 07:42:38.156 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1 cljs | 07:43:38.364 [XNIO-1 I/O-8] DEBUG io.undertow.request - Timing out idle connection from /0:0:0:0:0:0:0:1:65271 cljs | 07:43:41.841 [XNIO-1 I/O-1] DEBUG io.undertow.request - Timing out idle connection from /0:0:0:0:0:0:0:1:65270 cljs | 07:45:05.317 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1 cljs | 07:46:01.620 [XNIO-1 I/O-2] DEBUG io.undertow.request - Timing out idle connection from /0:0:0:0:0:0:0:1:65493

2020-06-13T19:03:22.111700Z

Everything looks good in that output. Going to localhost:8080 should serve files from biff/example/www/localhost/. Is there an index.html file in that directory?

2020-06-13T21:05:50.113400Z

retried checked index.html - it contains a login form did a force compile in the shadow-cljs dashboard - no error messages - after a fairly long wait I get a 404

2020-06-13T22:37:49.120800Z

I think I've found the issue. I've pushed a new commit to Biff. Set :sha to "668ebd1ade0abf57ec5963a23fa8678819e5cb1e" in biff/example/config.edn and try running ./task dev again. The update (https://github.com/jacobobryant/biff/commit/668ebd1ade0abf57ec5963a23fa8678819e5cb1e) sets the default port to 8080 instead of nil. Immutant is supposed to default to 8080 anyway (and it has been for me at least), but evidently that's not happening in your environment for some reason.

2020-06-13T23:00:05.121600Z

That helps but I get a “not found” at http://localhost:8080/index instead of a login

2020-06-13T23:07:43.123400Z

ok, progress at least. Can you add the following :example/debug component to example.core/components?

(def components
  [{:name :example/debug
    :requires [:biff/web-server]
    :start (fn [sys]
             (prn (select-keys sys [:biff.web/host->handler]))
             sys)}
   {:name :example/core
    :requires [:biff/init]
    :required-by [:biff/web-server]
    :start start-example}])
Then run ./task repl (`./task dev` is fine too, but it'll take longer since it starts shadow-cljs which we don't need for debugging this)

2020-06-13T23:08:45.123900Z

actually hold on for a second, I may need to update that component

2020-06-13T23:11:13.124700Z

ah I got the :requires field wrong. I've edited the code sample; go ahead and try that.

2020-06-13T23:14:29.127300Z

this is the output I get:

#:biff.web{:host->handler {"localhost" #object[ring.middleware.ssl$wrap_hsts$fn__13477 0x56cdcae6 "ring.middleware.ssl$wrap_hsts$fn__13477@56cdcae6"]}}
I suspect that the "localhost" key will not be present for you. If it is instead "http://example.com", that would suggest that the BIFF_ENV environment variable isn't getting set/read correctly, and thus the :dev portion of config.edn isn't being used. However... if that were the case, I'd expect Crux to try establishing a postgres connection and then failing. so let's just see what the output you get is and go from there.