diff options
Diffstat (limited to 'cmd/deploy/main.go')
| -rw-r--r-- | cmd/deploy/main.go | 82 |
1 files changed, 82 insertions, 0 deletions
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 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "os" | ||
| 6 | ) | ||
| 7 | |||
| 8 | func main() { | ||
| 9 | if len(os.Args) < 2 { | ||
| 10 | printUsage() | ||
| 11 | os.Exit(1) | ||
| 12 | } | ||
| 13 | |||
| 14 | command := os.Args[1] | ||
| 15 | |||
| 16 | switch command { | ||
| 17 | case "init": | ||
| 18 | runInit(os.Args[2:]) | ||
| 19 | case "deploy": | ||
| 20 | runDeploy(os.Args[2:]) | ||
| 21 | case "list": | ||
| 22 | runList(os.Args[2:]) | ||
| 23 | case "remove": | ||
| 24 | runRemove(os.Args[2:]) | ||
| 25 | case "logs": | ||
| 26 | runLogs(os.Args[2:]) | ||
| 27 | case "status": | ||
| 28 | runStatus(os.Args[2:]) | ||
| 29 | case "restart": | ||
| 30 | runRestart(os.Args[2:]) | ||
| 31 | case "env": | ||
| 32 | runEnv(os.Args[2:]) | ||
| 33 | case "webui": | ||
| 34 | runWebUI(os.Args[2:]) | ||
| 35 | case "help", "--help", "-h": | ||
| 36 | printUsage() | ||
| 37 | default: | ||
| 38 | fmt.Fprintf(os.Stderr, "Unknown command: %s\n\n", command) | ||
| 39 | printUsage() | ||
| 40 | os.Exit(1) | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | func printUsage() { | ||
| 45 | usage := `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS | ||
| 46 | |||
| 47 | USAGE: | ||
| 48 | deploy <command> [flags] | ||
| 49 | |||
| 50 | COMMANDS: | ||
| 51 | init Initialize a fresh VPS (one-time setup) | ||
| 52 | deploy Deploy a Go app or static site | ||
| 53 | list List all deployed apps and sites | ||
| 54 | remove Remove a deployment | ||
| 55 | logs View logs for a deployment | ||
| 56 | status Check status of a deployment | ||
| 57 | restart Restart a deployment | ||
| 58 | env Manage environment variables | ||
| 59 | webui Launch web UI to manage deployments | ||
| 60 | |||
| 61 | FLAGS: | ||
| 62 | Run 'deploy <command> -h' for command-specific flags | ||
| 63 | |||
| 64 | EXAMPLES: | ||
| 65 | # Initialize VPS | ||
| 66 | deploy init --host user@vps-ip | ||
| 67 | |||
| 68 | # Deploy Go app | ||
| 69 | deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com | ||
| 70 | |||
| 71 | # Deploy static site | ||
| 72 | deploy deploy --host user@vps-ip --static --dir ./dist --domain example.com | ||
| 73 | |||
| 74 | # List deployments | ||
| 75 | deploy list --host user@vps-ip | ||
| 76 | |||
| 77 | CONFIG FILE: | ||
| 78 | Create ~/.config/deploy/config to set default host: | ||
| 79 | host: user@your-vps-ip | ||
| 80 | ` | ||
| 81 | fmt.Fprint(os.Stderr, usage) | ||
| 82 | } | ||
