buggregator / server

Buggregator is a lightweight, standalone server that offers a range of debugging features for PHP applications.
https://buggregator.dev/
Other
702 stars 26 forks source link

Support for Remote Application Debugging via SSH Port Forwarding #10

Open butschster opened 3 years ago

butschster commented 3 years ago

While Buggregator provides excellent support for debugging local PHP applications, there is currently no native support for debugging remote applications. This limitation requires developers to rely on alternative solutions, or possibly bypass Buggregator altogether when working with remote environments.

I propose adding support for SSH port forwarding in Buggregator. This would allow developers to establish an SSH tunnel from their local machine to a remote server, effectively mapping a local port to a port on the remote server. This would facilitate real-time debugging of applications deployed on remote environments as if they were local.

Key Features:

  1. SSH Connection Management: An interface within Buggregator to save, manage, and quickly connect to remote servers using SSH credentials.
  2. Real-time Debugging: Seamless integration of the debugging process, whether the application is local or remote.
  3. Intuitive UI/UX: A straightforward UI to set up and manage remote debugging sessions without the need for external tools or complicated command lines.

Information can get from here https://www.ssh.com/academy/ssh/tunneling/example

butschster commented 2 years ago

RoadRunner v2.9 + https://github.com/spiral/roadrunner-services will solve the issue!

butschster commented 1 year ago

Instruction

Setting up an SSH tunnel for Buggregator to connect with a remote application involves creating a secure connection between a local port and a port on the remote server. Here's how you can set it up:

Requirements:

Reverse Port Forwarding with OpenSSH

  1. Open a Terminal
  2. Establish an SSH Tunnel: Use the following command to set up reverse port forwarding. This command tells the remote server to forward its ports to ports on your local machine.
ssh -R 8000:localhost:8000 -R 9912:localhost:9912 -R 9913:localhost:9913 -R 1025:localhost:1025 username@remote_server_ip

For each port you want to forward from the remote machine to your local machine, use the -R option. Assuming you're receiving logs on the same ports on the local machine:

  1. Start Buggregator: If not already running, start Buggregator on your local machine. Ensure Buggregator is configured to listen on ports 8000, 9912, 9913, and 1025
  2. Send Logs from the Remote Application: Your remote application should be configured to send logs to its own ports (e.g., 8000, 9912, 9913, 1025). These logs will then be automatically directed through the SSH tunnel to your local Buggregator instance.
  3. Maintain the Connection: Keep the SSH terminal session running to maintain the reverse port forwarding. If you close the terminal or the SSH connection terminates, you'll need to re-establish the connection.

Note:


With this setup, your Buggregator instance should now be able to receive logs from the remote application securely over the SSH tunnel.