Giter VIP home page Giter VIP logo

Comments (9)

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024 1

Marked the alias as DEPRECATED and will move to the deps-deprecated.edn file by the next release

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024

Maybe I am missing something but I havent been able to replicate the issue you have been experiencing

image

Are the more details you can supply, e.g. the command used, any network infrastructure being navigated or a project that recreates the issue.

Thanks.

from clojure-cli-config.

toburger avatar toburger commented on May 18, 2024

After investigating a bit more I think I've found the "real" cause of the problem:

The remote NREPL gets registered with the host localhost (see the printed out nrepl://localhost:44947):

image

When i execute a netcat command I can't reach the service:

image

So I think I have to startthe nrepl-Server with the actual host name. The repl/... commands do have a parameter to specify the host name?

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024

Ah yes, I remember the --bind is a server option is required to set the hostname that the nrepl server starts on. If --bind is not set, the default locahost IP address is used

❯ clojure -M:repl/rebel --bind 192.168.0.212 --port 44445
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.test.check.generators, being replaced by: #'clojure.test.check.generators/abs
nREPL server started on port 44445 on host 192.168.0.212 - nrepl://192.168.0.212:44445
[Rebel readline] Type :repl/help for online help info
user=> 

When connecting via the --connect option, the --host option is the client argument that specifies the address set by --bind on the server

Its quite easy to get --host and --bind confused.

The nrepl docs provide some other options, including defining a configuration file.

from clojure-cli-config.

toburger avatar toburger commented on May 18, 2024

Ah, that's exactly what happened! I've tried it with --host and nothing happened so I thought there is no option for that! 😅 Thanks for the hint!

Now the repl/remote works like a charm. But the repl/rebel-remote doesn't seem to use the --host argument.

image

Sorry, I had to hide the host for security reasons but I can assure that the they go to the same host.

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024

Update: sorry, I forgot that --connect was already included in the alias... try using nrepl as a client alone, without rebel readline
https://nrepl.org/nrepl/usage/clients.html#using-the-built-in-client

I believe the --connect option is also required as well as the --host and --port options

clojure -M:repl/rebel-remote --connect --host hostname --port 8083

I dont have a remote setup at the moment to test.

If the above doesnt work, then try using nrepl directly as a remote REPL client
https://nrepl.org/nrepl/usage/clients.html#using-the-built-in-client

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024

I have only managed to get a remote connection by first establishing an SSH forwarding connection. This only seems to work with nrepl connect command locally, using the :repl/rebel-remote rebel readline alias does not seem to know about the remote repl state :(

The Cider docs recommend using a TLS approach

Remote server

Start the REPL process on the remote machine, specifying the port

clojure -M:repl/basic --port 1234

SSH tunnel

Create an ssh local forward tunnel to the remote machine

ssh -L :1234:192.168.0.212:1234 [email protected] -N -v

This will prompt for the user password, e.g. practicalli is the name of the user account on the remote machine.

192.168.0.212 is the IP address of the local machine and 192.168.0.238 is the IP address of the remote machine (replace with your own IP addresses)

Local connection

On the local machine (in a separate terminal prompt), connect to the local port and and nrepl commands will be sent via SSH to the REPL process running on the remote server.

clojure -M:repl/basic --connect --host localhost --port 1234

Testing

At the REPL prompt on the remote server, define a var, e.g.

(def remote-value 42)

At the REPL prompt on the local server, evaluate the var name

remote-value

This should display the value 42 in the local repl prompt.

The process is simpler if using Emacs cider-connect-clj to connect to the remote repl :)

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 18, 2024

If using Emacs Cider as the local REPL connection, define a local SSH connection in the .ssh/config file.

Host gkar-repl
  HostName 192.168.0.238
  # IdentityFile /home/practicalli/.local/joint-clojure-machine.pem
  User practicalli
  PasswordAuthentication yes
  LocalForward 1234 localhost:1234
  Port 22

Uncomment the IdentityFile if there are pem certificates available. Otherwise Emacs Cider will prompt for the user account password on the remote machine.

In Emacs, run the cider-connect-clj command and select the Host definition from the list of connections, e.g. gkar-repl or enter the IP address of the remote server

Enter the port, e.g 1234

Emacs cider should connect to the remote repl state.

from clojure-cli-config.

toburger avatar toburger commented on May 18, 2024

Thanks for the thorough testing!
I've managed to connect via SSH tunnel and Cider and it works!

But in summary we can definitely say that repl/rebel-remote ignores --host and --port parameters.

image

Which is fine for me if I know the limitations but on the other hand the command is misleading as it implies that it is possible to connect to a remote REPL.

from clojure-cli-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.