metalbear-co / mirrord

Connect your local process and your cloud environment, and run local code in cloud conditions.
https://mirrord.dev
MIT License
3.81k stars 104 forks source link

mirrord not loaded in IntelliJ/Java project on Google Cloud Workstation #2007

Open thorstenhirsch opened 1 year ago

thorstenhirsch commented 1 year ago

Bug Description

While the mirrord plugin in IntelliJ seems to work fine, there's no sign of mirrord when running the actual Java code. There's also no popup asking me for the target k8s pod. Specifying the target in the mirrord settings has no effect. Also, providing RUST_LOG=warn,mirrord=trace as an environment variable has no effect.

The environment is probably to blame. I'm running a remote IntelliJ session on a Google Cloud Workstation (Linux VM) via IntelliJ Gateway, so IntelliJ is split:

A few things seem weird:

Please take a look at the attached screenshot (coming soon...)! I think mirrord.json is being created on the Win10 machine instead of the Linux VM backend machine. Also I guess the mirrod binary is being stored on the Win10 machine - at least I couldn't find it on the Linux VM backend machine. There's also no mirrord.json on the Linux VM backend machine.

Steps to Reproduce

  1. Install mirrord plugin in IntelliJ
  2. Enable plugin (popup "mirrod enabled" appears, popup "downloaded mirrord binary version 3.72.0" appears)
  3. Start debug session (runs as if mirrord is not enabled at all)

Backtrace

No response

Relevant Logs

No response

Your operating system and version

Win10 frontend, Linux backend

Local process

java

Local process version

17

Additional Info

No response

thorstenhirsch commented 1 year ago

mirrord-json-on-local-win10-machine

lanbabaJZS commented 1 year ago

I'm having the same issue,my environment : an IntelliJ fronted running on a Windows 11 machine a backend runing on a WSL

infiniteregrets commented 12 months ago

hi @thorstenhirsch is the plugin installed on the host or on the client?

Screenshot 2023-11-12 at 8 50 07 PM
infiniteregrets commented 12 months ago

I'm having the same issue,my environment : an IntelliJ fronted running on a Windows 11 machine a backend runing on a WSL

hi, @lanbabaJZS I have opened https://github.com/metalbear-co/mirrord-intellij/pull/194 that should fix the problem you are facing! I will drop an update for you as soon that is released!

thorstenhirsch commented 12 months ago

Hi @infiniteregrets, the bug (as described so far) occurs when the plugin is installed on the client only.

Obviously, now I've installed it on the host as well. But mirrord still doesn't work. Here's the error message when the plugin is installed on the client and on the host: mirrord-plugin-error

infiniteregrets commented 12 months ago

Hi @infiniteregrets, the bug (as described so far) occurs when the plugin is installed on the client only.

Obviously, now I've installed it on the host as well. But mirrord still doesn't work. Here's the error message when the plugin is installed on the client and on the host: mirrord-plugin-error

That looks quite odd, I don't think its related to the plugin. Do you mind restarting your connection?

thorstenhirsch commented 12 months ago

Right... I restarted everything and also made sure that kubectl works on the host by running gcloud auth login in IntelliJ's terminal, which opens a session on the host. However, mirrord still doesn't work.

And still I couldn't find any traces of mirrord's json config on the host. I think it's only available on the client, which is the wrong side since it contains (or can contain) the necessary information for the host to connect to k8s with kubectl.

The whole IntelliJ Gateway architecture seems broken to me. As we can see: it's not just forwarding the UI from the host. Instead there's a client and a host. Why am I able to choose on which side to install plugins? It's an utter mess to find out what parts of a plugin run on which side and how they communicate with each other (my guess: not at all).

infiniteregrets commented 11 months ago

Right... I restarted everything and also made sure that kubectl works on the host by running gcloud auth login in IntelliJ's terminal, which opens a session on the host. However, mirrord still doesn't work.

  • When I enable mirrord IntelliJ is hanging at "starting application" (no matter if debug or normal mode) and then running on a timeout. Then I need to restart IntelliJ as no operation works anymore, not even building the code.
  • When mirrord is disabled IntelliJ can successfully start the Java application locally on the client, but only once. When stopping the application I also need to restart IntelliJ completely as it hangs the same way as above.

And still I couldn't find any traces of mirrord's json config on the host. I think it's only available on the client, which is the wrong side since it contains (or can contain) the necessary information for the host to connect to k8s with kubectl.

The whole IntelliJ Gateway architecture seems broken to me. As we can see: it's not just forwarding the UI from the host. Instead there's a client and a host. Why am I able to choose on which side to install plugins? It's an utter mess to find out what parts of a plugin run on which side and how they communicate with each other (my guess: not at all).

Thanks for trying @thorstenhirsch, unfortunately I have not been able to get the extension to even properly load in the IDE with gateway if installed on host, however I do think it's possible to run it, but on the client it might not be. I will give this another try and possibly make some changes to our setup. I will keep you posted if I end up making progress on it. Thanks for your patience!

eyalb181 commented 2 months ago

Possibly related: https://discord.com/channels/933706914808889356/950020257156833340/1280056160535449610

DmitryDodzin commented 2 weeks ago

Hi, I've tested Google Cloud workstations + IntelliJ IDEA 2024.2.1 with mirrord plugin installed (only on the "host" and with both host and client having the plugin didn't seem to change anything) it seems to to work as expected after I copied over my .kube config and kubectl get po works in the intellij terminal.

I did run into issues when I set a project directory to a path where IntelliJ could not create the .idea folder and this did interfere with our plugin and caused a complete failure to run.

Can I be missing something?