diff options
| author | Clawd <ai@clawd.bot> | 2026-02-17 07:54:26 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-17 07:54:26 -0800 |
| commit | 6b2c04728cd914f27ae62c1df0bf5df24ac9a628 (patch) | |
| tree | 8a103ac79194a05fae438b0da105589aaa6b78d9 /cmd/ship/root.go | |
| parent | 5e5de4ea1aa98f75d470e4a61644d4b9f100c4b0 (diff) | |
Remove v1 code, simplify state to just base_domain
- Delete all v1 commands (deploy, init, list, status, remove, etc.)
- Delete v1 env/ and host/ subcommand directories
- Simplify state.go: remove NextPort, Apps, AllocatePort, etc.
- Local state now only tracks default_host + base_domain per host
- Ports and deploys are tracked on the server (/etc/ship/ports/)
- host init now creates minimal state.json
Diffstat (limited to 'cmd/ship/root.go')
| -rw-r--r-- | cmd/ship/root.go | 97 |
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 @@ | |||
| 1 | package main | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "github.com/bdw/ship/cmd/ship/env" | ||
| 5 | "github.com/bdw/ship/cmd/ship/host" | ||
| 6 | "github.com/spf13/cobra" | ||
| 7 | ) | ||
| 8 | |||
| 9 | var ( | ||
| 10 | // Persistent flags | ||
| 11 | hostFlag string | ||
| 12 | |||
| 13 | // Version info (set via ldflags) | ||
| 14 | version = "dev" | ||
| 15 | commit = "none" | ||
| 16 | date = "unknown" | ||
| 17 | ) | ||
| 18 | |||
| 19 | const banner = ` | ||
| 20 | ~ | ||
| 21 | ___|___ | ||
| 22 | | _ | | ||
| 23 | _|__|_|__|_ | ||
| 24 | | SHIP | Ship apps to your VPS | ||
| 25 | \_________/ with automatic HTTPS | ||
| 26 | ~~~~~~~~~ | ||
| 27 | ` | ||
| 28 | |||
| 29 | var rootCmd = &cobra.Command{ | ||
| 30 | Use: "ship", | ||
| 31 | Short: "Ship apps and static sites to a VPS with automatic HTTPS", | ||
| 32 | Long: banner + ` | ||
| 33 | A CLI tool for deploying applications and static sites to a VPS. | ||
| 34 | |||
| 35 | How 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 | |||
| 41 | Requirements: | ||
| 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 | |||
| 46 | Examples: | ||
| 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 | |||
| 67 | func 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 | } | ||
