Skip to main content

Browser-Based Remote Desktop on Morph Cloud

tl;dr Launch full Linux desktop environments in your browser using Morph Cloud's Infinibranch technology. Create, branch, and restore these desktop environments within seconds.

Prerequisites

Install the Morph Cloud SDK

To get started, install the Morph Python SDK:

pip install morphcloud

Set your API key

export MORPH_API_KEY='your-key-here'

You can generate an API key in the Morph Cloud console.

Using the Morph Cloud CLI

The SDK includes a CLI that lets you manage resources from the command line:

# List instances
morphcloud instance list

# Create a snapshot
morphcloud snapshot create --instance-id instance_123

# For more commands and options
morphcloud --help

Quick Start

# Install dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/env
uv venv && source .venv/bin/activate
uv pip install morphcloud

# Set your API key
export MORPH_API_KEY='your-key-here'

# Run the setup script
uv run python remote-desktop_setup.py

The setup script will:

  1. Create or reuse a base MorphVM snapshot
  2. Launch a new instance
  3. Install and configure XFCE desktop with VNC
  4. Set up noVNC for browser access
  5. Expose the service via HTTPS

Once the initial setup is complete, launching new desktop instances takes just seconds, enabling:

  • Instant environment duplication for parallel testing
  • Perfect state preservation via Morph Cloud snapshots
  • Isolated desktop environments for each use case

What You Get

Your remote desktop provides:

  • Full XFCE desktop environment
  • Browser-based access via noVNC
  • Standard Linux GUI applications
  • Built-in terminal access

Beyond Traditional Remote Desktop

Compare the experience:

Traditional RDPMorph Cloud Desktop
Software installation requiredBrowser-based access
Single sessionMultiple parallel sessions
Minutes to start each timeSubsequent startups in seconds
Resource-heavy copiesNear-zero overhead branching

Real-World Applications

Cross-Browser Testing Matrix

# Test your web app across multiple browser configurations simultaneously
from morphcloud.api import MorphCloudClient
import time

client = MorphCloudClient()
snapshot_id = "your-desktop-snapshot-id"

# Define various browser configurations to test
browser_configs = [
{"name": "Firefox Latest", "install": "sudo apt install -y firefox", "launch": "firefox"},
{"name": "Chrome Latest", "install": "wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo apt install -y ./google-chrome-stable_current_amd64.deb", "launch": "google-chrome-stable"},
{"name": "Firefox ESR", "install": "sudo apt install -y firefox-esr", "launch": "firefox-esr"},
{"name": "Chromium", "install": "sudo apt install -y chromium-browser", "launch": "chromium-browser"}
]

# Your web application URL to test
test_url = "https://your-application-url.com"

# Create a desktop environment for each browser configuration
test_environments = []
for config in browser_configs:
# Launch a new desktop environment in seconds
instance = client.instances.start(snapshot_id)

# Install the specific browser
print(f"Setting up {config['name']}...")
instance.exec("sudo apt update")
instance.exec(config["install"])

# Create a script to launch the browser with the test URL
browser_script = f"""#!/bin/bash
{config['launch']} {test_url} &
"""
instance.exec(f"echo '{browser_script}' > /home/ubuntu/launch_browser.sh")
instance.exec("chmod +x /home/ubuntu/launch_browser.sh")

# Auto-start the browser when the user connects
instance.exec("echo '/home/ubuntu/launch_browser.sh' >> /home/ubuntu/.xinitrc")

# Get the desktop URL
desktop_url = f"{instance.get_service_url('desktop')}/vnc_lite.html"
test_environments.append({"config": config["name"], "url": desktop_url})
print(f"{config['name']} ready at: {desktop_url}")

# Share all testing environments with the QA team
for env in test_environments:
print(f"Test {env['config']} at: {env['url']}")

Automated UI Testing Farm

# Automate UI testing across multiple desktop environments
from morphcloud.api import MorphCloudClient
import time

client = MorphCloudClient()
snapshot_id = "your-desktop-snapshot-id"

# Define test configurations (OS customization is just for this example;
# in a real scenario you'd use different snapshot IDs for different OS bases)
test_configs = [
{"name": "Default Theme", "customization": ""},
{"name": "High Contrast", "customization": """
xfconf-query -c xsettings -p /Gtk/FontName -s "Sans 12"
xfconf-query -c xfwm4 -p /general/theme -s "Default-hdpi"
xfconf-query -c xsettings -p /Net/ThemeName -s "HighContrast"
"""},
{"name": "Large Fonts", "customization": """
xfconf-query -c xsettings -p /Gtk/FontName -s "Sans 18"
xfconf-query -c xfce4-desktop -p /last/screen0/monitor0/workspace0/color-style -s 0
xfconf-query -c xfce4-desktop -p /last/screen0/monitor0/workspace0/color1 -s "#FFFFFF"
"""}
]

