diff options
| author | bndw <ben@bdw.to> | 2026-02-08 12:32:59 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-08 12:32:59 -0800 |
| commit | a8ad8e934d15d2bf84f942414a89af1d2691adbc (patch) | |
| tree | 82e6765c9d35968b27ac7ee17f5c201a421dc1d3 /cmd/ship/remove.go | |
| parent | af109c04a3edd4dcd4e7b16242052442fb4a3b24 (diff) | |
Add git-centric deployment with Docker builds and vanity imports
New deployment model where projects start with a git remote on the VPS.
Pushing to the remote triggers automatic docker build and deploy via
post-receive hooks. The base domain serves Go vanity imports and git
HTTPS cloning via Caddy + fcgiwrap.
- Add `ship init <name>` command to create bare repos and .ship/ config
- Add `ship deploy <name>` command for manual rebuilds
- Extend `ship host init --base-domain` to set up Docker, git user,
fcgiwrap, sudoers, and vanity import infrastructure
- Add git-app and git-static types alongside existing app and static
- Update remove, status, logs, restart, list, and config-update to
handle new types
Diffstat (limited to 'cmd/ship/remove.go')
| -rw-r--r-- | cmd/ship/remove.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cmd/ship/remove.go b/cmd/ship/remove.go index 922eb8f..8380e87 100644 --- a/cmd/ship/remove.go +++ b/cmd/ship/remove.go | |||
| @@ -46,7 +46,8 @@ func runRemove(cmd *cobra.Command, args []string) error { | |||
| 46 | } | 46 | } |
| 47 | defer client.Close() | 47 | defer client.Close() |
| 48 | 48 | ||
| 49 | if app.Type == "app" { | 49 | switch app.Type { |
| 50 | case "app": | ||
| 50 | fmt.Println("-> Stopping service...") | 51 | fmt.Println("-> Stopping service...") |
| 51 | client.RunSudo(fmt.Sprintf("systemctl stop %s", name)) | 52 | client.RunSudo(fmt.Sprintf("systemctl stop %s", name)) |
| 52 | client.RunSudo(fmt.Sprintf("systemctl disable %s", name)) | 53 | client.RunSudo(fmt.Sprintf("systemctl disable %s", name)) |
| @@ -58,7 +59,29 @@ func runRemove(cmd *cobra.Command, args []string) error { | |||
| 58 | client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) | 59 | client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) |
| 59 | client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) | 60 | client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) |
| 60 | client.RunSudo(fmt.Sprintf("userdel %s", name)) | 61 | client.RunSudo(fmt.Sprintf("userdel %s", name)) |
| 61 | } else { | 62 | |
| 63 | case "git-app": | ||
| 64 | fmt.Println("-> Stopping service...") | ||
| 65 | client.RunSudo(fmt.Sprintf("systemctl stop %s", name)) | ||
| 66 | client.RunSudo(fmt.Sprintf("systemctl disable %s", name)) | ||
| 67 | |||
| 68 | client.RunSudo(fmt.Sprintf("rm -f /etc/systemd/system/%s.service", name)) | ||
| 69 | client.RunSudo("systemctl daemon-reload") | ||
| 70 | |||
| 71 | fmt.Println("-> Removing Docker image...") | ||
| 72 | client.RunSudo(fmt.Sprintf("docker rmi %s:latest", name)) | ||
| 73 | |||
| 74 | fmt.Println("-> Removing files...") | ||
| 75 | client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) | ||
| 76 | client.RunSudo(fmt.Sprintf("rm -rf /srv/git/%s.git", name)) | ||
| 77 | client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) | ||
| 78 | |||
| 79 | case "git-static": | ||
| 80 | fmt.Println("-> Removing files...") | ||
| 81 | client.RunSudo(fmt.Sprintf("rm -rf /var/www/%s", name)) | ||
| 82 | client.RunSudo(fmt.Sprintf("rm -rf /srv/git/%s.git", name)) | ||
| 83 | |||
| 84 | default: // "static" | ||
| 62 | fmt.Println("-> Removing files...") | 85 | fmt.Println("-> Removing files...") |
| 63 | client.RunSudo(fmt.Sprintf("rm -rf /var/www/%s", name)) | 86 | client.RunSudo(fmt.Sprintf("rm -rf /var/www/%s", name)) |
| 64 | } | 87 | } |
