Skip to content

javimosch/hotify-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hotify CLI

Traefik/Cloudflare app management CLI for quick deployment of web apps with automatic SSL and DNS setup.

Overview

Hotify is an opinionated CLI+UI tool that simplifies deploying web apps behind Traefik with Cloudflare DNS and Let's Encrypt SSL certificates. It assumes apps follow the boilerplate-cli-ui-go pattern: a binary with daemon start/stop that exposes an HTTP server on a port.

Features

  • CLI Commands: Add, edit, remove, and list apps
  • Web UI: Browser-based app management
  • DNS Setup: Automatic Cloudflare DNS record creation
  • SSL Certificates: Automatic Let's Encrypt certificates via Traefik
  • Traefik Integration: Automatic Traefik configuration updates
  • Daemon Mode: Background service for persistent management

Installation

From Source

cd /home/jarancibia/ai/hotify-cli
chmod +x build.sh
./build.sh
sudo cp hotify-cli /usr/local/bin/

Usage

hotify-cli --help

Configuration

Initialize Configuration

hotify-cli init

You'll be prompted for:

  • Cloudflare API token (legacy format recommended)
  • Base domain (e.g., example.com)
  • Admin email for Let's Encrypt

CLI Commands

Add an App

hotify-cli add \
  --id myapp \
  --name "My App" \
  --domain myapp \
  --port 3000 \
  --command "/path/to/myapp start" \
  --source "github.com/user/repo"

Edit an App

hotify-cli edit --id myapp --name "Updated Name"

Remove an App

hotify-cli remove --id myapp

List Apps

hotify-cli list

Start Web UI

# Foreground
hotify-cli start --port 8080

# Background (daemon)
hotify-cli start --daemon

Check Daemon Status

hotify-cli status

Stop Daemon

hotify-cli stop

Web UI

Start the daemon and access the web UI:

hotify-cli start --daemon
# Access at http://localhost:8080

The web UI provides:

  • Configuration overview
  • App management (add/edit/remove)
  • One-click DNS setup
  • One-click Traefik configuration
  • Real-time status updates

DNS Setup

After adding an app, set up the DNS record:

hotify-cli setup-dns --id myapp --ip 92.113.145.178

This creates an A record in Cloudflare pointing to your server IP.

Traefik Setup

Configure Traefik for your app:

hotify-cli setup-traefik --id myapp

This:

  • Creates/updates /etc/traefik/traefik.yml
  • Creates/updates /etc/traefik/dynamic.yml
  • Sets up Cloudflare environment variables
  • Configures systemd service
  • Restarts Traefik

App Requirements

Apps must follow this pattern:

  1. Binary: Single executable file
  2. Daemon Mode: Support start/stop commands
  3. HTTP Server: Expose HTTP on a specific port
  4. No SSL: Let Traefik handle SSL/TLS

Example app structure:

myapp start --port 3000  # Starts HTTP server on port 3000
myapp stop               # Stops the daemon

Configuration File

Configuration is stored at ~/.hotify/config.json:

{
  "cloudflare_token": "your_token",
  "domain": "example.com",
  "admin_email": "admin@example.com",
  "apps": [
    {
      "id": "myapp",
      "name": "My App",
      "domain": "myapp.example.com",
      "port": 3000,
      "command": "/path/to/myapp start",
      "source": "github.com/user/repo",
      "status": "stopped"
    }
  ]
}

Architecture

File Structure

  • main.go - CLI command handling
  • config.go - Configuration management
  • daemon.go - Daemon process management
  • server.go - HTTP server and web UI
  • cloudflare.go - Cloudflare API integration
  • traefik.go - Traefik configuration management

Traefik Integration

Hotify manages:

  • /etc/traefik/traefik.yml - Main Traefik configuration
  • /etc/traefik/dynamic.yml - Dynamic routing configuration
  • /etc/traefik/cloudflare.env - Cloudflare credentials
  • /etc/traefik/acme.json - SSL certificate storage
  • /etc/systemd/system/traefik.service - Systemd service

DNS Integration

Hotify uses Cloudflare API to:

  • Get zone ID for domain
  • Create A records for app subdomains
  • Configure DNS-only mode (proxy disabled)

API Endpoints

When the web UI is running, these API endpoints are available:

  • GET / - Web UI
  • GET /api/status - Server status
  • GET /api/health - Health check
  • GET /api/config - Current configuration
  • GET /api/apps - List all apps
  • POST /api/apps/add - Add new app
  • POST /api/apps/edit - Edit existing app
  • POST /api/apps/remove - Remove app
  • POST /api/apps/setup-dns - Setup DNS for app
  • POST /api/apps/setup-traefik - Setup Traefik for app

Workflow Example

Deploy a New App

  1. Initialize hotify (first time only):

    hotify-cli init
  2. Add the app:

    hotify-cli add \
      --id myapp \
      --name "My App" \
      --domain myapp \
      --port 3000 \
      --command "/home/user/myapp start" \
      --source "github.com/user/myapp"
  3. Deploy the app binary to the server

  4. Setup DNS:

    hotify-cli setup-dns --id myapp --ip 92.113.145.178
  5. Setup Traefik:

    hotify-cli setup-traefik --id myapp
  6. Access the app at https://myapp.example.com

Using Web UI

  1. Start the daemon:

    hotify-cli start --daemon
  2. Open http://localhost:8080

  3. Use the web interface to:

    • View configuration
    • Add/edit/remove apps
    • Setup DNS with one click
    • Setup Traefik with one click

Requirements

  • Go 1.21+ (for building)
  • Linux server with systemd
  • Cloudflare account with domain
  • Traefik installed on server
  • Server with public IP

Troubleshooting

Daemon Issues

# Check status
hotify-cli status

# View logs
cat /tmp/hotify-cli.log

# Restart daemon
hotify-cli stop
hotify-cli start --daemon

Traefik Issues

# Check Traefik status
sudo systemctl status traefik

# View Traefik logs
sudo journalctl -u traefik -f

# Restart Traefik
sudo systemctl restart traefik

DNS Issues

  • Verify Cloudflare token has DNS edit permissions
  • Check that domain is managed in Cloudflare
  • Ensure server IP is correct
  • Check Cloudflare dashboard for DNS records

SSL Issues

  • Verify admin email is correct
  • Check Traefik logs for ACME errors
  • Ensure DNS record is propagated
  • Check Let's Encrypt rate limits

Security Considerations

  • Cloudflare token is stored in plaintext config file
  • Set appropriate file permissions on ~/.hotify/config.json
  • Use API tokens with minimal required permissions
  • Consider using environment variables for sensitive data
  • Regularly rotate Cloudflare tokens

Limitations

  • Assumes specific app architecture (binary + HTTP server)
  • Requires Traefik to be installed separately
  • Only supports Cloudflare DNS provider
  • No built-in app deployment (binary management)
  • No automatic app process management
  • Single server deployment only

Future Enhancements

  • Support for multiple DNS providers
  • Built-in app deployment (git pull, build, install)
  • App process management (start/stop/restart)
  • Multi-server support
  • SSL certificate monitoring
  • Health check integration
  • Rollback capabilities
  • Configuration backup/restore

License

MIT

Contributing

Contributions welcome! Please read the contributing guidelines first.

Support

For issues and questions:

  • GitHub Issues: [repository URL]
  • Documentation: [docs URL]

About

Traefik/Cloudflare app management CLI with agent-friendly JSON output

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors