+
Skip to content

stupside/moley

Repository files navigation

Moley Logo

Latest Release Go Reference Homebrew License Build Status

Moley

Turn localhost into production URLs with one command.

Cloudflare Tunnels are free, unlimited, and enterprise-grade but the manual setup (YAML editing, DNS commands for each subdomain and manual cleanup) is so tedious that developers turn to paid alternatives just to avoid the friction.

Moley automates everything so you get all the Cloudflare benefits on your custom domain without the manual work.

What Moley Does

Without Moley (manual cloudflared setup)

# 1. Authenticate with Cloudflare
cloudflared tunnel login

# 2. Create tunnel manually
cloudflared tunnel create my-tunnel

# 3. Configure tunnel YAML file with ingress rules
vim ~/.cloudflared/config.yml
# (figure out tunnel ID, credentials path, hostnames, services, catch-all rule...)

# 4. Route DNS via CLI for each subdomain
cloudflared tunnel route dns my-tunnel api.example.com
cloudflared tunnel route dns my-tunnel app.example.com
# (repeat for every subdomain... wait for DNS propagation...)

# 5. Run tunnel
cloudflared tunnel run my-tunnel

# 6. Manually delete tunnel and DNS records from dashboard when done
# (or forget and accumulate zombie tunnels...)

With Moley

moley tunnel run

That's it. Moley handles everything automatically:

  • Authenticates with Cloudflare API
  • Creates tunnels programmatically
  • Generates config with ingress rules (no YAML editing)
  • Creates DNS records for all subdomains (no CLI gymnastics)
  • Runs tunnel in foreground or background (--detach)
  • Cleans up tunnels and DNS when stopping (no zombie tunnels)

One command. Multiple apps. Zero manual configuration.

📦 Installation

Homebrew (Recommended)

brew install --cask stupside/tap/moley

Go Install

go install github.com/stupside/moley@latest

Manual Download

Download the latest binary from the releases page.

🚀 Quick Start

  1. Authentication

    # Authenticate cloudflared with your account
    cloudflared tunnel login
    
    # Option 1: Set API token in config file
    moley config set --cloudflare.token="your-api-token"
    
    # Option 2: Use environment variable (recommended for CI/CD)
    export MOLEY_CLOUDFLARE_TOKEN="your-api-token"
  2. Initialize your project

    moley tunnel init
  3. Configure your apps

    # Option 1: Edit the generated moley.yml file
    # Option 2: Use environment variables (great for containers/CI)
    export MOLEY_TUNNEL_INGRESS_ZONE="yourdomain.com"
    export MOLEY_TUNNEL_INGRESS_APPS_0_TARGET_PORT="8080"
    export MOLEY_TUNNEL_INGRESS_APPS_0_EXPOSE_SUBDOMAIN="api"
  4. Start tunneling

    # Foreground mode
    moley tunnel run
    
    # Background mode
    moley tunnel run --detach
    
    # Or run with everything configured via environment variables
    MOLEY_CLOUDFLARE_TOKEN="token" MOLEY_TUNNEL_INGRESS_ZONE="yourdomain.com" moley tunnel run

Your app is now accessible at https://api.yourdomain.com! 🎉

💡 Pro tip: Environment variables take precedence over config files and are perfect for CI/CD, Docker containers, and keeping secrets secure.

📚 Documentation

For complete documentation including configuration options, troubleshooting, and advanced usage, visit our documentation site.

Quick Links

🛠️ Development

Prerequisites

Building from Source

git clone https://github.com/stupside/moley.git
cd moley
go mod download
go build -o moley .

Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载