Hi, how can I open portal while connected to remote repl?
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.
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.
Sorry, I should describe the question more. I use sublime, With garden repl which forwards port to remote nREPL
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
When you say "remote nREPL", what do you specifically mean? Where is the process running?
main process is in application.garden and I locally start repl which says forwarded port
OK, so you're talking about software-as-a-service with a remote server running your JVM code, yes?
So that's exactly the situation I'm talking about above (once I have an SSH tunnel up and running).
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).
But I don't know if that's a workflow that Application.Garden supports? Forwarding an additional port.
You'd have to talk to the #application-garden folks about that.
cool, thanks Sean, helpful as usual
maybe I will try vscode with joyride somehow...
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...
...but I suspect the issue with Application.Garden will be port access...
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 🤔
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?
@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?
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 👌
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?
(if so, I guess I'm steering Dos a bit wrong here?)
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})
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
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.
gotcha, thanks a lot guys
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.
without dealing starting processes in remote and forwarding ...
basically, why not?
It depends on what ports app.garden forwards -- and what additional ports you can configure it to forward...
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.
I mean, here is the result 'on my computer'
What I want is just to print to Portal
maybe I should adjust clojure-sublimed code for this....
When you're developing, do you run the application locally? Or do you only run the app on the garden, even when developing?
I do both, and I think Portal is the last piece that keeps me from going fully remote development....
Do yo think this would work from a scittle nrepl connection? https://github.com/babashka/scittle/tree/main/doc/nrepl