Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Remote Application Debugging via SSH Port Forwarding #10

Open
butschster opened this issue Sep 9, 2021 · 2 comments
Open
Assignees
Labels
c: difficult documentation Improvements or additions to documentation enhancement New feature or request module [Core]
Milestone

Comments

@butschster
Copy link
Member

butschster commented Sep 9, 2021

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 butschster self-assigned this Sep 9, 2021
@butschster
Copy link
Member Author

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

@butschster butschster added the enhancement New feature or request label Apr 7, 2022
@butschster butschster transferred this issue from buggregator/laravel-app Dec 16, 2022
@butschster butschster added documentation Improvements or additions to documentation c: difficult module [Core] labels Aug 7, 2023
@butschster butschster changed the title Create an instruction "SSH port forwarding to a remote server" Support for Remote Application Debugging via SSH Port Forwarding Sep 17, 2023
@butschster
Copy link
Member Author

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:

  • SSH access to the remote server where your application is running.
  • Buggregator installed on your local machine or another server.
  • SSH client installed on the machine where Buggregator is running (OpenSSH for Linux/macOS or PuTTY for Windows).

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:

  • Always ensure the ports you're using (both locally and on the remote server) do not conflict with other services. Adjust port numbers as necessary based on your configuration.
  • Ensure that the SSH server's configuration on the remote machine allows for reverse port forwarding (i.e., GatewayPorts is set to yes or clientspecified in sshd_config).
  • For added security, it's a good practice to use SSH key authentication instead of passwords.

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

@butschster butschster added this to the 1.0 milestone Sep 17, 2023
@butschster butschster pinned this issue Sep 17, 2023
butschster added a commit that referenced this issue Dec 2, 2023
@butschster butschster linked a pull request Dec 2, 2023 that will close this issue
@butschster butschster unpinned this issue Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: difficult documentation Improvements or additions to documentation enhancement New feature or request module [Core]
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant