summaryrefslogtreecommitdiffstats
path: root/cmd/ship/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ship/root.go')
-rw-r--r--cmd/ship/root.go97
1 files changed, 0 insertions, 97 deletions
diff --git a/cmd/ship/root.go b/cmd/ship/root.go
deleted file mode 100644
index 93280f5..0000000
--- a/cmd/ship/root.go
+++ /dev/null
@@ -1,97 +0,0 @@
1package main
2
3import (
4 "github.com/bdw/ship/cmd/ship/env"
5 "github.com/bdw/ship/cmd/ship/host"
6 "github.com/spf13/cobra"
7)
8
9var (
10 // Persistent flags
11 hostFlag string
12
13 // Version info (set via ldflags)
14 version = "dev"
15 commit = "none"
16 date = "unknown"
17)
18
19const banner = `
20 ~
21 ___|___
22 | _ |
23 _|__|_|__|_
24 | SHIP | Ship apps to your VPS
25 \_________/ with automatic HTTPS
26 ~~~~~~~~~
27`
28
29var rootCmd = &cobra.Command{
30 Use: "ship",
31 Short: "Ship apps and static sites to a VPS with automatic HTTPS",
32 Long: banner + `
33A CLI tool for deploying applications and static sites to a VPS.
34
35How it works:
36 Ship uses only SSH to deploy - no agents, containers, or external services.
37 It uploads your binary or static website, creates a systemd service, and configures Caddy
38 for automatic HTTPS. Ports are assigned automatically. Your app runs directly on the VPS
39 with minimal overhead.
40
41Requirements:
42 • A VPS with SSH access (use 'ship host init' to set up a new server)
43 • An SSH config entry or user@host for your server
44 • A domain pointing to your VPS
45
46Examples:
47 # Deploy a Go binary
48 ship --binary ./myapp --domain api.example.com
49
50 # Deploy with auto-generated subdomain (requires base domain)
51 ship --binary ./myapp --name myapp
52
53 # Deploy a static site
54 ship --static --dir ./dist --domain example.com
55
56 # Update config without redeploying binary
57 ship --name myapp --memory 512M --cpu 50%
58 ship --name myapp --env DEBUG=true
59
60 # Set up a new VPS with base domain
61 ship host init --host user@vps --base-domain apps.example.com`,
62 RunE: runDeploy,
63 SilenceUsage: true,
64 SilenceErrors: true,
65}
66
67func init() {
68 // Persistent flags available to all subcommands
69 rootCmd.PersistentFlags().StringVar(&hostFlag, "host", "", "VPS host (SSH config alias or user@host)")
70
71 // Root command (deploy) flags
72 rootCmd.Flags().String("binary", "", "Path to Go binary (for app deployment)")
73 rootCmd.Flags().Bool("static", false, "Deploy as static site")
74 rootCmd.Flags().String("dir", ".", "Directory to deploy (for static sites)")
75 rootCmd.Flags().String("domain", "", "Custom domain (optional if base domain configured)")
76 rootCmd.Flags().String("name", "", "App name (default: inferred from binary or directory)")
77 rootCmd.Flags().Int("port", 0, "Port override (default: auto-allocate)")
78 rootCmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE, can be specified multiple times)")
79 rootCmd.Flags().String("env-file", "", "Path to .env file")
80 rootCmd.Flags().String("args", "", "Arguments to pass to binary")
81 rootCmd.Flags().StringArray("file", nil, "Config file to upload to working directory (can be specified multiple times)")
82 rootCmd.Flags().String("memory", "", "Memory limit (e.g., 512M, 1G)")
83 rootCmd.Flags().String("cpu", "", "CPU limit (e.g., 50%, 200% for 2 cores)")
84
85 // Add subcommands
86 rootCmd.AddCommand(listCmd)
87 rootCmd.AddCommand(logsCmd)
88 rootCmd.AddCommand(statusCmd)
89 rootCmd.AddCommand(restartCmd)
90 rootCmd.AddCommand(removeCmd)
91 rootCmd.AddCommand(initCmd)
92 rootCmd.AddCommand(deployGitCmd)
93 rootCmd.AddCommand(env.Cmd)
94 rootCmd.AddCommand(host.Cmd)
95 rootCmd.AddCommand(uiCmd)
96 rootCmd.AddCommand(versionCmd)
97}