Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilitate managing Docker Swarms #403

Open
cowwoc opened this issue Dec 20, 2024 · 5 comments
Open

Facilitate managing Docker Swarms #403

cowwoc opened this issue Dec 20, 2024 · 5 comments

Comments

@cowwoc
Copy link

cowwoc commented Dec 20, 2024

Use-case: I have a docker swarm. I'd like to create a new connection for a swarm manager, adding various children configurations, then clone the entry once for every other manager node I have. Currently cloning seems to only clone the top-level connection, forcing me to recreate the children by hand.

@cowwoc
Copy link
Author

cowwoc commented Dec 20, 2024

Related use-case, it would be helpful to have Docker Swarm related functionality, like applying an action across all manager or worker nodes. For example, if xpipe was swarm-aware then once I add a manager node it might offer to add all other manager nodes (and maybe worker nodes) automatically.

Once it is swarm-aware, it would be great to be able to ssh into any node by its name instead of having to keep track of which IP address is being used (because nodes come and go).

@cowwoc cowwoc changed the title Cloning connections should also clone children Facilitate managing Docker Swarms Dec 20, 2024
@cowwoc
Copy link
Author

cowwoc commented Dec 20, 2024

Following up on #124 (comment)

The reason you want to copy the children nodes (at least the ones that were added manually by the user) is that some services are not auto-detected. For example, I sometimes run JVMs with JDWP (debugging) enabled inside a container and I want to establish an SSH tunnel from my local machine to the host in order to attach a debugger to the running application. I don't think xpipe will auto-detect such a thing so I need to manually recreate it once per node.

@crschnick
Copy link
Member

I see the use case, let me think about how to handle this

@cowwoc
Copy link
Author

cowwoc commented Dec 20, 2024

I might be overthinking this. I only have two use-cases for now:

  1. Establish a tunnel to debug a remote JVM.
  2. Establish a tunnel in order to manage/debug the swarm using https://github.com/jesseduffield/lazydocker.

In practice, connecting to any of the manager nodes is sufficient for lazydocker. For debugging the JVM, I need to connect to the right node.

The point is that I probably don't need the original use-case of adding the entire swarm to xpipe. Lazydocker already provides a lot of functionality so, unless you plan to reimplement all its functionality, it's sufficient for me to just connect to a single node and switch over to it.

There is still value in making it easier to attach a debugger. I'm thinking of doing the following:

  1. Add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 to all the JVMs I launch.
  2. Run docker with -p 5005 which will map the port to a random host port
  3. Use docker port <container-id> to look up the host port number
  4. Create an ssh tunnel from localhost:5005 to the docker host at that port number.

xpipe could theoretically automate steps 3 and 4. A user could connect xpipe to a docker swarm, select a service they'd like to debug (establish a tunnel) and attach a debugger. Anyway... this is just me thinking out loud. I'll let you figure out whether this is something you want to pursue.

@crschnick
Copy link
Member

So I am not that familiar with swarms, but right now if you add a docker context on the system to xpipe, it should show you all containers. When you refresh that, it should automatically add a services entry for each container. If you refresh that, it should show you the docker ports as services and you can tunnel them from there.

I don't know how many systems you use, but if that is something you want to fully automate that process including adding the JVM debugger args and exposing ports, you can look into the API at https://github.com/xpipe-io/xpipe-python-api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants