summaryrefslogtreecommitdiffstats
path: root/cmd/deploy/main.go
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-01-23 20:54:46 -0800
committerbndw <ben@bdw.to>2026-01-23 20:54:46 -0800
commit98b9af372025595e8a4255538e2836e019311474 (patch)
tree0a26fa5a8a19ea8565da6d63e1f19c21fc170d12 /cmd/deploy/main.go
parent7fcb9dfa87310e91b527829ece9989decb6fda64 (diff)
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.
Diffstat (limited to 'cmd/deploy/main.go')
-rw-r--r--cmd/deploy/main.go82
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 @@
1package main
2
3import (
4 "fmt"
5 "os"
6)
7
8func 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
44func printUsage() {
45 usage := `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS
46
47USAGE:
48 deploy <command> [flags]
49
50COMMANDS:
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
61FLAGS:
62 Run 'deploy <command> -h' for command-specific flags
63
64EXAMPLES:
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
77CONFIG FILE:
78 Create ~/.config/deploy/config to set default host:
79 host: user@your-vps-ip
80`
81 fmt.Fprint(os.Stderr, usage)
82}