This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-29
Channels
- # announcements (1)
- # aws (4)
- # beginners (45)
- # biff (4)
- # calva (13)
- # clojure (38)
- # clojure-europe (2)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojure-sweden (8)
- # clojurescript (9)
- # conjure (1)
- # core-async (4)
- # fulcro (5)
- # graalvm (6)
- # gratitude (3)
- # hyperfiddle (10)
- # off-topic (40)
- # pathom (4)
- # portal (23)
- # releases (1)
- # xtdb (5)
Is it possible to run Portal on the JVM but with a web UI, so that the ui can be accessed remotely over http?
Yes, as long as you have the port exposed/accessible.
Hm, I tried
((requiring-resolve 'portal.api/open) {:port 8989
:value (atom (list {:workspaces [], :reports []}))})
which opens a new chrome window but I am not able to open http://localhost:8989 in ab rowserWhat URL does it open in Chrome?
it opens a chrome window w/o the address bar
Inspector > Network shows it runs at a random port http://localhost:57740/?6d6a5e66-ccde-45f2-a268-ab76ad381ec1 so the
That could be its socket server...?
You need start
, not open
. That's how you can control where the server runs etc, if I'm understanding the code correctly.
found it, it should have been :portal.launcher/port
though start looks like a valid option too, thank you!
Ah, yes, I thought it also accepted the short options but you're right, it only accepts the long options.
open
will start and then open a browser. start
will just start the server. You might need :portal.launcher/host "0.0.0.0"
if you plan to access this remotely from another machine.
ah, then start looks much better. Thank you!
Looking at the code again, I think it does accept the short option names -- it just renames the long ones to the short ones if present.
Confirmed:
(~/clojure)-(!2034)-> clojure -M:portal:rebel
[Rebel readline] Type :repl/help for online help info
user=> (require '[portal.api :as p])
nil
user=> (p/open {:port 4321})
{:session-id #uuid "12fa92f9-4e7e-4cac-a5e2-1e45f474264d"}
user=>
And I can open a browser at http://localhost:4321 and get Portal (in addition to the window it already opened without an address bar).right. Interesting it did not work for me at first...
I must have screwed up something
And I just tested it with p/start
as well -- works too (without opening its own browser window).
Sounds like you're up and running now?
yes, I am, thanks a lot!
There was a bug in a recent version where this wouldn't work because the ui wasn't using the correct port when it tried to make websocket connections
How do I specify :predicate
for a custom Command? I see that portal.ui.commands/register!
takes it as opts but portal.api/register!
does not and the former is cljs-only. Thank you!
I see it just delegates to portal.runtime/register!
which has the 2-arg variant but why is it not exposed by the api?