--- 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: ```bash # Ping every 10 minutes to prevent sleep */10 * * * * curl -s https://YOUR_USERNAME-SPACE_NAME.hf.space/ > /dev/null ``` - Or use UptimeRobot (free): https://uptimerobot.com - Add HTTP monitor - URL: https://YOUR_USERNAME-SPACE_NAME.hf.space/ - Interval: 5 minutes ## 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 ```bash # 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.