Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless serving mode #21

Closed
delyada opened this issue Oct 29, 2020 · 7 comments
Closed

Headless serving mode #21

delyada opened this issue Oct 29, 2020 · 7 comments

Comments

@delyada
Copy link

delyada commented Oct 29, 2020

Hi, (this looks awesome!)

I would like to know if it would make sense to launch the portal web server in headless mode, delegating to the user the responsibility of opening it up in their browser themselves.

I'm asking because we're trying to use it from a Windows WSL 2 Ubuntu image. Those images don't have windowing capabilities, only terminal capabilities. If they could just spit up the served url and port, I think we'd be fine to use portal from our Windows host chrome.

Thanks for any answer!

@djblue
Copy link
Owner

djblue commented Oct 30, 2020

Hi @djomphe-elyada,

Does portal try to open a browser window or basically do nothing?

I could add a url to the returned data which would let you know where to go.

Thanks!

@delyada
Copy link
Author

delyada commented Oct 30, 2020

Thanks djblue, I should have provided some context, here are two screenshots.

image (1)

image

I tried to configure a X server and had success through the command line with gvim, but anyways if we could use a headless mode and browse ourselves, it would ease so much more our setup! So yes, if you provide a URL and portal's server is still up to serve its UI, it would be next to perfect.

@djblue
Copy link
Owner

djblue commented Oct 30, 2020

Thanks for the specific details. I think 683c911 should fix your issue. It will catch the exception and print the url. I don't know when I'll release this fix but it will probably be soon.

@delyada
Copy link
Author

delyada commented Nov 2, 2020

Thanks again. Browsing the provided URL resulted in a logged error:

❯ clj -M:elyada-dev
DEPRECATED: Libs must be qualified, change refactor-nrepl => refactor-nrepl/refactor-nrepl (/home/djomphe/.clojure/deps.edn)
Cloning: https://github.com/djblue/portal
Checking out: https://github.com/djblue/portal at 683c911fab23f2272256519cc2342e167f733e1e
Clojure 1.10.1
user=> (require '[portal.api :as p])
nil
user=> (p/open)
Goto http://localhost:45881?e317d4df-dc28-43a3-8d05-77df708197e3 to view portal ui.
{:session-id #uuid "e317d4df-dc28-43a3-8d05-77df708197e3"}
user=> Mon Nov 02 09:46:03 EST 2020 [worker-3] ERROR - GET /main.js
java.lang.IllegalArgumentException: Cannot open <nil> as a Reader.
        at clojure.java.io$fn__11520.invokeStatic(io.clj:288)
        at clojure.java.io$fn__11520.invoke(io.clj:288)
        at clojure.java.io$fn__11422$G__11398__11429.invoke(io.clj:69)
        at clojure.java.io$reader.invokeStatic(io.clj:102)
        at clojure.java.io$reader.doInvoke(io.clj:86)
        at clojure.lang.RestFn.invoke(RestFn.java:410)
        at clojure.lang.AFn.applyToHelper(AFn.java:154)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$slurp.invokeStatic(core.clj:6942)
        at clojure.core$slurp.doInvoke(core.clj:6942)
        at clojure.lang.RestFn.invoke(RestFn.java:410)
        at portal.runtime.jvm.server$handler$fn__746.invoke(server.clj:67)
        at portal.runtime.jvm.server$handler.invokeStatic(server.clj:70)
        at portal.runtime.jvm.server$handler.invoke(server.clj:63)
        at clojure.lang.Var.invoke(Var.java:384)
        at org.httpkit.server.HttpHandler.run(RingHandler.java:117)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

@djblue
Copy link
Owner

djblue commented Nov 3, 2020

Hi @djomphe-elyada, using portal via git-deps doesn't currently work because I include the clojurescript client build in the release jar but not in the git repo. I just release 0.6.3 which should fix your issue.

@delyada
Copy link
Author

delyada commented Nov 3, 2020

Hi, thanks a lot, this is superb, it now works for us as of 0.6.3!
Can't wait to start playing with Portal now!

@djblue djblue closed this as completed Nov 3, 2020
@hoclun-rigsep
Copy link

I had a similar problem but an error wasn't thrown. I was able to figure out where to browse by evaluating (portal.api/url (portal.api/open))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants