From 065bd4b7ce7831444d9487083fb17bb94c04d8a8 Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 17:25:08 -0800 Subject: Add TODO.md with known limitations - Docker container port hardcoded to 80 - ship host init doesn't create local state.json --- TODO.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 TODO.md (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..57deebc --- /dev/null +++ b/TODO.md @@ -0,0 +1,41 @@ +# Ship TODO + +## Known Limitations + +### Docker Container Port Assumption +**Current behavior:** Ship assumes Docker containers listen on port 80 internally. + +**In:** `internal/templates/templates.go`: +``` +-p 127.0.0.1:{{.Port}}:80 +``` + +**Problem:** Containers that expose other ports (e.g., 8080, 3000) will not work. + +**Workaround:** Ensure your Docker container listens on port 80, or manually edit the systemd unit after deployment. + +**Potential fixes:** +1. Add `--container-port` flag to specify internal port +2. Auto-detect from Dockerfile `EXPOSE` directive +3. Support `PORT` env var in Docker containers (like binary deploys) + +--- + +## Other TODOs + +### ship host init doesn't create local state.json +**Problem:** After `ship host init`, the local `~/.config/ship/state.json` isn't created with the base_domain. Deploys fail with "HOST_NOT_CONFIGURED". + +**Workaround:** Manually create `~/.config/ship/state.json`: +```json +{ + "default_host": "alaskav6", + "hosts": { + "alaskav6": { + "next_port": 8001, + "base_domain": "northwest.io", + "apps": {} + } + } +} +``` -- cgit v1.2.3 From 8708614ed8a0b10cc8c1a11c3cc42757fc6af4f3 Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 18:38:45 -0800 Subject: Add TODOs: show custom domains in list, fix port collision bug --- TODO.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index 57deebc..57a33ad 100644 --- a/TODO.md +++ b/TODO.md @@ -23,6 +23,20 @@ ## Other TODOs +### ship list should show custom domains +**Problem:** `ship list` shows internal names (e.g., `ship-593a3d`) but not the actual custom domain mappings (e.g., `checkyourinfo.com`). + +**Desired:** Show the actual domain in the URL column when `--domain` was used. + +### Port allocation collision bug +**Problem:** Ship can allocate the same port to multiple deployments, causing containers to fail with exit code 125. + +**Example:** Both len.to and checkyourinfo.com were assigned port 9000. + +**Fix:** Check if port is actually in use before allocating. + +--- + ### ship host init doesn't create local state.json **Problem:** After `ship host init`, the local `~/.config/ship/state.json` isn't created with the base_domain. Deploys fail with "HOST_NOT_CONFIGURED". -- cgit v1.2.3 From 1f9c91c4d7152751190bb17a37f2f8724e4cad7b Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 18:51:54 -0800 Subject: Add TODO: support custom Caddyfile in repo --- TODO.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index 57a33ad..2c6a6be 100644 --- a/TODO.md +++ b/TODO.md @@ -23,6 +23,20 @@ ## Other TODOs +### Support custom Caddyfile in repo +**Problem:** v2 always generates Caddyfiles from templates, ignoring any custom config in the repo. + +**v1 behavior:** Checked for `.ship/Caddyfile` and used it if present. + +**Proposed:** If `Caddyfile` exists in repo root, use it instead of generating. Support variable substitution: +- `{{.RootDir}}` → `/var/www/` +- `{{.Port}}` → allocated port +- `{{.Domain}}` → site domain + +This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting ship manage deployment. + +--- + ### ship list should show custom domains **Problem:** `ship list` shows internal names (e.g., `ship-593a3d`) but not the actual custom domain mappings (e.g., `checkyourinfo.com`). -- cgit v1.2.3 From 5e5de4ea1aa98f75d470e4a61644d4b9f100c4b0 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 07:51:44 -0800 Subject: Update TODO #2: simplify local state, remove v1 cruft --- TODO.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index 2c6a6be..c92175c 100644 --- a/TODO.md +++ b/TODO.md @@ -54,16 +54,20 @@ This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting sh ### ship host init doesn't create local state.json **Problem:** After `ship host init`, the local `~/.config/ship/state.json` isn't created with the base_domain. Deploys fail with "HOST_NOT_CONFIGURED". -**Workaround:** Manually create `~/.config/ship/state.json`: +**Design:** v2 uses remote state (`/etc/ship/ports/` on server) for port allocation and app tracking. Local state only needs: +- `default_host` — which host to use when `--host` isn't specified +- `base_domain` — for generating URLs + +**Fix:** `ship host init` should create minimal local state: ```json { "default_host": "alaskav6", "hosts": { "alaskav6": { - "next_port": 8001, - "base_domain": "northwest.io", - "apps": {} + "base_domain": "northwest.io" } } } ``` + +**Also:** Clean up `internal/state/state.go` — remove `next_port`, `apps`, `AllocatePort()`, and other v1 cruft. Keep it minimal. -- cgit v1.2.3 From 3e34265c8a6ea1ec300f987206afb25bad645677 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 07:54:42 -0800 Subject: Mark TODO #2 as fixed --- TODO.md | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index c92175c..6b41d98 100644 --- a/TODO.md +++ b/TODO.md @@ -51,23 +51,10 @@ This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting sh --- -### ship host init doesn't create local state.json -**Problem:** After `ship host init`, the local `~/.config/ship/state.json` isn't created with the base_domain. Deploys fail with "HOST_NOT_CONFIGURED". - -**Design:** v2 uses remote state (`/etc/ship/ports/` on server) for port allocation and app tracking. Local state only needs: -- `default_host` — which host to use when `--host` isn't specified -- `base_domain` — for generating URLs - -**Fix:** `ship host init` should create minimal local state: -```json -{ - "default_host": "alaskav6", - "hosts": { - "alaskav6": { - "base_domain": "northwest.io" - } - } -} -``` +### ~~ship host init doesn't create local state.json~~ ✅ FIXED +**Fixed in:** commit 6b2c047 -**Also:** Clean up `internal/state/state.go` — remove `next_port`, `apps`, `AllocatePort()`, and other v1 cruft. Keep it minimal. +- Removed all v1 code (-2837 lines) +- Simplified `internal/state/state.go` to just `default_host` + `base_domain` +- `host init` now creates minimal state.json +- Ports/deploys tracked on server at `/etc/ship/ports/` -- cgit v1.2.3 From c11e0ed6edd10e48780fb965b8d5b730d53b81a0 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 08:00:11 -0800 Subject: Update TODO: mark port collision and container port as fixed --- TODO.md | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index 6b41d98..c5cbea6 100644 --- a/TODO.md +++ b/TODO.md @@ -1,27 +1,6 @@ # Ship TODO -## Known Limitations - -### Docker Container Port Assumption -**Current behavior:** Ship assumes Docker containers listen on port 80 internally. - -**In:** `internal/templates/templates.go`: -``` --p 127.0.0.1:{{.Port}}:80 -``` - -**Problem:** Containers that expose other ports (e.g., 8080, 3000) will not work. - -**Workaround:** Ensure your Docker container listens on port 80, or manually edit the systemd unit after deployment. - -**Potential fixes:** -1. Add `--container-port` flag to specify internal port -2. Auto-detect from Dockerfile `EXPOSE` directive -3. Support `PORT` env var in Docker containers (like binary deploys) - ---- - -## Other TODOs +## Open ### Support custom Caddyfile in repo **Problem:** v2 always generates Caddyfiles from templates, ignoring any custom config in the repo. @@ -42,14 +21,23 @@ This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting sh **Desired:** Show the actual domain in the URL column when `--domain` was used. -### Port allocation collision bug -**Problem:** Ship can allocate the same port to multiple deployments, causing containers to fail with exit code 125. +--- + +## Fixed -**Example:** Both len.to and checkyourinfo.com were assigned port 9000. +### ~~Port allocation collision bug~~ ✅ FIXED +**Fixed in:** commit d97bb6f -**Fix:** Check if port is actually in use before allocating. +- Port allocation now uses atomic flock on `/etc/ship/next_port` +- Prevents race conditions when multiple deploys run concurrently +- Each app still gets its port stored in `/etc/ship/ports/` ---- +### ~~Docker container port assumption~~ ✅ FIXED +**Fixed in:** commit d97bb6f + +- Added `--container-port` flag (default 80) +- Template now uses `{{.ContainerPort}}` instead of hardcoded 80 +- Supports containers that listen on 8080, 3000, etc. ### ~~ship host init doesn't create local state.json~~ ✅ FIXED **Fixed in:** commit 6b2c047 -- cgit v1.2.3 From 21e6aa97a56ad8c494feef066dc0970cf4b94b4f Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 08:06:15 -0800 Subject: Mark custom domains in list as fixed --- TODO.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index c5cbea6..bd2d325 100644 --- a/TODO.md +++ b/TODO.md @@ -16,10 +16,11 @@ This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting sh --- -### ship list should show custom domains -**Problem:** `ship list` shows internal names (e.g., `ship-593a3d`) but not the actual custom domain mappings (e.g., `checkyourinfo.com`). +### ~~ship list should show custom domains~~ ✅ FIXED +**Fixed in:** commit c1b0bb8 -**Desired:** Show the actual domain in the URL column when `--domain` was used. +- Reads actual domain from Caddyfile instead of assuming subdomain +- Works for both apps and static sites --- -- cgit v1.2.3 From 05ea98df57599775c1d5bfea336012b075531670 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 08:09:53 -0800 Subject: Mark custom Caddyfile support as fixed --- TODO.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'TODO.md') diff --git a/TODO.md b/TODO.md index bd2d325..5406485 100644 --- a/TODO.md +++ b/TODO.md @@ -2,17 +2,12 @@ ## Open -### Support custom Caddyfile in repo -**Problem:** v2 always generates Caddyfiles from templates, ignoring any custom config in the repo. +### ~~Support custom Caddyfile~~ ✅ FIXED +**Fixed in:** commit b976b14 -**v1 behavior:** Checked for `.ship/Caddyfile` and used it if present. - -**Proposed:** If `Caddyfile` exists in repo root, use it instead of generating. Support variable substitution: -- `{{.RootDir}}` → `/var/www/` -- `{{.Port}}` → allocated port -- `{{.Domain}}` → site domain - -This allows custom routes (NIP-05, LNURL, rewrites, etc.) while still letting ship manage deployment. +- Caddyfile is only generated on first deploy +- Redeploys preserve existing Caddyfile (manual edits survive) +- SSH in and customize as needed, future deploys won't overwrite --- -- cgit v1.2.3