# Create isolated environment for each test configuration
for config in test_configs:
# Launch a new desktop environment in seconds
instance = client.instances.start(snapshot_id)

# Install test automation tools
instance.exec("sudo apt update")
instance.exec("sudo apt install -y python3-pip xvfb")
instance.exec("pip3 install selenium pytest pytest-xvfb")
instance.exec("sudo apt install -y firefox-geckodriver")

# Apply specific desktop customization
if config["customization"]:
print(f"Applying {config['name']} customization...")
instance.exec(f"""
cat > /home/ubuntu/customize.sh << 'EOF'
#!/bin/bash
{config["customization"]}
EOF
""")
instance.exec("chmod +x /home/ubuntu/customize.sh")
instance.exec("DISPLAY=:1 /home/ubuntu/customize.sh")

# Clone test repository and run tests
instance.exec("cd /home/ubuntu && git clone https://github.com/your-org/ui-tests.git")
instance.exec("cd /home/ubuntu/ui-tests && pip3 install -r requirements.txt")

# Start test execution in the background
instance.exec(f"cd /home/ubuntu/ui-tests && nohup python3 -m pytest --html=report-{config['name'].lower().replace(' ', '-')}.html tests/ &")

# Get the desktop URL for manual inspection
desktop_url = f"{instance.get_service_url('desktop')}/vnc_lite.html"
print(f"{config['name']} testing environment: {desktop_url}")

Interactive Product Demo Environments

# Create personalized demo environments for sales prospects
from morphcloud.api import MorphCloudClient
import json

client = MorphCloudClient()
snapshot_id = "your-desktop-snapshot-id"

# Load prospect data (in a real scenario, this might come from your CRM)
prospects = [
{
"name": "Acme Corp",
"industry": "healthcare",
"contact": "jane.doe@acmecorp.example",
"features": ["compliance-dashboard", "patient-records"]
},
{
"name": "Globex Inc",
"industry": "finance",
"contact": "john.smith@globex.example",
"features": ["transaction-analysis", "fraud-detection"]
}
]

# Create a customized demo environment for each prospect
demo_urls = {}
for prospect in prospects:
# Launch a new desktop environment in seconds
instance = client.instances.start(snapshot_id)

# Clone your demo application
instance.exec("cd /home/ubuntu && git clone https://github.com/your-org/product-demo.git")
instance.exec("cd /home/ubuntu/product-demo && npm install")

# Customize configuration for this specific prospect
config = {
"company": prospect["name"],
"industry": prospect["industry"],
"features": prospect["features"],
"branding": {
"logo": f"logos/{prospect['industry']}.png",
"primaryColor": "#336699" if prospect["industry"] == "finance" else "#669933"
}
}

# Save customized configuration
instance.exec(f"""
cat > /home/ubuntu/product-demo/config.json << 'EOF'
{json.dumps(config, indent=2)}
EOF
""")

# Create desktop shortcut to launch the demo
instance.exec("""
cat > /home/ubuntu/Desktop/Launch-Demo.desktop << 'EOF'
[Desktop Entry]
Version=1.0
Type=Application
Name=Launch Product Demo
Comment=Start the personalized product demo
Exec=bash -c "cd /home/ubuntu/product-demo && npm start"
Icon=system-run
Terminal=false
StartupNotify=false
EOF
""")
instance.exec("chmod +x /home/ubuntu/Desktop/Launch-Demo.desktop")

# Get the demo URL
demo_url = f"{instance.get_service_url('desktop')}/vnc_lite.html"
demo_urls[prospect["name"]] = demo_url
print(f"Demo for {prospect['name']} ({prospect['industry']}): {demo_url}")

# Send personalized emails with demo links
for prospect in prospects:
print(f"Sending demo link to {prospect['contact']} for {prospect['name']}: {demo_urls[prospect['name']]}")
# In a real implementation, you would integrate with your email service here

Technical Details

The desktop environment includes:

  • XFCE4 desktop environment
  • TigerVNC server for remote access
  • noVNC for browser-based connectivity
  • Nginx reverse proxy
  • Systemd service management

Getting Started

  1. Run the setup script to create your template:
uv run python remote-desktop_setup.py
  1. Note the snapshot ID from the script output

  2. Launch new instances instantly:

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()
instance = client.instances.start("your-desktop-snapshot-id")
print(f"Desktop URL: {instance.get_service_url('desktop')}/vnc_lite.html")

Each new instance launches in seconds, giving you a fresh desktop environment configured exactly like your template.

Next Steps

  1. Sign up for early access
  2. Run the setup script to create your first environment
  3. Start launching instant desktop environments

Ready to transform your remote desktop workflow? Get early access today.

Resources