You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows how to run Falcon cluster workers on independently bound TCP endpoints. Each worker binds to `localhost` with port `0`, allowing the operating system to assign an available port.
3
+
This example runs a two-worker Falcon cluster behind Envoy. Each worker binds to `localhost` with port `0`, allowing the operating system to assign an available port. Falcon publishes the concrete worker addresses to Envoy through the supervisor's xDS control plane.
4
4
5
-
After binding, Falcon describes each worker using a `Falcon::Service::Cluster::Listener`. The listener exposes its logical name, scheme, supported protocol names, bound endpoint, and all concrete socket addresses. This example records those addresses in `addresses.txt`; service discovery integrations can instead use `prepare_worker!(instance, listener:)` to register them directly.
5
+
Docker Compose runs Falcon and Envoy in the same network namespace. This allows the workers to remain bound to loopback addresses while Envoy connects to their dynamically assigned ports. Envoy exposes a fixed HTTP listener on port 10000 and distributes requests across the workers.
6
6
7
7
## Usage
8
8
9
-
Start the two-worker cluster:
9
+
Build and start Falcon and Envoy:
10
10
11
11
```shell
12
-
$ bundle exec async-service ./falcon.rb
12
+
$ docker compose up --build --detach
13
13
```
14
14
15
-
In another terminal, run the client:
15
+
Run the client through Compose:
16
16
17
17
```shell
18
-
$ bundle exec ruby ./client.rb
19
-
[::]:53142: Hello World!
20
-
[::]:53143: Hello World!
18
+
$ docker compose run --rm client
19
+
Hello from worker 12!
20
+
Hello from worker 13!
21
21
```
22
22
23
-
The exact address family and ports are platform-dependent.
23
+
The client waits for Envoy and confirms that requests reach both workers.
24
24
25
-
Both commands use `./addresses.txt` by default. Set `ADDRESSES_PATH` on both commands to use a different file:
0 commit comments