Fork me on GitHub
#fulcro
<
2021-08-11
>
lance.paine13:08:43

I'm just trying to have an explore of fulcro-rad-demo, I've cloned the repo. I'm on the develop branch at HEAD. Struck what looked like https://github.com/thheller/shadow-cljs/issues/77#issuecomment-509628657, fixed that by updating the project deps.edn (vs ~/deps.edn). I've run

$ clj -A:dev:sql
user=> (clojure.core/require 'development)
user=> (development/go)
AND
$ yarn
$ shadow-cljs watch main
I had a couple of warnings about incompatible versions for clojure, cljs and closure, so set them to what the error suggested
org.clojure/clojurescript              {:mvn/version "1.10.773"}
           org.clojure/clojure                    {:mvn/version "1.10.1"}
           com.google.javascript/closure-compiler-unshaded {:mvn/version "v20200830"}}
After that when I run shadow-cljs i get the shadow-cljs ui at 9630, and visit localhost:8081, I get "Not found. Missing index.html.". If I explicitly run the compile for test (browser-test) in the shadow-cljs ui then it produces an index.html at resources/public/js/test/index.html and then a GET of localhost:8081 returns that index.html. Am I missing something that gives the demo index.html? Is it perhaps because I'm not heeding the warning bout Running from source? Despite message on (development/restart) about starting a listener on localhost:3000 , I don't have anything there.

2
👍 1
lance.paine13:08:29

Ah, to somewhat answer my own question. Looks like some WSL2 fun. Using chrome from windows at localhost:3000 gives me nothing. But in wsl2 terminal curl localhost:3000 gave

➜  curl localhost:3000

<html><html lang="en"><head lang="en"><title>Application</title><meta charset="utf-8"><meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"><link href="" rel="stylesheet"><link href="data:image/x-icon;," rel="shortcut icon" type="image/x-icon"><script>var fulcro_network_csrf_token = '';</script></head><body><div id="app"></div><script src="/js/main/main.js"></script></body></html></html>%
A firefox running in the wsl2 instance can get it too. So looks like a not listening to the request from the windows host for the dev server.

lance.paine13:08:37

Yup, changing defaults.edn:2 from

:ip   "localhost"}
to
:ip   "0.0.0.0"}
and I can get to it! Thanks in advance for listening to my confusion! 🙂 I look forward to exploring 🙂

Jakub Holý (HolyJak)13:08:58

Weird, why would localhost:3000 not work for you before the change?

lance.paine14:08:07

the wsl2 (windows subsystem for linux) instance in windows 10 is an almost-but-not-quite-vm run on hypervisor. there's some interesting shenanigans I forget the details of where it uses bridged networking to let the host windows see it, but not always. so the requests from the windows host aren't coming from localhost, from the perspective of the ws2l instance, but a separate adapter. It's curious that the shadow-cljs ui is happily exposed, by default.

lance.paine14:08:42

which re-raises the question, why do i subject myself to this mixed windows/linux world, instead of just linux. For which I have no good answer, any more. 🙂 It's not too bad, until it is 😄

👍 1
Jakub Holý (HolyJak)15:08:05

Ah, I see. I faintly remember someone running into this as well. Would you consider submitting a PR with tips for WSL users?

lance.paine15:08:17

Absolutely, just on the readme.adoc, or a link to wsl tips?

tony.kay19:08:00

yeah, on the readme would be fine, with perhaps links?

lance.paine08:08:26

What's your PR process, you want it to a branch, or from a cloned repo? Would you like those deps.edn changes I needed to make it work in a separate PR? Looks like actually just removing the map entry for :ip is enough. And matches what's going on in the shadow-cljs.edn for nrepl and shadow-cljs ui.

Jakub Holý (HolyJak)11:08:14

I believe GitHub only allows you to fork the repo then push the code to that fork (which branch does not matter) then open a PR for that.

👍 3
Jakub Holý (HolyJak)11:08:05

I would think that defaulting :ip to localhost is more secure and thus preferable so personally I would like to see just a section in the Readme. YMMV.

tony.kay13:08:55

It's a demo, so something that works universally without ppl having to mess with it is better IMO

👍 6
tony.kay13:08:07

(so if dropping :ip fixes it everywhere, I'd say do that)

👍 3
lance.paine09:08:58

PRs raised

👍 3