@solcreek/dew 0.7.52 → 0.7.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +51 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -83,23 +83,65 @@ port = 6379
83
83
  [[service]]
84
84
  name = "mailpit"
85
85
  image = "axllent/mailpit:latest"
86
- port = 8025
86
+ port = 8025 # primary port (health-gated + forwarded)
87
+ ports = ["1025"] # extra host forwards: "PORT" or "HOST:CONTAINER"
87
88
  ```
88
89
 
89
90
  `dew up` then boots the project and its services in one VM; containers use
90
- the VM network, so the dev server reaches them on `localhost`.
91
+ the VM network, so the dev server reaches them on `localhost`. A service that
92
+ exposes more than one port (mailpit's SMTP `1025` alongside its web UI `8025`)
93
+ lists the extras in `ports` — each `"PORT"` (host = container) or
94
+ `"HOST:CONTAINER"` to remap the host side.
91
95
 
92
96
  `--services-only` (alias `--no-dev`) boots just the services — handy when
93
97
  the app itself runs on the host and only its backing services live in dew.
94
98
  This is the docker-compose-shaped path: several arbitrary OCI images,
95
99
  health-gated and port-forwarded, in one microVM with no container daemon.
96
100
 
97
- To reach a service running on the **macOS host** (e.g. a websocket gateway
98
- in the VM calling back to a host RPC), use the hostname `host.internal`
99
- (alias `host.dew.internal`) dew's equivalent of `host.docker.internal`.
100
- It resolves to the VM's NAT gateway in both the guest and its containers,
101
- so you never hardcode the `192.168.64.x` gateway IP. The host service must
102
- bind `0.0.0.0` (not `127.0.0.1`) to be reachable from the VM.
101
+ ### Reach the macOS host from the VM
102
+
103
+ A service in the VM often has to call back to a process on your Mac — a
104
+ websocket gateway hitting a host RPC, an app talking to a database you run
105
+ natively. dew gives you two host aliases so you never hardcode the
106
+ `192.168.64.x` gateway IP. Both resolve inside the guest **and** inside
107
+ `--net=host` containers, so a `dew.toml` service reaches the host the same
108
+ way the guest does.
109
+
110
+ | Alias | Reaches a host service bound to | Path | Use when |
111
+ |---|---|---|---|
112
+ | `host.internal` (alias `host.dew.internal`) | `0.0.0.0` (all interfaces) | VZ NAT gateway | the host service already listens on all interfaces |
113
+ | `host.lo.internal` | **`127.0.0.1`** (the dev default) | vsock → host loopback | the service is loopback-only, or you want to dodge the macOS 26 VZ NAT regression |
114
+
115
+ **`host.internal` — the NAT-gateway alias**, dew's equivalent of
116
+ `host.docker.internal`. The host service must bind `0.0.0.0`; a `127.0.0.1`
117
+ bind stays unreachable (same caveat as docker's alias):
118
+
119
+ ```bash
120
+ # bind the host service to 0.0.0.0 (a 127.0.0.1 bind is unreachable):
121
+ python3 -m http.server 50051 --bind 0.0.0.0
122
+ # then from the VM (or a --net=host container): curl http://host.internal:50051
123
+ ```
124
+
125
+ **`host.lo.internal` — a vsock tunnel straight to the host's loopback.**
126
+ This is the one for the common dev case where the host service is bound to
127
+ `127.0.0.1` (a Rails RPC, a local Postgres, etc.). Declare the ports to
128
+ expose; dew forwards each over vsock to the host's `127.0.0.1` — no
129
+ `0.0.0.0` rebind, and because it never touches the network stack it is
130
+ **immune to the macOS 26 VZ NAT regression**:
131
+
132
+ ```bash
133
+ dew up --expose-host 50051
134
+ # in the VM: host.lo.internal:50051 → the host's 127.0.0.1:50051
135
+ ```
136
+
137
+ ```toml
138
+ # or, in dew.toml:
139
+ [host]
140
+ expose = [50051]
141
+ ```
142
+
143
+ dew only ever dials its own loopback on a port you declared, so the VM can't
144
+ reach anything else on the host.
103
145
 
104
146
  ### Run any container
105
147
 
@@ -240,6 +282,7 @@ Dev:
240
282
  dew up --with postgres,redis Dev with built-in services
241
283
  dew up --init Write a starter dew.toml
242
284
  dew up --services-only Boot services without a dev server
285
+ dew up --expose-host PORT Reach a host 127.0.0.1 service in the VM
243
286
  dew down Stop dev environment
244
287
 
245
288
  Share:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solcreek/dew",
3
- "version": "0.7.52",
3
+ "version": "0.7.54",
4
4
  "description": "Sandboxed Linux compute, agent-native and human-friendly.",
5
5
  "license": "MIT",
6
6
  "repository": {