WebStorm remote nodejs docker deploy / compose / run / debug
I am trying to configure WebStorm to allow:
Workflow requirements:
- Run / Debug Configuration to allow:
1. Automated deployment to remote server
2. Invocation of docker-compose up on remote server (in deployment folder)
3. Connect to remote nodejs inside docker container
4. Run npm script
5. Get npm script output
6. Be able to debug within the docker container
Progress so far
A. Configured remote deployment
B. Configured docker in WebStorm to connect to port 2375 on remote server (same server as A)
Issues:
i) Unable to link together steps 1 and 2 in the requirements
Can someone advise what is required ?
I am using WebStorm 2018.1.3 (181.4892.44)
Local Operating System is Windows Server 2012 R2
Remote server is Lubuntu 18.04 running docker 17.05.0-ce
docker container is based on node:latest (10.0.0)
Any help would be appreciated.
Thanks,
David Brock
Please sign in to leave a comment.
Hello, David!
If I understand your case correctly it should work with these steps (I've checked with the Win10 and the remote Ubuntu 16.04):
1. Automated deployment to the remote server
2. 'docker-compose build' and 'docker-compose up' on the remote server to start Docker container
3. Create 'Attach to Node.js/Chrome' Run Configuration where "Host" is equal to the remote server IP, "Port" is equal to the port you've defined in the docker-compose file, "Attach to" first option should be selected (with --inspect key).
4. Debug should work.
Please, note, 'command' in your 'docker-compose' file should contain --inspect-brk key to enable debug.
Also, note that remote interpreters are supported for the Node.js Run/Debug Configurations only. You can debug npm scripts with the local Node.js only. For the remote support please vote for the https://youtrack.jetbrains.com/issue/WEB-20827
Thanks Julia.
I did have a docker-compose section, however this was always attempted to be run locally (i.e on the Windows Machine) - I expected it to be run on the remote machine - is there any way to specify that (other than a manual execution) ?
David
Hi, David!
At the moment you cannot start docker-compose on the remote host from the inside the IDE. But you can start "docker-compose up" via SSH from the local machine on the remote one.
I'd suggest to use a script to automate such behaviour. And start it after the Deployment.
Hi, Julia
Do You plan any improvement to deploy docker-compose remotely?
Hi, Pietruchpawel
It would be nice to create a feature request for any improvement into the YouTrack. Please, provide step by step description of your setup and what should be improved for the docker-compose feature.