From 98b9af372025595e8a4255538e2836e019311474 Mon Sep 17 00:00:00 2001 From: bndw Date: Fri, 23 Jan 2026 20:54:46 -0800 Subject: Add deploy command and fix static site naming Static sites now default to using the domain as the name instead of the source directory basename, preventing conflicts when multiple sites use the same directory name (e.g., dist). Also fixes .gitignore to not exclude cmd/deploy/ directory. --- cmd/deploy/main.go | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 cmd/deploy/main.go (limited to 'cmd/deploy/main.go') diff --git a/cmd/deploy/main.go b/cmd/deploy/main.go new file mode 100644 index 0000000..1589af3 --- /dev/null +++ b/cmd/deploy/main.go @@ -0,0 +1,82 @@ +package main + +import ( + "fmt" + "os" +) + +func main() { + if len(os.Args) < 2 { + printUsage() + os.Exit(1) + } + + command := os.Args[1] + + switch command { + case "init": + runInit(os.Args[2:]) + case "deploy": + runDeploy(os.Args[2:]) + case "list": + runList(os.Args[2:]) + case "remove": + runRemove(os.Args[2:]) + case "logs": + runLogs(os.Args[2:]) + case "status": + runStatus(os.Args[2:]) + case "restart": + runRestart(os.Args[2:]) + case "env": + runEnv(os.Args[2:]) + case "webui": + runWebUI(os.Args[2:]) + case "help", "--help", "-h": + printUsage() + default: + fmt.Fprintf(os.Stderr, "Unknown command: %s\n\n", command) + printUsage() + os.Exit(1) + } +} + +func printUsage() { + usage := `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS + +USAGE: + deploy [flags] + +COMMANDS: + init Initialize a fresh VPS (one-time setup) + deploy Deploy a Go app or static site + list List all deployed apps and sites + remove Remove a deployment + logs View logs for a deployment + status Check status of a deployment + restart Restart a deployment + env Manage environment variables + webui Launch web UI to manage deployments + +FLAGS: + Run 'deploy -h' for command-specific flags + +EXAMPLES: + # Initialize VPS + deploy init --host user@vps-ip + + # Deploy Go app + deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com + + # Deploy static site + deploy deploy --host user@vps-ip --static --dir ./dist --domain example.com + + # List deployments + deploy list --host user@vps-ip + +CONFIG FILE: + Create ~/.config/deploy/config to set default host: + host: user@your-vps-ip +` + fmt.Fprint(os.Stderr, usage) +} -- cgit v1.2.3