Back to Docs

Browser-Based IDEs

Run VS Code and Jupyter Lab directly in your browser

Browser-Based IDEs

Access Jupyter Lab, VS Code, and other development tools directly in your browser.

Overview

Instead of using SSH, you can run browser-based development environments on your GPU instance. This guide covers setting up:

  • VS Code (code-server) - Full VS Code in your browser
  • Jupyter Lab - Interactive notebooks with GPU support
  • JupyterHub - Multi-user notebook environment

VS Code in Browser (code-server)

code-server runs VS Code as a web application, giving you the full VS Code experience in your browser.

Installation

# Install code-server (one-liner)
curl -fsSL https://code-server.dev/install.sh | sh

# Or with specific version
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.20.0

Running code-server

# Start code-server on port 8080
code-server --bind-addr 0.0.0.0:8080 --auth none

# Or with password authentication
export PASSWORD="your-secure-password"
code-server --bind-addr 0.0.0.0:8080 --auth password

Running in Background

# Using nohup
nohup code-server --bind-addr 0.0.0.0:8080 --auth none &

# Using screen
screen -dmS code code-server --bind-addr 0.0.0.0:8080 --auth none

# Check if running
ps aux | grep code-server

Expose to Internet

  1. In your GPU card, click Expose Port
  2. Enter port 8080 and name it "VS Code"
  3. Copy the external URL and open in your browser

Jupyter Lab

Jupyter Lab provides an interactive development environment for notebooks, code, and data - with full GPU access for ML workloads.

Installation

# Install Jupyter Lab
pip install jupyterlab

# With ML packages
pip install jupyterlab torch torchvision transformers

Running Jupyter Lab

# Start Jupyter Lab (accessible from any IP)
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root

# With custom token (recommended)
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token='your-token'

# Without authentication (not recommended for production)
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token=''

Running in Background

# Using nohup
nohup jupyter lab --ip=0.0.0.0 --port=8888 --no-browser > jupyter.log 2>&1 &

# Using screen
screen -dmS jupyter jupyter lab --ip=0.0.0.0 --port=8888 --no-browser

Expose to Internet

  1. In your GPU card, click Expose Port
  2. Enter port 8888 and name it "Jupyter"
  3. Copy the external URL
  4. Add your token to the URL: ?token=your-token

GPU Access in Notebooks

Your GPU is automatically available in Jupyter notebooks:

# Check GPU availability
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU: {torch.cuda.get_device_name(0)}")

# Use GPU for training
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)

Recommended Setup

For the best development experience, we recommend this setup:

1. Create a startup script

# Create startup script on persistent storage
cat > /mnt/your-volume/start-ide.sh << 'EOF'
#!/bin/bash

# Kill any existing processes
pkill -f code-server || true
pkill -f jupyter || true
sleep 2

# Start code-server
nohup code-server --bind-addr 0.0.0.0:8080 --auth none > /tmp/code-server.log 2>&1 &
echo "code-server started on port 8080"

# Start Jupyter Lab
nohup jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token='your-token' > /tmp/jupyter.log 2>&1 &
echo "Jupyter Lab started on port 8888"

echo "IDEs ready! Expose ports 8080 and 8888 to access."
EOF
chmod +x /mnt/your-volume/start-ide.sh

2. Run on startup

# Add to your workspace init script
echo '/mnt/your-volume/start-ide.sh' >> /mnt/your-volume/workspace/init.sh

VS Code Extensions

Install extensions for Python/ML development:

# Through code-server CLI
code-server --install-extension ms-python.python
code-server --install-extension ms-toolsai.jupyter
code-server --install-extension GitHub.copilot

# Or through the UI: Extensions panel (Ctrl+Shift+X)

Jupyter Extensions

# Useful Jupyter Lab extensions
pip install jupyterlab-git
pip install jupyterlab-lsp
pip install jupyterlab-code-formatter

# Rebuild JupyterLab to activate extensions
jupyter lab build

Security Considerations

  • Always use authentication - Set a strong password or token
  • Use HTTPS - The exposed service URL includes HTTPS
  • Firewall rules - Services are only accessible via the exposed port
  • Session timeout - Consider using token-based auth with expiry

Troubleshooting

Service not accessible

# Check if service is running
ps aux | grep -E "code-server|jupyter"

# Check logs
tail -f /tmp/code-server.log
tail -f /tmp/jupyter.log

# Verify port is listening
netstat -tlnp | grep -E "8080|8888"

Connection refused

  • Ensure you've exposed the correct port in the dashboard
  • Check that the service is bound to 0.0.0.0 (not 127.0.0.1)
  • Verify the pod is in "Running" status

Jupyter kernel dies

# Check GPU memory
nvidia-smi

# Kill stuck processes
sudo fuser -k 8888/tcp

# Restart Jupyter
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser

Alternative IDEs

  • OpenVSCode Server - Another VS Code web option from GitPod
  • Theia - VS Code-like IDE with more flexibility
  • JupyterHub - Multi-user Jupyter deployment

Need Help?

Contact us at support@packet.ai