diff options
| author | bndw <ben@bdw.to> | 2026-01-24 09:48:34 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-01-24 09:48:34 -0800 |
| commit | 5861e465a2ccf31d87ea25ac145770786f9cc96e (patch) | |
| tree | 4ac6b57a06b46d8492717b235909f9e0db0b4f22 | |
| parent | ef37850c7090493cf2b26d2e565511fe23cc9bfc (diff) | |
Rename project from deploy to ship
- Rename module to github.com/bdw/ship
- Rename cmd/deploy to cmd/ship
- Update all import paths
- Update config path from ~/.config/deploy to ~/.config/ship
- Update VPS env path from /etc/deploy to /etc/ship
- Update README, Makefile, and docs
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | DESIGN_SPEC.md | 16 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | README.md | 56 | ||||
| -rw-r--r-- | cmd/ship/env/env.go (renamed from cmd/deploy/env/env.go) | 0 | ||||
| -rw-r--r-- | cmd/ship/env/list.go (renamed from cmd/deploy/env/list.go) | 2 | ||||
| -rw-r--r-- | cmd/ship/env/set.go (renamed from cmd/deploy/env/set.go) | 6 | ||||
| -rw-r--r-- | cmd/ship/env/unset.go (renamed from cmd/deploy/env/unset.go) | 6 | ||||
| -rw-r--r-- | cmd/ship/host/host.go (renamed from cmd/deploy/host/host.go) | 0 | ||||
| -rw-r--r-- | cmd/ship/host/init.go (renamed from cmd/deploy/host/init.go) | 14 | ||||
| -rw-r--r-- | cmd/ship/host/ssh.go (renamed from cmd/deploy/host/ssh.go) | 2 | ||||
| -rw-r--r-- | cmd/ship/host/status.go (renamed from cmd/deploy/host/status.go) | 4 | ||||
| -rw-r--r-- | cmd/ship/host/update.go (renamed from cmd/deploy/host/update.go) | 4 | ||||
| -rw-r--r-- | cmd/ship/list.go (renamed from cmd/deploy/list.go) | 2 | ||||
| -rw-r--r-- | cmd/ship/logs.go (renamed from cmd/deploy/logs.go) | 4 | ||||
| -rw-r--r-- | cmd/ship/main.go (renamed from cmd/deploy/main.go) | 10 | ||||
| -rw-r--r-- | cmd/ship/remove.go (renamed from cmd/deploy/remove.go) | 6 | ||||
| -rw-r--r-- | cmd/ship/restart.go (renamed from cmd/deploy/restart.go) | 4 | ||||
| -rw-r--r-- | cmd/ship/root.go (renamed from cmd/deploy/root.go) | 8 | ||||
| -rw-r--r-- | cmd/ship/status.go (renamed from cmd/deploy/status.go) | 4 | ||||
| -rw-r--r-- | cmd/ship/templates/webui.html (renamed from cmd/deploy/templates/webui.html) | 0 | ||||
| -rw-r--r-- | cmd/ship/ui.go (renamed from cmd/deploy/ui.go) | 8 | ||||
| -rw-r--r-- | cmd/ship/version.go (renamed from cmd/deploy/version.go) | 2 | ||||
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | internal/state/state.go | 8 |
25 files changed, 87 insertions, 87 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | # Binaries | 1 | # Binaries |
| 2 | /deploy | 2 | /ship |
| 3 | *.exe | 3 | *.exe |
| 4 | *.dll | 4 | *.dll |
| 5 | *.so | 5 | *.so |
diff --git a/DESIGN_SPEC.md b/DESIGN_SPEC.md index e8bb197..51342d4 100644 --- a/DESIGN_SPEC.md +++ b/DESIGN_SPEC.md | |||
| @@ -20,7 +20,7 @@ deploy init --host user@your-vps-ip | |||
| 20 | # - Detect OS (Ubuntu/Debian supported) | 20 | # - Detect OS (Ubuntu/Debian supported) |
| 21 | # - Install Caddy from official repository | 21 | # - Install Caddy from official repository |
| 22 | # - Configure Caddy to import `/etc/caddy/sites-enabled/*` | 22 | # - Configure Caddy to import `/etc/caddy/sites-enabled/*` |
| 23 | # - Create `/etc/deploy/env/` directory for env files | 23 | # - Create `/etc/ship/env/` directory for env files |
| 24 | # - Create `/etc/caddy/sites-enabled/` directory | 24 | # - Create `/etc/caddy/sites-enabled/` directory |
| 25 | # - Enable and start Caddy service | 25 | # - Enable and start Caddy service |
| 26 | # - Verify installation | 26 | # - Verify installation |
| @@ -40,7 +40,7 @@ deploy init --host user@your-vps-ip | |||
| 40 | # This will SSH to the VPS and: | 40 | # This will SSH to the VPS and: |
| 41 | # - Install Caddy | 41 | # - Install Caddy |
| 42 | # - Configure Caddy to use sites-enabled pattern | 42 | # - Configure Caddy to use sites-enabled pattern |
| 43 | # - Create /etc/deploy/env/ directory for env files | 43 | # - Create /etc/ship/env/ directory for env files |
| 44 | # - Enable and start Caddy | 44 | # - Enable and start Caddy |
| 45 | # | 45 | # |
| 46 | # State is stored locally at ~/.config/deploy/state.json | 46 | # State is stored locally at ~/.config/deploy/state.json |
| @@ -273,9 +273,9 @@ All deployment state stored locally at `~/.config/deploy/state.json`: | |||
| 273 | ``` | 273 | ``` |
| 274 | 274 | ||
| 275 | ### Environment Files (VPS) | 275 | ### Environment Files (VPS) |
| 276 | Environment variables written to `/etc/deploy/env/{appname}.env` on VPS for systemd to read: | 276 | Environment variables written to `/etc/ship/env/{appname}.env` on VPS for systemd to read: |
| 277 | ```bash | 277 | ```bash |
| 278 | # /etc/deploy/env/myapi.env (generated from state.json) | 278 | # /etc/ship/env/myapi.env (generated from state.json) |
| 279 | PORT=8001 | 279 | PORT=8001 |
| 280 | DB_HOST=localhost | 280 | DB_HOST=localhost |
| 281 | DB_PORT=5432 | 281 | DB_PORT=5432 |
| @@ -297,7 +297,7 @@ ENVIRONMENT=production | |||
| 297 | - Checks if Caddy is already installed (skip if present) | 297 | - Checks if Caddy is already installed (skip if present) |
| 298 | - Installs Caddy via official APT repository | 298 | - Installs Caddy via official APT repository |
| 299 | - Creates `/etc/caddy/Caddyfile` with `import /etc/caddy/sites-enabled/*` | 299 | - Creates `/etc/caddy/Caddyfile` with `import /etc/caddy/sites-enabled/*` |
| 300 | - Creates directory structure: `/etc/deploy/env/`, `/etc/caddy/sites-enabled/` | 300 | - Creates directory structure: `/etc/ship/env/`, `/etc/caddy/sites-enabled/` |
| 301 | - Enables and starts Caddy | 301 | - Enables and starts Caddy |
| 302 | - Runs health check (verify Caddy is running) | 302 | - Runs health check (verify Caddy is running) |
| 303 | - Initializes local state file at `~/.config/deploy/state.json` if not present | 303 | - Initializes local state file at `~/.config/deploy/state.json` if not present |
| @@ -343,7 +343,7 @@ All steps executed remotely on VPS via SSH: | |||
| 343 | 4. Create system user (e.g., `myapp`) | 343 | 4. Create system user (e.g., `myapp`) |
| 344 | 5. Create working directory (`/var/lib/myapp`) | 344 | 5. Create working directory (`/var/lib/myapp`) |
| 345 | 6. Copy binary to `/usr/local/bin/myapp` | 345 | 6. Copy binary to `/usr/local/bin/myapp` |
| 346 | 7. Create env file at `/etc/deploy/env/myapp.env` with PORT and any user-provided vars | 346 | 7. Create env file at `/etc/ship/env/myapp.env` with PORT and any user-provided vars |
| 347 | 8. Set env file permissions (0600, owned by app user) | 347 | 8. Set env file permissions (0600, owned by app user) |
| 348 | 9. Generate systemd unit at `/etc/systemd/system/myapp.service` with EnvironmentFile | 348 | 9. Generate systemd unit at `/etc/systemd/system/myapp.service` with EnvironmentFile |
| 349 | 10. Generate Caddy config at `/etc/caddy/sites-enabled/myapp.caddy` pointing to localhost:port | 349 | 10. Generate Caddy config at `/etc/caddy/sites-enabled/myapp.caddy` pointing to localhost:port |
| @@ -376,7 +376,7 @@ All steps executed remotely on VPS via SSH: | |||
| 376 | /var/lib/myapp/ # Working directory | 376 | /var/lib/myapp/ # Working directory |
| 377 | /etc/systemd/system/myapp.service # Systemd unit | 377 | /etc/systemd/system/myapp.service # Systemd unit |
| 378 | /etc/caddy/sites-enabled/myapp.caddy # Caddy config | 378 | /etc/caddy/sites-enabled/myapp.caddy # Caddy config |
| 379 | /etc/deploy/env/myapp.env # Environment variables (0600 permissions) | 379 | /etc/ship/env/myapp.env # Environment variables (0600 permissions) |
| 380 | 380 | ||
| 381 | /var/www/mysite/ # Static site files | 381 | /var/www/mysite/ # Static site files |
| 382 | /etc/caddy/sites-enabled/mysite.caddy # Caddy config | 382 | /etc/caddy/sites-enabled/mysite.caddy # Caddy config |
| @@ -550,7 +550,7 @@ deploy list | |||
| 550 | - Use systemd security hardening (NoNewPrivileges, PrivateTmp, ProtectSystem) | 550 | - Use systemd security hardening (NoNewPrivileges, PrivateTmp, ProtectSystem) |
| 551 | - Static sites served as www-data | 551 | - Static sites served as www-data |
| 552 | - Caddy automatically handles TLS cert management | 552 | - Caddy automatically handles TLS cert management |
| 553 | - Environment files stored at `/etc/deploy/env/{app}.env` with 0600 permissions | 553 | - Environment files stored at `/etc/ship/env/{app}.env` with 0600 permissions |
| 554 | - Env files owned by the app's system user | 554 | - Env files owned by the app's system user |
| 555 | - `deploy env` command masks sensitive values when displaying (shows `API_KEY=***`) | 555 | - `deploy env` command masks sensitive values when displaying (shows `API_KEY=***`) |
| 556 | - Consider using external secret management for production (out of scope for v1) | 556 | - Consider using external secret management for production (out of scope for v1) |
| @@ -1,6 +1,6 @@ | |||
| 1 | build: | 1 | build: |
| 2 | go build -o ./bin/deploy ./cmd/deploy | 2 | go build -o ./bin/ship ./cmd/ship |
| 3 | 3 | ||
| 4 | install: | 4 | install: |
| 5 | cp ./bin/deploy /usr/local/bin/ | 5 | cp ./bin/ship /usr/local/bin/ |
| 6 | 6 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | # Deploy - VPS Deployment CLI | 1 | # Ship - VPS Deployment CLI |
| 2 | 2 | ||
| 3 | Simple CLI tool for deploying Go apps and static sites to a VPS with automatic HTTPS via Caddy. | 3 | Simple CLI tool for deploying Go apps and static sites to a VPS with automatic HTTPS via Caddy. |
| 4 | 4 | ||
| @@ -17,10 +17,10 @@ Simple CLI tool for deploying Go apps and static sites to a VPS with automatic H | |||
| 17 | 17 | ||
| 18 | ```bash | 18 | ```bash |
| 19 | # Build the CLI | 19 | # Build the CLI |
| 20 | go build -o ~/bin/deploy ./cmd/deploy | 20 | go build -o ~/bin/ship ./cmd/ship |
| 21 | 21 | ||
| 22 | # Or install to GOPATH | 22 | # Or install to GOPATH |
| 23 | go install ./cmd/deploy | 23 | go install ./cmd/ship |
| 24 | ``` | 24 | ``` |
| 25 | 25 | ||
| 26 | ## Quick Start | 26 | ## Quick Start |
| @@ -29,7 +29,7 @@ go install ./cmd/deploy | |||
| 29 | 29 | ||
| 30 | ```bash | 30 | ```bash |
| 31 | # Initialize a fresh VPS (this sets it as the default host) | 31 | # Initialize a fresh VPS (this sets it as the default host) |
| 32 | deploy host init user@your-vps-ip | 32 | ship host init user@your-vps-ip |
| 33 | ``` | 33 | ``` |
| 34 | 34 | ||
| 35 | This will: | 35 | This will: |
| @@ -45,15 +45,15 @@ This will: | |||
| 45 | GOOS=linux GOARCH=amd64 go build -o myapp | 45 | GOOS=linux GOARCH=amd64 go build -o myapp |
| 46 | 46 | ||
| 47 | # Deploy it | 47 | # Deploy it |
| 48 | deploy --binary ./myapp --domain api.example.com | 48 | ship --binary ./myapp --domain api.example.com |
| 49 | 49 | ||
| 50 | # With environment variables | 50 | # With environment variables |
| 51 | deploy --binary ./myapp --domain api.example.com \ | 51 | ship --binary ./myapp --domain api.example.com \ |
| 52 | --env DB_HOST=localhost \ | 52 | --env DB_HOST=localhost \ |
| 53 | --env API_KEY=secret | 53 | --env API_KEY=secret |
| 54 | 54 | ||
| 55 | # Or from an env file | 55 | # Or from an env file |
| 56 | deploy --binary ./myapp --domain api.example.com \ | 56 | ship --binary ./myapp --domain api.example.com \ |
| 57 | --env-file .env.production | 57 | --env-file .env.production |
| 58 | ``` | 58 | ``` |
| 59 | 59 | ||
| @@ -64,7 +64,7 @@ deploy --binary ./myapp --domain api.example.com \ | |||
| 64 | npm run build | 64 | npm run build |
| 65 | 65 | ||
| 66 | # Deploy it | 66 | # Deploy it |
| 67 | deploy --static --dir ./dist --domain example.com | 67 | ship --static --dir ./dist --domain example.com |
| 68 | ``` | 68 | ``` |
| 69 | 69 | ||
| 70 | ## App Requirements | 70 | ## App Requirements |
| @@ -110,72 +110,72 @@ func main() { | |||
| 110 | 110 | ||
| 111 | ```bash | 111 | ```bash |
| 112 | # Initialize a fresh VPS (one-time setup, sets as default) | 112 | # Initialize a fresh VPS (one-time setup, sets as default) |
| 113 | deploy host init user@vps-ip | 113 | ship host init user@vps-ip |
| 114 | 114 | ||
| 115 | # Update system packages (apt update && apt upgrade) | 115 | # Update system packages (apt update && apt upgrade) |
| 116 | deploy host update | 116 | ship host update |
| 117 | 117 | ||
| 118 | # Check host status | 118 | # Check host status |
| 119 | deploy host status | 119 | ship host status |
| 120 | 120 | ||
| 121 | # SSH into the host | 121 | # SSH into the host |
| 122 | deploy host ssh | 122 | ship host ssh |
| 123 | ``` | 123 | ``` |
| 124 | 124 | ||
| 125 | ### Deploy App/Site | 125 | ### Deploy App/Site |
| 126 | ```bash | 126 | ```bash |
| 127 | # Go app | 127 | # Go app |
| 128 | deploy --binary ./myapp --domain api.example.com | 128 | ship --binary ./myapp --domain api.example.com |
| 129 | 129 | ||
| 130 | # Static site | 130 | # Static site |
| 131 | deploy --static --dir ./dist --domain example.com | 131 | ship --static --dir ./dist --domain example.com |
| 132 | 132 | ||
| 133 | # Custom name (defaults to binary/directory name) | 133 | # Custom name (defaults to binary/directory name) |
| 134 | deploy --name myapi --binary ./myapp --domain api.example.com | 134 | ship --name myapi --binary ./myapp --domain api.example.com |
| 135 | ``` | 135 | ``` |
| 136 | 136 | ||
| 137 | ### List Deployments | 137 | ### List Deployments |
| 138 | ```bash | 138 | ```bash |
| 139 | deploy list | 139 | ship list |
| 140 | ``` | 140 | ``` |
| 141 | 141 | ||
| 142 | ### Manage Deployments | 142 | ### Manage Deployments |
| 143 | ```bash | 143 | ```bash |
| 144 | # View logs | 144 | # View logs |
| 145 | deploy logs myapp | 145 | ship logs myapp |
| 146 | 146 | ||
| 147 | # View status | 147 | # View status |
| 148 | deploy status myapp | 148 | ship status myapp |
| 149 | 149 | ||
| 150 | # Restart app | 150 | # Restart app |
| 151 | deploy restart myapp | 151 | ship restart myapp |
| 152 | 152 | ||
| 153 | # Remove deployment | 153 | # Remove deployment |
| 154 | deploy remove myapp | 154 | ship remove myapp |
| 155 | ``` | 155 | ``` |
| 156 | 156 | ||
| 157 | ### Environment Variables | 157 | ### Environment Variables |
| 158 | ```bash | 158 | ```bash |
| 159 | # View current env vars (secrets are masked) | 159 | # View current env vars (secrets are masked) |
| 160 | deploy env list myapi | 160 | ship env list myapi |
| 161 | 161 | ||
| 162 | # Set env vars | 162 | # Set env vars |
| 163 | deploy env set myapi DB_HOST=localhost API_KEY=secret | 163 | ship env set myapi DB_HOST=localhost API_KEY=secret |
| 164 | 164 | ||
| 165 | # Load from file | 165 | # Load from file |
| 166 | deploy env set myapi -f .env.production | 166 | ship env set myapi -f .env.production |
| 167 | 167 | ||
| 168 | # Unset env var | 168 | # Unset env var |
| 169 | deploy env unset myapi API_KEY | 169 | ship env unset myapi API_KEY |
| 170 | ``` | 170 | ``` |
| 171 | 171 | ||
| 172 | ## Configuration | 172 | ## Configuration |
| 173 | 173 | ||
| 174 | The host you initialize becomes the default, so you don't need to specify `--host` for every command. The default host is stored in `~/.config/deploy/state.json`. | 174 | The host you initialize becomes the default, so you don't need to specify `--host` for every command. The default host is stored in `~/.config/ship/state.json`. |
| 175 | 175 | ||
| 176 | ## How It Works | 176 | ## How It Works |
| 177 | 177 | ||
| 178 | 1. **State on Laptop**: All deployment state lives at `~/.config/deploy/state.json` on your laptop | 178 | 1. **State on Laptop**: All deployment state lives at `~/.config/ship/state.json` on your laptop |
| 179 | 2. **SSH Orchestration**: The CLI uses SSH to run commands on your VPS | 179 | 2. **SSH Orchestration**: The CLI uses SSH to run commands on your VPS |
| 180 | 3. **File Transfer**: Binaries transferred via SCP, static sites via rsync | 180 | 3. **File Transfer**: Binaries transferred via SCP, static sites via rsync |
| 181 | 4. **Caddy for HTTPS**: Caddy automatically handles HTTPS certificates | 181 | 4. **Caddy for HTTPS**: Caddy automatically handles HTTPS certificates |
| @@ -186,7 +186,7 @@ The host you initialize becomes the default, so you don't need to specify `--hos | |||
| 186 | 186 | ||
| 187 | ### On Laptop | 187 | ### On Laptop |
| 188 | ``` | 188 | ``` |
| 189 | ~/.config/deploy/state.json # All deployment state (including default host) | 189 | ~/.config/ship/state.json # All deployment state (including default host) |
| 190 | ``` | 190 | ``` |
| 191 | 191 | ||
| 192 | ### On VPS | 192 | ### On VPS |
| @@ -195,7 +195,7 @@ The host you initialize becomes the default, so you don't need to specify `--hos | |||
| 195 | /var/lib/myapp/ # Working directory | 195 | /var/lib/myapp/ # Working directory |
| 196 | /etc/systemd/system/myapp.service # Systemd unit | 196 | /etc/systemd/system/myapp.service # Systemd unit |
| 197 | /etc/caddy/sites-enabled/myapp.caddy # Caddy config | 197 | /etc/caddy/sites-enabled/myapp.caddy # Caddy config |
| 198 | /etc/deploy/env/myapp.env # Environment variables | 198 | /etc/ship/env/myapp.env # Environment variables |
| 199 | 199 | ||
| 200 | /var/www/mysite/ # Static site files | 200 | /var/www/mysite/ # Static site files |
| 201 | /etc/caddy/sites-enabled/mysite.caddy # Caddy config | 201 | /etc/caddy/sites-enabled/mysite.caddy # Caddy config |
diff --git a/cmd/deploy/env/env.go b/cmd/ship/env/env.go index 489353a..489353a 100644 --- a/cmd/deploy/env/env.go +++ b/cmd/ship/env/env.go | |||
diff --git a/cmd/deploy/env/list.go b/cmd/ship/env/list.go index af92171..ad76eb6 100644 --- a/cmd/deploy/env/list.go +++ b/cmd/ship/env/list.go | |||
| @@ -4,7 +4,7 @@ import ( | |||
| 4 | "fmt" | 4 | "fmt" |
| 5 | "strings" | 5 | "strings" |
| 6 | 6 | ||
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
diff --git a/cmd/deploy/env/set.go b/cmd/ship/env/set.go index 35d77ff..e11d2c9 100644 --- a/cmd/deploy/env/set.go +++ b/cmd/ship/env/set.go | |||
| @@ -6,8 +6,8 @@ import ( | |||
| 6 | "os" | 6 | "os" |
| 7 | "strings" | 7 | "strings" |
| 8 | 8 | ||
| 9 | "github.com/bdw/deploy/internal/ssh" | 9 | "github.com/bdw/ship/internal/ssh" |
| 10 | "github.com/bdw/deploy/internal/state" | 10 | "github.com/bdw/ship/internal/state" |
| 11 | "github.com/spf13/cobra" | 11 | "github.com/spf13/cobra" |
| 12 | ) | 12 | ) |
| 13 | 13 | ||
| @@ -89,7 +89,7 @@ func runSet(cmd *cobra.Command, args []string) error { | |||
| 89 | defer client.Close() | 89 | defer client.Close() |
| 90 | 90 | ||
| 91 | fmt.Println("-> Updating environment file on VPS...") | 91 | fmt.Println("-> Updating environment file on VPS...") |
| 92 | envFilePath := fmt.Sprintf("/etc/deploy/env/%s.env", name) | 92 | envFilePath := fmt.Sprintf("/etc/ship/env/%s.env", name) |
| 93 | envContent := "" | 93 | envContent := "" |
| 94 | for k, v := range app.Env { | 94 | for k, v := range app.Env { |
| 95 | envContent += fmt.Sprintf("%s=%s\n", k, v) | 95 | envContent += fmt.Sprintf("%s=%s\n", k, v) |
diff --git a/cmd/deploy/env/unset.go b/cmd/ship/env/unset.go index 65a8986..7d9a141 100644 --- a/cmd/deploy/env/unset.go +++ b/cmd/ship/env/unset.go | |||
| @@ -3,8 +3,8 @@ package env | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| @@ -73,7 +73,7 @@ func runUnset(cmd *cobra.Command, args []string) error { | |||
| 73 | defer client.Close() | 73 | defer client.Close() |
| 74 | 74 | ||
| 75 | fmt.Println("-> Updating environment file on VPS...") | 75 | fmt.Println("-> Updating environment file on VPS...") |
| 76 | envFilePath := fmt.Sprintf("/etc/deploy/env/%s.env", name) | 76 | envFilePath := fmt.Sprintf("/etc/ship/env/%s.env", name) |
| 77 | envContent := "" | 77 | envContent := "" |
| 78 | for k, v := range app.Env { | 78 | for k, v := range app.Env { |
| 79 | envContent += fmt.Sprintf("%s=%s\n", k, v) | 79 | envContent += fmt.Sprintf("%s=%s\n", k, v) |
diff --git a/cmd/deploy/host/host.go b/cmd/ship/host/host.go index 603a946..603a946 100644 --- a/cmd/deploy/host/host.go +++ b/cmd/ship/host/host.go | |||
diff --git a/cmd/deploy/host/init.go b/cmd/ship/host/init.go index 984e5d3..ea25922 100644 --- a/cmd/deploy/host/init.go +++ b/cmd/ship/host/init.go | |||
| @@ -4,8 +4,8 @@ import ( | |||
| 4 | "fmt" | 4 | "fmt" |
| 5 | "strings" | 5 | "strings" |
| 6 | 6 | ||
| 7 | "github.com/bdw/deploy/internal/ssh" | 7 | "github.com/bdw/ship/internal/ssh" |
| 8 | "github.com/bdw/deploy/internal/state" | 8 | "github.com/bdw/ship/internal/state" |
| 9 | "github.com/spf13/cobra" | 9 | "github.com/spf13/cobra" |
| 10 | ) | 10 | ) |
| 11 | 11 | ||
| @@ -75,8 +75,8 @@ import /etc/caddy/sites-enabled/* | |||
| 75 | fmt.Println(" Caddyfile created") | 75 | fmt.Println(" Caddyfile created") |
| 76 | 76 | ||
| 77 | fmt.Println("-> Creating directories...") | 77 | fmt.Println("-> Creating directories...") |
| 78 | if _, err := client.RunSudo("mkdir -p /etc/deploy/env"); err != nil { | 78 | if _, err := client.RunSudo("mkdir -p /etc/ship/env"); err != nil { |
| 79 | return fmt.Errorf("error creating /etc/deploy/env: %w", err) | 79 | return fmt.Errorf("error creating /etc/ship/env: %w", err) |
| 80 | } | 80 | } |
| 81 | if _, err := client.RunSudo("mkdir -p /etc/caddy/sites-enabled"); err != nil { | 81 | if _, err := client.RunSudo("mkdir -p /etc/caddy/sites-enabled"); err != nil { |
| 82 | return fmt.Errorf("error creating /etc/caddy/sites-enabled: %w", err) | 82 | return fmt.Errorf("error creating /etc/caddy/sites-enabled: %w", err) |
| @@ -111,10 +111,10 @@ import /etc/caddy/sites-enabled/* | |||
| 111 | 111 | ||
| 112 | fmt.Println("\nVPS initialized successfully!") | 112 | fmt.Println("\nVPS initialized successfully!") |
| 113 | fmt.Println("\nNext steps:") | 113 | fmt.Println("\nNext steps:") |
| 114 | fmt.Println(" 1. Deploy a Go app:") | 114 | fmt.Println(" 1. Deploy an app:") |
| 115 | fmt.Printf(" deploy --binary ./myapp --domain api.example.com\n") | 115 | fmt.Printf(" ship --binary ./myapp --domain api.example.com\n") |
| 116 | fmt.Println(" 2. Deploy a static site:") | 116 | fmt.Println(" 2. Deploy a static site:") |
| 117 | fmt.Printf(" deploy --static --dir ./dist --domain example.com\n") | 117 | fmt.Printf(" ship --static --dir ./dist --domain example.com\n") |
| 118 | return nil | 118 | return nil |
| 119 | } | 119 | } |
| 120 | 120 | ||
diff --git a/cmd/deploy/host/ssh.go b/cmd/ship/host/ssh.go index a33986f..e480e47 100644 --- a/cmd/deploy/host/ssh.go +++ b/cmd/ship/host/ssh.go | |||
| @@ -5,7 +5,7 @@ import ( | |||
| 5 | "os" | 5 | "os" |
| 6 | "os/exec" | 6 | "os/exec" |
| 7 | 7 | ||
| 8 | "github.com/bdw/deploy/internal/state" | 8 | "github.com/bdw/ship/internal/state" |
| 9 | "github.com/spf13/cobra" | 9 | "github.com/spf13/cobra" |
| 10 | ) | 10 | ) |
| 11 | 11 | ||
diff --git a/cmd/deploy/host/status.go b/cmd/ship/host/status.go index bdd9c31..eb2de53 100644 --- a/cmd/deploy/host/status.go +++ b/cmd/ship/host/status.go | |||
| @@ -3,8 +3,8 @@ package host | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
diff --git a/cmd/deploy/host/update.go b/cmd/ship/host/update.go index aa47ed8..5f838b6 100644 --- a/cmd/deploy/host/update.go +++ b/cmd/ship/host/update.go | |||
| @@ -6,8 +6,8 @@ import ( | |||
| 6 | "os" | 6 | "os" |
| 7 | "strings" | 7 | "strings" |
| 8 | 8 | ||
| 9 | "github.com/bdw/deploy/internal/ssh" | 9 | "github.com/bdw/ship/internal/ssh" |
| 10 | "github.com/bdw/deploy/internal/state" | 10 | "github.com/bdw/ship/internal/state" |
| 11 | "github.com/spf13/cobra" | 11 | "github.com/spf13/cobra" |
| 12 | ) | 12 | ) |
| 13 | 13 | ||
diff --git a/cmd/deploy/list.go b/cmd/ship/list.go index ab19a12..a5b8df3 100644 --- a/cmd/deploy/list.go +++ b/cmd/ship/list.go | |||
| @@ -5,7 +5,7 @@ import ( | |||
| 5 | "os" | 5 | "os" |
| 6 | "text/tabwriter" | 6 | "text/tabwriter" |
| 7 | 7 | ||
| 8 | "github.com/bdw/deploy/internal/state" | 8 | "github.com/bdw/ship/internal/state" |
| 9 | "github.com/spf13/cobra" | 9 | "github.com/spf13/cobra" |
| 10 | ) | 10 | ) |
| 11 | 11 | ||
diff --git a/cmd/deploy/logs.go b/cmd/ship/logs.go index 2b016b8..1932c18 100644 --- a/cmd/deploy/logs.go +++ b/cmd/ship/logs.go | |||
| @@ -3,8 +3,8 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
diff --git a/cmd/deploy/main.go b/cmd/ship/main.go index ad61523..680ac58 100644 --- a/cmd/deploy/main.go +++ b/cmd/ship/main.go | |||
| @@ -3,8 +3,8 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "os" | 4 | "os" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/cmd/deploy/env" | 6 | "github.com/bdw/ship/cmd/ship/env" |
| 7 | "github.com/bdw/deploy/cmd/deploy/host" | 7 | "github.com/bdw/ship/cmd/ship/host" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| @@ -19,9 +19,9 @@ var ( | |||
| 19 | ) | 19 | ) |
| 20 | 20 | ||
| 21 | var rootCmd = &cobra.Command{ | 21 | var rootCmd = &cobra.Command{ |
| 22 | Use: "deploy", | 22 | Use: "ship", |
| 23 | Short: "Deploy Go apps and static sites to a VPS with automatic HTTPS", | 23 | Short: "Ship apps and static sites to a VPS with automatic HTTPS", |
| 24 | Long: `deploy - Deploy Go apps and static sites to a VPS with automatic HTTPS | 24 | Long: `ship - Ship apps and static sites to a VPS with automatic HTTPS |
| 25 | 25 | ||
| 26 | A CLI tool for deploying applications and static sites to a VPS. | 26 | A CLI tool for deploying applications and static sites to a VPS. |
| 27 | Uses Caddy for automatic HTTPS and systemd for service management.`, | 27 | Uses Caddy for automatic HTTPS and systemd for service management.`, |
diff --git a/cmd/deploy/remove.go b/cmd/ship/remove.go index 5a98bf3..922eb8f 100644 --- a/cmd/deploy/remove.go +++ b/cmd/ship/remove.go | |||
| @@ -3,8 +3,8 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| @@ -56,7 +56,7 @@ func runRemove(cmd *cobra.Command, args []string) error { | |||
| 56 | 56 | ||
| 57 | client.RunSudo(fmt.Sprintf("rm -f /usr/local/bin/%s", name)) | 57 | client.RunSudo(fmt.Sprintf("rm -f /usr/local/bin/%s", name)) |
| 58 | client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) | 58 | client.RunSudo(fmt.Sprintf("rm -rf /var/lib/%s", name)) |
| 59 | client.RunSudo(fmt.Sprintf("rm -f /etc/deploy/env/%s.env", name)) | 59 | client.RunSudo(fmt.Sprintf("rm -f /etc/ship/env/%s.env", name)) |
| 60 | client.RunSudo(fmt.Sprintf("userdel %s", name)) | 60 | client.RunSudo(fmt.Sprintf("userdel %s", name)) |
| 61 | } else { | 61 | } else { |
| 62 | fmt.Println("-> Removing files...") | 62 | fmt.Println("-> Removing files...") |
diff --git a/cmd/deploy/restart.go b/cmd/ship/restart.go index d1cfa86..2c74c62 100644 --- a/cmd/deploy/restart.go +++ b/cmd/ship/restart.go | |||
| @@ -3,8 +3,8 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
diff --git a/cmd/deploy/root.go b/cmd/ship/root.go index adbc7c8..e5d6753 100644 --- a/cmd/deploy/root.go +++ b/cmd/ship/root.go | |||
| @@ -8,9 +8,9 @@ import ( | |||
| 8 | "strconv" | 8 | "strconv" |
| 9 | "strings" | 9 | "strings" |
| 10 | 10 | ||
| 11 | "github.com/bdw/deploy/internal/ssh" | 11 | "github.com/bdw/ship/internal/ssh" |
| 12 | "github.com/bdw/deploy/internal/state" | 12 | "github.com/bdw/ship/internal/state" |
| 13 | "github.com/bdw/deploy/internal/templates" | 13 | "github.com/bdw/ship/internal/templates" |
| 14 | "github.com/spf13/cobra" | 14 | "github.com/spf13/cobra" |
| 15 | ) | 15 | ) |
| 16 | 16 | ||
| @@ -181,7 +181,7 @@ func deployApp(host, domain, name, binaryPath string, portOverride int, envVars | |||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | fmt.Println("-> Creating environment file...") | 183 | fmt.Println("-> Creating environment file...") |
| 184 | envFilePath := fmt.Sprintf("/etc/deploy/env/%s.env", name) | 184 | envFilePath := fmt.Sprintf("/etc/ship/env/%s.env", name) |
| 185 | envContent := "" | 185 | envContent := "" |
| 186 | for k, v := range env { | 186 | for k, v := range env { |
| 187 | envContent += fmt.Sprintf("%s=%s\n", k, v) | 187 | envContent += fmt.Sprintf("%s=%s\n", k, v) |
diff --git a/cmd/deploy/status.go b/cmd/ship/status.go index 4bcfc68..03c548b 100644 --- a/cmd/deploy/status.go +++ b/cmd/ship/status.go | |||
| @@ -3,8 +3,8 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | 5 | ||
| 6 | "github.com/bdw/deploy/internal/ssh" | 6 | "github.com/bdw/ship/internal/ssh" |
| 7 | "github.com/bdw/deploy/internal/state" | 7 | "github.com/bdw/ship/internal/state" |
| 8 | "github.com/spf13/cobra" | 8 | "github.com/spf13/cobra" |
| 9 | ) | 9 | ) |
| 10 | 10 | ||
diff --git a/cmd/deploy/templates/webui.html b/cmd/ship/templates/webui.html index 052d599..052d599 100644 --- a/cmd/deploy/templates/webui.html +++ b/cmd/ship/templates/webui.html | |||
diff --git a/cmd/deploy/ui.go b/cmd/ship/ui.go index 2ca88e0..cfaea08 100644 --- a/cmd/deploy/ui.go +++ b/cmd/ship/ui.go | |||
| @@ -9,8 +9,8 @@ import ( | |||
| 9 | "sort" | 9 | "sort" |
| 10 | "strconv" | 10 | "strconv" |
| 11 | 11 | ||
| 12 | "github.com/bdw/deploy/internal/state" | 12 | "github.com/bdw/ship/internal/state" |
| 13 | "github.com/bdw/deploy/internal/templates" | 13 | "github.com/bdw/ship/internal/templates" |
| 14 | "github.com/spf13/cobra" | 14 | "github.com/spf13/cobra" |
| 15 | ) | 15 | ) |
| 16 | 16 | ||
| @@ -136,13 +136,13 @@ func runUI(cmd *cobra.Command, args []string) error { | |||
| 136 | envContent += fmt.Sprintf("%s=%s\n", k, v) | 136 | envContent += fmt.Sprintf("%s=%s\n", k, v) |
| 137 | } | 137 | } |
| 138 | configs["env"] = envContent | 138 | configs["env"] = envContent |
| 139 | configs["envPath"] = fmt.Sprintf("/etc/deploy/env/%s.env", appName) | 139 | configs["envPath"] = fmt.Sprintf("/etc/ship/env/%s.env", appName) |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | if app.Type == "app" { | 142 | if app.Type == "app" { |
| 143 | workDir := fmt.Sprintf("/var/lib/%s", appName) | 143 | workDir := fmt.Sprintf("/var/lib/%s", appName) |
| 144 | binaryPath := fmt.Sprintf("/usr/local/bin/%s", appName) | 144 | binaryPath := fmt.Sprintf("/usr/local/bin/%s", appName) |
| 145 | envFilePath := fmt.Sprintf("/etc/deploy/env/%s.env", appName) | 145 | envFilePath := fmt.Sprintf("/etc/ship/env/%s.env", appName) |
| 146 | 146 | ||
| 147 | serviceContent, err := templates.SystemdService(map[string]string{ | 147 | serviceContent, err := templates.SystemdService(map[string]string{ |
| 148 | "Name": appName, | 148 | "Name": appName, |
diff --git a/cmd/deploy/version.go b/cmd/ship/version.go index d2cd430..6e4314a 100644 --- a/cmd/deploy/version.go +++ b/cmd/ship/version.go | |||
| @@ -10,7 +10,7 @@ var versionCmd = &cobra.Command{ | |||
| 10 | Use: "version", | 10 | Use: "version", |
| 11 | Short: "Show version information", | 11 | Short: "Show version information", |
| 12 | Run: func(cmd *cobra.Command, args []string) { | 12 | Run: func(cmd *cobra.Command, args []string) { |
| 13 | fmt.Printf("deploy version %s\n", version) | 13 | fmt.Printf("ship version %s\n", version) |
| 14 | fmt.Printf(" commit: %s\n", commit) | 14 | fmt.Printf(" commit: %s\n", commit) |
| 15 | fmt.Printf(" built: %s\n", date) | 15 | fmt.Printf(" built: %s\n", date) |
| 16 | }, | 16 | }, |
| @@ -1,4 +1,4 @@ | |||
| 1 | module github.com/bdw/deploy | 1 | module github.com/bdw/ship |
| 2 | 2 | ||
| 3 | go 1.21 | 3 | go 1.21 |
| 4 | 4 | ||
diff --git a/internal/state/state.go b/internal/state/state.go index def0bcf..b99e4ca 100644 --- a/internal/state/state.go +++ b/internal/state/state.go | |||
| @@ -33,7 +33,7 @@ const ( | |||
| 33 | startPort = 8001 | 33 | startPort = 8001 |
| 34 | ) | 34 | ) |
| 35 | 35 | ||
| 36 | // Load reads state from ~/.config/deploy/state.json | 36 | // Load reads state from ~/.config/ship/state.json |
| 37 | func Load() (*State, error) { | 37 | func Load() (*State, error) { |
| 38 | path := statePath() | 38 | path := statePath() |
| 39 | 39 | ||
| @@ -62,7 +62,7 @@ func Load() (*State, error) { | |||
| 62 | return &state, nil | 62 | return &state, nil |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | // Save writes state to ~/.config/deploy/state.json | 65 | // Save writes state to ~/.config/ship/state.json |
| 66 | func (s *State) Save() error { | 66 | func (s *State) Save() error { |
| 67 | path := statePath() | 67 | path := statePath() |
| 68 | 68 | ||
| @@ -153,7 +153,7 @@ func statePath() string { | |||
| 153 | home, err := os.UserHomeDir() | 153 | home, err := os.UserHomeDir() |
| 154 | if err != nil { | 154 | if err != nil { |
| 155 | // Fallback to current directory (should rarely happen) | 155 | // Fallback to current directory (should rarely happen) |
| 156 | return ".deploy-state.json" | 156 | return ".ship-state.json" |
| 157 | } | 157 | } |
| 158 | return filepath.Join(home, ".config", "deploy", "state.json") | 158 | return filepath.Join(home, ".config", "ship", "state.json") |
| 159 | } | 159 | } |
