summaryrefslogtreecommitdiffstats
path: root/cmd/ship/restart.go
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-17 07:54:26 -0800
committerClawd <ai@clawd.bot>2026-02-17 07:54:26 -0800
commit6b2c04728cd914f27ae62c1df0bf5df24ac9a628 (patch)
tree8a103ac79194a05fae438b0da105589aaa6b78d9 /cmd/ship/restart.go
parent5e5de4ea1aa98f75d470e4a61644d4b9f100c4b0 (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/restart.go')
-rw-r--r--cmd/ship/restart.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/cmd/ship/restart.go b/cmd/ship/restart.go
deleted file mode 100644
index c902adb..0000000
--- a/cmd/ship/restart.go
+++ /dev/null
@@ -1,60 +0,0 @@
1package main
2
3import (
4 "fmt"
5
6 "github.com/bdw/ship/internal/ssh"
7 "github.com/bdw/ship/internal/state"
8 "github.com/spf13/cobra"
9)
10
11var restartCmd = &cobra.Command{
12 Use: "restart <app>",
13 Short: "Restart a deployment",
14 Args: cobra.ExactArgs(1),
15 RunE: runRestart,
16}
17
18func runRestart(cmd *cobra.Command, args []string) error {
19 name := args[0]
20 if err := validateName(name); err != nil {
21 return err
22 }
23
24 st, err := state.Load()
25 if err != nil {
26 return fmt.Errorf("error loading state: %w", err)
27 }
28
29 host := hostFlag
30 if host == "" {
31 host = st.GetDefaultHost()
32 }
33
34 if host == "" {
35 return fmt.Errorf("--host is required")
36 }
37
38 app, err := st.GetApp(host, name)
39 if err != nil {
40 return err
41 }
42
43 if app.Type != "app" && app.Type != "git-app" {
44 return fmt.Errorf("restart is only available for apps, not static sites")
45 }
46
47 client, err := ssh.Connect(host)
48 if err != nil {
49 return fmt.Errorf("error connecting to VPS: %w", err)
50 }
51 defer client.Close()
52
53 fmt.Printf("Restarting %s...\n", name)
54 if _, err := client.RunSudo(fmt.Sprintf("systemctl restart %s", name)); err != nil {
55 return fmt.Errorf("error restarting service: %w", err)
56 }
57
58 fmt.Println("Service restarted successfully")
59 return nil
60}