I’ve been trying to start an xdebug-tunnel session on a remote, non-production, server. However, the command of trellis open some_inventory_hostname is failing. All goes well until the point where the SSH tunnel is opened. At this point it times out.
The VPS is at AWS lightsail with an attached static IP. It seems the SSH attempt is done from the internal / non-static IP. I’m guessing this SSH call is originating from my local machine. If I try to SSH into the non-static IP it also timesout.
Is there anyway that I can inform the trellis xdebut-tunnel command to use the static IP? This I can ssh into fine using the unbuntu
user.
Any thoughts are much appreciated.
Here is the error from the command line.
fatal: [non.production.server -> localhost]: FAILED! => {"changed": true, "cmd": ["ssh", "-M", "-S", "/tmp/trellis-xdebug-non.production.server", "-fnNT", "-R", "9003:localhost:9003", "ubuntu@int.ern.al.ip", "root"], "delta": "0:01:15.006706", "end": "2024-11-21 19:30:03.468932", "msg": "non-zero return code", "rc": 255, "start": "2024-11-21 19:28:48.462226", "stderr": "ssh: connect to host int.ern.al.ip port 22: Operation timed out", "stderr_lines": ["ssh: connect to host int.ern.al.ip port 22: Operation timed out"], "stdout": "", "stdout_lines": []}
Thank you in advance.
So I seem to have been able to solve this issue with the tunnel, but remote debugging is still not working.
I fixed the tunnel by modifying the trellis/roles/xdebug-tunnel/defaults/main.yml
file. I’ve changed these two lines
from this
xdebug_tunnel_ssh_user: "{{ hostvars[xdebug_tunnel_inventory_host]['ansible_user'] | default(admin_user) }}"
xdebug_tunnel_ssh_host: "{{ hostvars[xdebug_tunnel_inventory_host]['ansible_default_ipv4']['address'] | default(xdebug_tunnel_inventory_host) }}"
to this
xdebug_tunnel_ssh_user: "{{ admin_user }}"
xdebug_tunnel_ssh_host: "{{ xdebug_tunnel_inventory_host }}"
which forces it to use the standard admin_user
which is ubuntu
for me and then also forces it to use the hostname as defined in the hosts
files for this environment.
I then run nc -zv localhost 9003 || echo "no tunnel open"
to see if the tunnel is open and it returns Connection to localhost port 9003 [tcp/*] succeeded!
This is all great, however, the debugging is not working
Looking further I noticed that in trellis/roles/xdebug/defaults/main.yml
that the value of xdebug_idekey
was set to XDEBUG
and my browser plugin is expecting vsc
(see post xDebug with VS Code)
After closing and reopening the tunnel, the debugger is still not activated. I also re-provisioned the server to see if for some reason that made a difference but no luck.
Would anyone have some tips or has succeeded in doing this already?
Many thanks in advance.