I am totally blind so my development setup is quite different than for most sighted people. My goal is to be able to use PHPStorm and VSCode simultaniously and use power of Docker to run containers and that way develop stuff.
I can’t use Linux as my main machine, because Orca screen reader is not as good as screen readers on Windows or MAC OS and my productivity significantly decreases when I try to use it so I decided to stick with Windows and NVDA screen reader.
My usual setup:
- Windows as a host machine;
- Ubuntu based on VMWare workstation as a guest VM (connection goes via NAT (hostname));
- Docker + Docker-compose on VM;
- Openssh-server on VM + authorized_keys to avoid entering password every time I connect from a host machine;
- VSCode + Remote SSH extension (to connect to VM) + buch other extensions;
- Some terminal on host machine that has SSH connection capability;
- If it is a web app then I make aliases in host machine’s hosts file to point to an IP of my VM (so I can test in in my browser on Windows).
I write my code almost natively due to VSCode’s ability to install server into VM and control my VM via SSH so there are no problems there, but recently I got involved into a project (with Symfony + APIPlatform) and VSCode doesn’t support auto complete for APIPlatform (I use Intellephense to get suggestions for PHP projects) and it works well though not when I need to write annotations in comments as APIPlatform requires (there is a way – write it in attribute syntax, although PHP version should be >=8.0 (and it looks like even then I do not get autocomplete for it) + there are plenty projects based on annotation syntax) so I really can’t avoid it. I sadly have to change my IDE.
I decided to try out PHPStorm (it was totally inaccessible in the past, but now it is better so I can write code in it, use it’s autocompletion features, refactoring and etc (there are bugs, but not fatal ones)). It has Symfony + Doctrine + APIPlatform support so I thaught to use it instead and write code in it, but debug it on VSCode (it has much better debug support in terms of accessibility).
My problem arise due to the way PHPStorm works when I setup project as SFTP server. VSCode installs it’s own server to the VM so it looks like a native development, but PHPStorm downloads all the project from remote machine (in my case Ubuntu VM) and then it’s like I develop locally. When I save a file, it doesn’t send that file immediately to VM (just saves it on host machine in PHPStorm’s projects directory), but my VSCode is not even here so it doesn’t receive file changes and I can’t debug here. Yes, I can fix this in settings by allowing pHPStorm to upload files when I save them, but I still can not use PHP’s interpreter on Docker container so point is still valid.
I found that PHPStorm supports WSL2 (Windows subsystem for Linux) and since VSCode has awesome Remote extension for that, I thaught I can share my source code via wsl$ path (with PHPStorm) and natively with VSCode, but since there is another layer (Dockerized containers based on Docker-compose), it changesthings.
If I would use Docker desktop + WSL2 as Linux back-end then I could map / point the paths for PHPStorm to Docker and Docker-compose executables on my host machine and build my projects without an extra layer of VM (just Windows and WSL2). I would enjoy this, but sadly sometimes there are projects in which scripts do something non-standard so it becomes really hard to build containers successfully so I would like to use Ubuntu VM as an extra layer to be sure that every project gets built (no systemd issues with systemctl etc) + easyer too Google things out.
I’ve noticed that there is a way for PHPStorm to set Docker Daemon exposed via TCP so an idea came to my head to install only docker.io and docker-compose to WSL2 (without Docker desktop), so I can make Docker daemon on my VM exposed to TCP connections and that way I can give PHPStorm a correct path to PHP interpreter on my php-fpm container + I can just export DOCKER_HOST environment variable as tcp://192.168..:2375 on my WSL2 (even set this in .bashrc to make it automatically set when I reload shell). This way I can build containers which are in Docker which is on my Ubuntu VM directly from my WSL2 without even SSH’ing into VM.
That part works, but I have no idea how to set volumes (to share my source code on WSL2 with Dockerized container which runs on a remote (same network of course) machine with a help of Docker daemon).
It is easy to setup volumes in docker-compose.yml file on Ubuntu VM and concrete container, but how to share the same volume with Windows / host OS?
I thaught of shared / synced folders, but those are buggy (remember from the past when I had to do it on my Vagrant machine).
Do I have some options here?