exec: "sudo chmod 600 /home/susan/.ssh/authorized_keys"Īfter restarting DDEV you should now be able to connect to your DDEV SSH server with your key. To ensure the file rights on the key are corrected, I extended my post-start hooks with a chmod command (replace the username with your username): hooks: That way you all can have your keys set up locally. gitignore - especially if you are working on your projects with multiple people. Otherwise, add the authorized_keys file to the. If you are using DDEV > 1.15 you can add your authorized_keys file to your global home additions. Then add your public key to the authorized_keys file. Add the following structure in the folder.
DDEV has a feature called homeadditions which allows us to add files to our config that will be mounted in the home dir of our DDEV instance. To achieve that, we need to add our public key to the server's authorized_keys file.
#Phpstorm xdebug remote password#
On systems using a virtualization layer in between (Windows/Mac) the IPs cannot be directly accessed - the port solution works around that limitation and allows us to use a more speaking name, too :) Allow Authentication with our private keyĪs we mostly have an SSH agent running for all the things we do anyway, we should access our DDEV SSH server with that key, too, instead of using password based authentication. When using Linux based host systems (not Mac, not Windows, not WSL) you can directly access the SSH server via the container IP. This config makes our DDEV SSH server accessible via port 9922 from the host (can be used with our DDEV site name as host - in my case: :9922). DDEV folder with the following content: version: "3.6" To allow connecting to the DDEV SSH server via the host from all platforms we need to forward the SSH port to the host. Make the SSH server accessible from the host When starting DDEV for the first time after adding this, the container image will be rebuilt with the SSH package and the SSH server will be started. Next I added a post-start hook to start the SSH server when starting DDEV in config.yaml: hooks:
#Phpstorm xdebug remote install#
Let's take a look - step by step: Install an SSH Server in DDEVįirst of all, I added the ssh package to the DDEV web image by adding the following line in DDEV's config.yaml: webimage_extra_packages: Add PHP over SSH as Remote Interpreter in PHPStorm.Allow authentication with our private key.
With DDEV, that is what we would need: We have DDEV running and now want PHPStorm to execute our tests in the DDEV environment.
That means, with the PHPStorm docker integration, you can use a docker image to run your tests, however you cannot connect to an existing, running docker container and use that to run your scripts. PHPStorm has a pretty good docker integration if we are talking about docker run or docker-compose run. As I am using DDEV for most of my projects as simple docker environment for web development and PHPStorm as IDE I wanted to be able to run test from PHPStorm - not only as a script, but fully integrated with coverage and test debugging.