wa / README.md
swefse's picture
Upload 5 files
e195154 verified
|
Raw History Blame Contribute Delete
2.36 kB
metadata
title: SSH Tunnel Service
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false

🌐 SSH Tunnel Service - Hugging Face Space

24/7 SSH tunnel service using Pinggy with automatic WebSocket registration.

Features

  • βœ… Persistent SSH tunnel via Pinggy
  • βœ… Auto-reconnect on failure
  • βœ… WebSocket registration to control server
  • βœ… Real-time status monitoring
  • βœ… 7/24 uptime (Hugging Face keeps Space alive)

Setup

  1. Create a new Space on Hugging Face
  2. Select "Docker" as SDK
  3. IMPORTANT: Space must be PUBLIC (Private spaces sleep after 48h)
  4. Upload these files:
    • Dockerfile
    • app.py
    • requirements.txt
    • README.md (this file)
  5. Space will auto-deploy

πŸ”₯ KEEP SPACE ALIVE 24/7 (Choose one):

Option 1: Upgrade to Persistent Hardware (Recommended)

  • Go to Space Settings β†’ Hardware
  • Select "CPU persistent" or higher ($0.60/day)
  • Space NEVER sleeps, guaranteed 24/7 uptime

Option 2: Free Tier + External Ping (No cost)

  • Space must be PUBLIC
  • Add this cron job to ANY server:
# Ping every 10 minutes to prevent sleep
*/10 * * * * curl -s https://YOUR_USERNAME-SPACE_NAME.hf.space/ > /dev/null

Usage

Once deployed, the Space will:

  1. Start SSH tunnel via Pinggy
  2. Extract tunnel URL
  3. Register to WebSocket server
  4. Keep tunnel alive 24/7

Connection

SSH credentials will be displayed in the Space UI and sent to your WebSocket server.

Default credentials:

  • User: root
  • Pass: HuggingFace2024!
  • Host: Dynamically assigned by Pinggy

Architecture

  • Docker: Custom environment with SSH client
  • Gradio: Simple UI for status monitoring
  • Background Worker: Maintains tunnel and registration
  • Auto-refresh: UI updates every 30 seconds

Notes

  • Free tier: 16GB RAM, 8 CPU (sleeps after 48h inactivity)
  • Persistent tier: $0.60/day (NEVER sleeps)
  • Space MUST be PUBLIC for free tier
  • Auto-restarts on crash
  • Tunnel refreshes every 30 minutes
  • Private repos don't affect Space (Space itself must be public)

Deployment

# Clone this repo to your Hugging Face Space
# Or manually upload files via web UI

Developed for 24/7 SSH tunnel access via Hugging Face Spaces.