summaryrefslogtreecommitdiffstats
path: root/cmd/deploy/main.go
blob: 1589af361439f3cdaaf84514f8c072a8022a6c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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 <command> [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 <command> -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)
}