portal

Dos 2024-10-27T17:04:48.073429Z

Hi, how can I open portal while connected to remote repl?

djblue 2024-10-27T17:08:07.477549Z

There are a couple of ways to do this. Are you using the vscode? Do you need to inspect a specific value? Are you using port forwarding? Can you describe your setup please.

seancorfield 2024-10-27T17:47:25.096229Z

We do this at work but there are a couple of caveats: • We run an nREPL server in the remote process (`nrepl.server/start-server`) • We run a Portal server in the remote process (`portal.api/start`) • We use VS Code locally • We have a Joyride script for VS Code that takes the local Portal EDN file (containing the host/post) and uses the JVM connection to write it to the remote server (so only one local client can be connected to Portal at a time) If that sounds like your setup, look at https://github.com/seancorfield/vscode-calva-setup/blob/develop/joyride/src/remote_repl.cljs which is a generic version of our Joyride script that opens an SSH tunnel, connects to the remote nREPL server, and copies the local config to the remote server, so that we can then start a Portal client for it.

Dos 2024-10-28T01:48:00.039529Z

Sorry, I should describe the question more. I use sublime, With garden repl which forwards port to remote nREPL

Dos 2024-10-28T01:51:42.152999Z

I didn't understand about inspect a specific value . I want to use as usual, inspecting incoming http-requests when needed, and tap> some custom expressions

seancorfield 2024-10-28T01:53:07.945579Z

When you say "remote nREPL", what do you specifically mean? Where is the process running?

Dos 2024-10-28T01:55:06.363559Z

main process is in application.garden and I locally start repl which says forwarded port

seancorfield 2024-10-28T01:56:06.183069Z

OK, so you're talking about software-as-a-service with a remote server running your JVM code, yes?

👍 1
seancorfield 2024-10-28T01:56:30.568049Z

So that's exactly the situation I'm talking about above (once I have an SSH tunnel up and running).

seancorfield 2024-10-28T01:58:53.433269Z

You need a local browser instance of Portal (since Sublime has no integrated support), connecting to the Portal server running on Application.Garden (assuming your remote process has started the Portal HTTP server).

seancorfield 2024-10-28T01:59:24.446409Z

But I don't know if that's a workflow that Application.Garden supports? Forwarding an additional port.

seancorfield 2024-10-28T01:59:54.841299Z

You'd have to talk to the #application-garden folks about that.

Dos 2024-10-28T02:00:36.742369Z

cool, thanks Sean, helpful as usual

Dos 2024-10-28T02:02:05.613679Z

maybe I will try vscode with joyride somehow...

seancorfield 2024-10-28T02:06:44.283979Z

The main thing is being able to have Portal on the server use predicable ports -- and maybe that can be done without spitting that file...

seancorfield 2024-10-28T02:07:42.309589Z

...but I suspect the issue with Application.Garden will be port access...

djblue 2024-10-28T02:08:52.716609Z

I have been thinking of a version of portal where you provide your own http server, as long as it supports web sockets in some way 🤔

Dos 2024-10-28T02:09:46.345379Z

so basically if they open 1 additional port for Portal server I can start Portal server there and connect locally to it and the result appears in my local Portal webpage, is this a desired logic?

seancorfield 2024-10-28T02:13:23.017129Z

@djblue Can you speak more about the ports needed for Portal? Am I right that the only reason VS Code needs the local EDN file copied to the remote, is to tell Portal (on the server) to use a specific port, so that the client (VS Code/Portal extension) can connect? And for a web browser standalone client, you could connect to "any" port so you just need to start Portal (on the server) on a specific port?

djblue 2024-10-28T02:15:50.539049Z

Yup, that is correct. The vscode/intellij extensions need to orchestrate another port so the REPL can communicate with the editor. If you don't need that functionally, you don't need to worry about it 👌

seancorfield 2024-10-28T02:16:43.264489Z

And without that EDN port file, Portal starts up on a random port? Or you can just tell it to open on a single specific port for both HTTP and WS?

seancorfield 2024-10-28T02:17:07.192389Z

(if so, I guess I'm steering Dos a bit wrong here?)

djblue 2024-10-28T02:19:22.315859Z

The edn file stores info on how to connect to your editor extension and isn't used by the REPL process to determine how to run your portal ui. To initialize the portal REPL process server, you do (portal.api/start {:port 1234})

Dos 2024-10-28T02:21:32.175369Z

does (portal.api/start {:port 1234}) start the process in remote (app.garden in my case)? because running that won't open up the portal locally

djblue 2024-10-28T02:25:05.066919Z

Yup, it starts the server without trying to open the UI. To open the UI, you can try connecting directly if the port is available remotely: or you need to find a way to port forward the remote port locally, like Sean suggested.

Dos 2024-10-28T02:26:20.014379Z

gotcha, thanks a lot guys

Dos 2024-10-28T02:31:25.793769Z

I thought that since I can see the results of the evaluated expression in Sublime, I could just somehow forward them to the portal and see them in a convenient way.

Dos 2024-10-28T02:32:35.893129Z

without dealing starting processes in remote and forwarding ...

Dos 2024-10-28T02:32:42.389399Z

basically, why not?

seancorfield 2024-10-28T02:33:30.914809Z

It depends on what ports app.garden forwards -- and what additional ports you can configure it to forward...

seancorfield 2024-10-28T02:36:05.059309Z

I don't see much in the docs that speaks to that... they only talk about nREPL and that's auto-injected and auto-forwarded... ...so you'd need to explicitly have Portal as a dependency in your app (whereas you don't need nREPL as a dependency). But it isn't clear you could connect to that port... ...so, ask in #application-garden and see what they say.

👍 1
Dos 2024-10-28T02:36:05.500579Z

I mean, here is the result 'on my computer'

Dos 2024-10-28T02:36:59.316149Z

What I want is just to print to Portal

Dos 2024-10-28T02:37:45.685639Z

maybe I should adjust clojure-sublimed code for this....

seancorfield 2024-10-28T02:58:24.027019Z

When you're developing, do you run the application locally? Or do you only run the app on the garden, even when developing?

Dos 2024-10-28T04:55:55.083139Z

I do both, and I think Portal is the last piece that keeps me from going fully remote development....

chromalchemy 2024-10-29T22:00:11.685239Z

Do yo think this would work from a scittle nrepl connection? https://github.com/babashka/scittle/tree/main/doc/nrepl