From a8ad8e934d15d2bf84f942414a89af1d2691adbc Mon Sep 17 00:00:00 2001 From: bndw Date: Sun, 8 Feb 2026 12:32:59 -0800 Subject: 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 ` command to create bare repos and .ship/ config - Add `ship deploy ` 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 --- cmd/ship/remove.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'cmd/ship/remove.go') 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 { } defer client.Close() - if app.Type == "app" { + switch app.Type { + case "app": fmt.Println("-> Stopping service...") client.RunSudo(fmt.Sprintf("systemctl stop %s", name)) client.RunSudo(fmt.Sprintf("systemctl disable %s", name)) @@ -58,7 +59,29 @@ func runRemove(cmd *cobra.Command, args []string) error { client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) client.RunSudo(fmt.Sprintf("userdel %s", name)) - } else { + + case "git-app": + fmt.Println("-> Stopping service...") + client.RunSudo(fmt.Sprintf("systemctl stop %s", name)) + client.RunSudo(fmt.Sprintf("systemctl disable %s", name)) + + client.RunSudo(fmt.Sprintf("rm -f /etc/systemd/system/%s.service", name)) + client.RunSudo("systemctl daemon-reload") + + fmt.Println("-> Removing Docker image...") + client.RunSudo(fmt.Sprintf("docker rmi %s:latest", name)) + + fmt.Println("-> Removing files...") + client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) + client.RunSudo(fmt.Sprintf("rm -rf /srv/git/%s.git", name)) + client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) + + case "git-static": + fmt.Println("-> Removing files...") + client.RunSudo(fmt.Sprintf("rm -rf /var/www/%s", name)) + client.RunSudo(fmt.Sprintf("rm -rf /srv/git/%s.git", name)) + + default: // "static" fmt.Println("-> Removing files...") client.RunSudo(fmt.Sprintf("rm -rf /var/www/%s", name)) } -- cgit v1.2.3