Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Debugging: Allow to define a wrapper to make it SSH, Docker, docker-compose and Kubernetes friendly #678

Open
Nowaker opened this issue Nov 5, 2020 · 3 comments
Assignees
Labels
feature-request Adds currently unsupported functionality

Comments

@Nowaker
Copy link

Nowaker commented Nov 5, 2020

request=launch in .vscode/launch.json is for running the code locally. request=attach is for attaching to a remote rdebug-ide process . These two approaches make it impossible to launch the code remotely. This is the goal:

    {
      "name": "Rails",
      "type": "Ruby",
      "request": "launch",
      "wrapper": "bin/launch-wrapper.sh",
      "cwd": "${workspaceRoot}",
      "remoteWorkspaceRoot": "/var/www/appcode",
      "program": "${env:GEM_HOME}/bin/puma",
      "useBundler": true
    }

And bin/launch-wrapper.sh is:

#!/usr/bin/env bash
set -x
cd "$(dirname "$0")/.."
docker-compose exec -T app $@

or

#!/usr/bin/env bash
set -x
ssh -A user@example.com bash -c "cd /blah; $@"

and even multiple hops:

#!/usr/bin/env bash
set -x
ssh -A user@jumpbox.com bash -c "ssh -A otheruser@corp-network-host \"kubectl exec -it podname -n namespace bash -c '$@'\""

When wrapper is present, the extension will construct the whole command as it would normally do, e.g. bundle exec rdebug-ide -- ${env:GEM_HOME}/bin/puma, but pass it as arguments to the wrapper, making it bin/${wrapper} bundle exec rdebug-ide -- ${env:GEM_HOME}/bin/puma.

Introduction of wrapper for request=launch is imperative of allowing remoteWorkspaceRoot to accommodate for different paths on source host and launch host, just like it's a case for request=attach.

Some extensions already allow this. For example, Perl Language Server allows perl.sshCmd in settings.json, and I configured it to execute the Perl Language Server inside a docker-compose container.

@github-actions
Copy link

github-actions bot commented Dec 6, 2020

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Dec 6, 2020
@Nowaker
Copy link
Author

Nowaker commented Dec 6, 2020

Don't you dare, bot.

@wingrunr21 wingrunr21 added feature-request Adds currently unsupported functionality and removed stale labels Dec 6, 2020
@wingrunr21 wingrunr21 self-assigned this Dec 6, 2020
@exocode
Copy link

exocode commented Dec 26, 2021

End of 2021. Any news on how to debug within a Kubernetes cluster?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Adds currently unsupported functionality
Projects
None yet
Development

No branches or pull requests

3 participants