Skip to content

Conversation

@edenreich
Copy link
Contributor

Adds SSH-based remote terminal access to the web chat interface. Users can now connect to remote servers via SSH, with auto-installation of the infer binary. Includes a Docker Compose example demonstrating both local and remote modes.

Summary of Changes

This PR enables users to:

  1. Connect to remote servers via SSH from the web terminal
  2. Auto-install infer binary on remote servers when missing
  3. Switch between local and remote servers via a dropdown
  4. Use portable Linux binaries (CGO-free) for better compatibility
  5. Test with a complete Docker Compose example

Key Features

SSH Remote Mode

  • Added ability to connect to remote servers via SSH from the web terminal
  • Secure authentication with SSH keys or passwords
  • Persistent connections with session management

Auto-installation

  • Automatically installs infer binary on remote servers if missing
  • Supports multiple architectures and operating systems
  • Fallback mechanisms for installation failures

Web Terminal Enhancements

  • Added server selection dropdown in the web interface
  • Support for multiple concurrent server connections
  • Improved error handling and user feedback

Portable Linux Builds

  • Changed Linux builds to use CGO_ENABLED=0 for maximum compatibility
  • Statically linked binaries that work on any Linux distribution
  • Reduced dependency requirements on target systems

Docker Compose Example

  • Complete example with local + remote Ubuntu server setup
  • Environment configuration templates
  • Step-by-step documentation in README.md

Technical Details

New Files:

  • internal/web/ssh_client.go - SSH client implementation
  • internal/web/ssh_session.go - SSH session management
  • internal/web/remote_installer.go - Remote binary installation
  • examples/web-terminal/ - Complete example setup

Modified Files:

  • cmd/chat.go - Added SSH mode flag and configuration
  • internal/web/server.go - Enhanced web server with SSH support
  • internal/web/session_manager.go - Multi-server session management
  • internal/web/static/app.js - Frontend server selection UI
  • internal/web/templates/index.html - Updated HTML template
  • Build configuration updates for portable binaries

Testing

The included Docker Compose example provides a complete test environment:

  • Local infer instance for direct testing
  • Remote Ubuntu server for SSH testing
  • Pre-configured environment variables
  • Step-by-step setup instructions

Compatibility

  • Backward compatible with existing local mode
  • Works with any SSH-compatible server (Linux, macOS, BSD)
  • Supports both password and key-based authentication
  • Portable binaries work on glibc and musl-based systems

@edenreich
Copy link
Contributor Author

TODOs

  • Create an rc and verify the auto_install works as expected
  • Finalize the example using docker
  • Provide another example how to control agents using kubernetes and pods from the web interface
  • Make the UX a bit nicer - I don't like that the fact that there is always a first session as I enter the web interface, also I think it should be clearer each tab to what server it's running on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants