gefyrahq / gefyra

Blazingly-fast :rocket:, rock-solid, local application development :arrow_right: with Kubernetes.
https://gefyra.dev
Apache License 2.0
687 stars 28 forks source link

Locally running instance support #414

Open javaAndScriptDeveloper opened 1 year ago

javaAndScriptDeveloper commented 1 year ago

What is the new feature about?

Would be nice to add functionality of replacing deployment with locally running instance of an app.

Why would such a feature be important to you?

From my developer's point of view the following feature can be a game changer. Just a little context: As you know debugging microservices in k8s can be quite inconvenient. Having some way to replace deployment with local running instance could make troubleshooting much more easier. Typical usecase of this feature: Run local instance Setup gefyra with url of an instance Run bridge Get all requests from cluster on locally running instance

Anything else we need to know?

This can be done via proxy container which would point to local instance.

SteinRobert commented 1 year ago

@laarchenko thank you for your request. I believe your just describing the command gefyra bridge as is. Could you elaborate what's missing for you?

javaAndScriptDeveloper commented 1 year ago

Bridge supports connecting only to locally running containers. I mean connecting to locally running instances.

Usecase:

Such option can be literally game-changer: with few commands you can replace microservice from cluster and debug it just in IDE in debug mode.

SteinRobert commented 1 year ago

I see! One of the main things Gefyra tries to address is bringing production and development environments closer. Starting your application locally (not in a container) kind of goes against that. However, I would like to understand your setup a bit better! 😃 What are the reasons for you not to develop your application in a container? As far as I know most IDEs support attaching debuggers also within containers.

Schille commented 1 year ago

There is a chance with (upcoming) Gefyra 2 to connect to the cluster using a Wireguard client on your machine. However, there is probably some manual effort to make this work. We'll keep you posted on this.

javaAndScriptDeveloper commented 1 year ago

Sorry it has taken so long to write back; I see gefyra way and it s kinda not related to what I am proposing but it would much improve developers ux. Container debugging in IDE is quite complicated and strange feature. I checked at least how it can be configured in intellij idea and it looks really challenging. Using gefyra with feature I am proposing debug setup can take just 2-3 commands. What is more, debug options in ide are based on receiving debugger output from container. In my case main idea is to just forward all incoming traffic and process it by developers choice. Of course that can be achieved on routing level, using some traefic etc. But gefyra's advantage to traefic solution is simplicity and more high level configuring.

Schille commented 1 year ago

Depending on the level of automation it's relatively easy to implement. Since Gefyra is working atop Wireguard, the CLI could activate a GefyraClient for you in the cluster and write out the Wireguard peer configuration (a). By using the Wireguard client of your favorite platform, you can connect to the cluster. All traffic from your local machine will be redirected to that cluster, including DNS, which will make any K8s-based service available on your local device, too. But, in this simple case, you have to use the FQDN (https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#services) to K8s services as long as you don't set a DNS search domain for your local resolver.

The next level of automation (b) would be to ship wireguard-go (https://github.com/WireGuard/wireguard-go) and connect automatically.

Is the way (a) of achieving a Docker-less connection using a Wireguard client already helpful for you?

javaAndScriptDeveloper commented 1 year ago

Sure, this implementation would solve such use case. What do you think about implementing this script in gefyra cli ?

Schille commented 1 year ago

What do you think about implementing this script in gefyra cli ?

Are you asking for suggestion (a) or (b)?