aboutsummaryrefslogtreecommitdiffstats
path: root/TODO.md
blob: c92175c3197f0743f294930774f40e4aef43186d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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

### 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/<name>`
- `{{.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`).

**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".

**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"
    }
  }
}
```

**Also:** Clean up `internal/state/state.go` — remove `next_port`, `apps`, `AllocatePort()`, and other v1 cruft. Keep it minimal.