gpt4 book ai didi

ruby-on-rails - 将 ruby​​-debug-ide 附加到现有的 Rails 服务器

转载 作者:太空宇宙 更新时间:2023-11-03 16:40:53 25 4
gpt4 key购买 nike

背景

我有 ruby-debug-ide 所有设置以在 Visual Studio Code 中进行远程调试(我正在使用 Docker)。我在我的 docker-compose.yml 中使用这个命令来启动 ruby-debug-ide 和我的 rails 服务器:

rm -f /api/tmp/pids/server.pid && rdebug-ide --host 0.0.0.0 --port 1234 -- bin/rails server --port=3000 --binding=0.0.0.0

然后在 vscode 中我有这个 launch.json 脚本:

{
"name": "Listen for rdebug-ide",
"type": "Ruby",
"request": "attach",
"cwd": "${workspaceRoot}",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "/app",
"showDebuggerOutput": true
}

当我转到 vscode 并启动 launch.json 脚本时,我的 Rails 服务器和调试器都会启动。但是当我停止/分离 launch.json 脚本时,rails 服务器死机了。

我的问题

有没有办法独立启动我的 Rails 服务器和 ruby-debug-ide?我希望能够在我调试时访问我的 Rails 应用程序。是否有可能做这样的事情:

# start my rails server
rm -f /api/tmp/pids/server.pid && bin/rails server --port=3000 --binding=0.0.0.0

# also start rdebug-ide and wait for something (vscode) to attach to it later on
rdebug-ide --host 0.0.0.0 --port 1234 -- <attach_to_my_rails_server>

最佳答案

你试过这个吗:rdebug-ide --host 0.0.0.0 --port 1234 -- bin/rails s -b 0.0.0.0

关于ruby-on-rails - 将 ruby​​-debug-ide 附加到现有的 Rails 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52694673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com