SSH Remote Development Setup

Remote Development Server Setup with Frappe MCP Integration

Overview

This guide covers setting up VS Code remote development on SSD nodes with SSH key authentication, plus integration with Frappe MCP for seamless ERPNext development at Hybrowlabs.

Prerequisites

  • VS Code installed on your local machine
  • Remote SSH extension for VS Code
  • SSH access to Hybrowlabs SSD nodes
  • Node.js installed (for Frappe MCP)
  • Access to https://operate.hybrowlabs.com
  • Frappe API credentials

Part 1: SSH Key Authentication Setup

Step 0: Generate SSH Key Pair (if you don't have one)

On Windows (using PowerShell or Git Bash)

# Generate SSH key pair
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

# Press Enter to accept default file location (~/.ssh/id_rsa)
# Enter a secure passphrase when prompted

On macOS/Linux

# Generate SSH key pair
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

# Press Enter to accept default file location (~/.ssh/id_rsa)
# Enter a secure passphrase when prompted

Step 0.1: Copy Public Key to SSD Nodes

Method 1: Using ssh-copy-id (Linux/macOS)

# Copy your public key to the SSD node
ssh-copy-id username@ssd_node_ip_address

# Enter your current password when prompted

Method 2: Manual Copy (All platforms)

# Display your public key
cat ~/.ssh/id_rsa.pub

# Copy the output, then SSH into your SSD node with password
ssh username@ssd_node_ip_address

# On the SSD node, create .ssh directory if it doesn't exist
mkdir -p ~/.ssh
chmod 700 ~/.ssh

# Add your public key to authorized_keys
echo "paste_your_public_key_here" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

# Exit the SSH session
exit

Method 3: Using PowerShell (Windows)

# Read your public key
Get-Content $env:USERPROFILE\.ssh\id_rsa.pub | Set-Clipboard

# SSH into your SSD node
ssh username@ssd_node_ip_address

# Follow the same steps as Method 2 on the remote node

Step 0.2: Test SSH Key Authentication

# Test connection without password
ssh username@ssd_node_ip_address

# You should now connect without entering a password
# (only SSH key passphrase if you set one)

Step 0.3: Disable Password Authentication (Optional - Security Hardening)

# SSH into your SSD node
ssh username@ssd_node_ip_address

# Edit SSH configuration (requires sudo)
sudo nano /etc/ssh/sshd_config

# Find and modify these lines:
# PasswordAuthentication no
# PubkeyAuthentication yes
# AuthorizedKeysFile .ssh/authorized_keys

# Restart SSH service
sudo systemctl restart sshd

# Exit and test connection again
exit
ssh username@ssd_node_ip_address

Step 1: Install Required Extensions

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for "Remote - SSH"
  4. Install the "Remote - SSH" extension by Microsoft

Step 2: Connect to Remote Host

Method 1: Using Remote Explorer

  1. Click the Remote Explorer icon in the Activity Bar (left sidebar)
  2. Click the "+" icon next to "SSH Targets"
  3. Enter your SSH command: ssh username@ip_address
  4. Choose where to save the configuration (usually the first option)

Method 2: Using Command Palette

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  2. Type "Remote-SSH: Connect to Host"
  3. Select "Add New SSH Host"
  4. Enter your SSH command: ssh username@ip_address
  5. Select configuration file location

Step 3: Configure SSH Connection with Key Authentication

  1. After adding the host, VS Code will create/update your SSH config file
  2. Open the config file to customize settings for SSD nodes:
    Host ssd-node-1
        HostName ssd_node_ip_address
        User your_username
        Port 22
        IdentityFile ~/.ssh/id_rsa
        PreferredAuthentications publickey
        PasswordAuthentication no
    
    # Example for multiple SSD nodes
    Host ssd-node-2
        HostName another_ssd_node_ip
        User your_username
        Port 22
        IdentityFile ~/.ssh/id_rsa
        PreferredAuthentications publickey
        PasswordAuthentication no
    
  3. Save the configuration file

SSH Config Options Explained

  • IdentityFile: Path to your private SSH key
  • PreferredAuthentications: Forces public key authentication
  • PasswordAuthentication no: Disables password fallback
  • ServerAliveInterval 60: Keeps connection alive (optional)
  • ServerAliveCountMax 3: Connection timeout settings (optional)

Step 4: Connect to the Remote Server

  1. In Remote Explorer, find your configured host
  2. Click the connection icon next to your host
  3. Choose "Connect to Host in Current Window" or "Connect to Host in New Window"
  4. Enter your password or SSH key passphrase when prompted
  5. Wait for VS Code Server to install on the remote machine

Step 5: Open Remote Directory

  1. Once connected, click "Open Folder" or press Ctrl+K Ctrl+O
  2. Navigate to your desired directory (e.g., /home/username or /var/www)
  3. Click "OK" to open the folder
  4. Trust the workspace when prompted

Step 6: Set Up Your Development Environment

Install Extensions on Remote

  1. Go to Extensions (Ctrl+Shift+X)
  2. Install any needed extensions (they'll install on the remote server)
  3. Common extensions: language support, linters, formatters

Open Terminal

  1. Press Ctrl+Shift+` or go to Terminal → New Terminal
  2. This opens a terminal session on the remote machine
  3. Install any required tools (Node.js, Python, etc.)

Step 7: Port Forwarding for Web Development

Forward Ports Automatically

  1. Go to the "Ports" tab in the terminal panel
  2. Click "Forward a Port"
  3. Enter the port number (e.g., 3000 for Express apps)
  4. VS Code will automatically forward remote port to localhost

Access Your Application

  • Open browser and go to localhost:port_number
  • Your remote application will be accessible locally

Step 8: Development Workflow

File Operations

  • Edit files directly in VS Code
  • Changes are saved to the remote server
  • Use Git normally (if installed on remote)

Running Applications

# Example: Start a Node.js application
npm install
npm start

# Example: Start a Python application
python app.py

# Example: Start with process manager
pm2 start app.js

Debugging

  1. Set breakpoints in your code
  2. Go to Run and Debug (Ctrl+Shift+D)
  3. Configure launch.json if needed
  4. Start debugging - works exactly like local debugging

Step 9: Advanced Configuration

Create Tasks (Optional)

  1. Create .vscode/tasks.json in your project:
    {
      "version": "2.0.0",
      "tasks": [
        {
          "label": "start-app",
          "type": "shell",
          "command": "npm start",
          "group": "build"
        }
      ]
    }
    

Install Task Extensions

  • Search for "Tasks" extensions to add task buttons to status bar
  • Install on remote server for easy task management

Troubleshooting SSH Key Issues

Common SSH Key Problems

  1. "Permission denied (publickey)":

    # Check SSH key permissions
    chmod 600 ~/.ssh/id_rsa
    chmod 644 ~/.ssh/id_rsa.pub
    chmod 700 ~/.ssh
    
    # On SSD node, check authorized_keys permissions
    chmod 600 ~/.ssh/authorized_keys
    chmod 700 ~/.ssh
    
  2. SSH agent not running:

    # Start SSH agent (Linux/macOS)
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_rsa
    
    # On Windows (PowerShell)
    Start-Service ssh-agent
    ssh-add $env:USERPROFILE\.ssh\id_rsa
    
  3. Wrong key format:

    # Convert OpenSSH key to PEM format if needed
    ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
    
  4. Multiple keys:

    # Test specific key
    ssh -i ~/.ssh/id_rsa username@ssd_node_ip
    
    # Add specific key to SSH agent
    ssh-add ~/.ssh/specific_key
    

SSD Node Specific Considerations

  • High-performance storage: Take advantage of fast I/O for large file operations
  • Resource monitoring: Use htop, iotop to monitor node performance
  • Concurrent connections: SSD nodes often support multiple simultaneous connections
  • Backup considerations: Ensure your SSH keys are backed up securely

SSH Key Management for Multiple SSD Nodes

# Create node-specific keys (optional)
ssh-keygen -t rsa -b 4096 -f ~/.ssh/ssd_node_key -C "ssd-nodes-access"

# Add to SSH config for specific nodes
Host ssd-cluster-*
    IdentityFile ~/.ssh/ssd_node_key
    User cluster_user
    Port 22

Security Best Practices for SSD Nodes

  1. Use strong SSH keys: Minimum 4096-bit RSA or Ed25519 keys

    # Generate Ed25519 key (more secure, faster)
    ssh-keygen -t ed25519 -C "your_email@example.com"
    
  2. Protect your private keys:

    # Set strict permissions
    chmod 600 ~/.ssh/id_rsa
    chmod 600 ~/.ssh/id_ed25519
    
    # Use strong passphrases
    ssh-keygen -p -f ~/.ssh/id_rsa  # Change passphrase
    
  3. SSH Hardening on SSD Nodes:

    # Edit /etc/ssh/sshd_config on the SSD node
    sudo nano /etc/ssh/sshd_config
    
    # Recommended settings:
    # Port 2222                    # Use non-standard port
    # PermitRootLogin no          # Disable root login
    # MaxAuthTries 3              # Limit authentication attempts
    # ClientAliveInterval 300     # Timeout idle connections
    # ClientAliveCountMax 2       # Maximum timeouts
    # AllowUsers your_username    # Restrict allowed users
    
  4. Use SSH config with security options:

    Host ssd-nodes-*
        HostName %h.your-domain.com
        User your_username
        Port 2222
        IdentityFile ~/.ssh/ssd_node_key
        PreferredAuthentications publickey
        PasswordAuthentication no
        HashKnownHosts yes
        VisualHostKey yes
        ServerAliveInterval 60
        ServerAliveCountMax 3
    
  5. Key rotation: Regularly rotate SSH keys (quarterly/annually)

  6. Monitor access: Use tools like last, who, w to monitor connections
  7. Backup keys securely: Store backup copies in encrypted storage

Next Steps

For Hybrowlabs Development Team:

  1. Set up your development environment following this guide
  2. Configure Frappe MCP for operate.hybrowlabs.com integration
  3. Test ERPNext development workflow with remote debugging
  4. Set up automated deployment for your custom apps
  5. Configure team collaboration through shared SSD node access

Additional Resources:

Discard
Save
This page has been updated since your last edit. Your draft may contain outdated content. Load Latest Version

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on