简体   繁体   中英

How to set up one-click debugging for an application with multiple processes in WebStorm?

I have an application that requires a bunch of moving parts to run, and I'd like to set things up so WebStorm can launch all of it.

An example of what I need to do:

  • Open a SSH tunnel to the database, which can be accomplished using a script.
  • Start the API using a NPM script that runs nodemon
  • Attach a debugger set to automatically reconnect to nodemon
  • Run the angular development server for the front-end
  • Run a HTTP reverse proxy to put all of this into the same URL space - the frontend calls the API using root-relative URLs, and the backend doesn't allow CORS
  • Debug the app in Chrome

This presented me with a bunch of problems:

  • I can't express the dependencies with "Before launch" that simply won't fire up, because WebStorm waits for the "before" tasks to finish; obviously these process actually need to run continuously.
  • Compound configurations can only run all of their component configurations in "Run" mode or in "Debug" mode. You can also only use the mode that all of the components have; so eg if you have a script configuration (which cannot be debugged) and an attached debugger (which cannot be run without debugging) you'll end up with a configuration that can't be run at all.
  • If I use a compound configuration without the tunnel that still means the backend will be run in debug mode which I actually don't want, because I'm attaching to it from another configuration. The frontend server will also be run in debug mode which is also pointless.
  • nodemon in general seems kind of flaky when run from WebStorm, possibly due to NPM; when I stop the debug it it actually doesn't do anything, and when I kill the process afterwards nodemon says it's "restarting child process" but it does actually end nodemon; except WebStorm doesn't notice this, you have to close the debugger tab yourself.

Has anybody managed to get something like this running without actually having to fire up every step on its own?

No way currently... Using Multirun plugin gives you more flexibility (see https://github.com/rkhmelyuk/multirun/wiki/How-to-run-configurations-with-Multirun ), but still you can either run or debug all configurations, there is no way to start one configuration in debugger and run the others. We have a feature request for such option, please follow IDEA-156398 for updates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM