SIGN IN SIGN UP

(core) Let a fleet come up without a worker id set on every server

Summary:
Two things have to differ from server to server, and neither default did.

A worker id has to be distinct, since two servers sharing one can open the same
document. The default came from the port alone.

The internal url tells peers where to reach a server. Its host defaulted to
localhost, or to 0.0.0.0 under the docker image, which names the server reading
the url rather than the one it describes. A peer following it connected to
itself, and found a document held by an id it also had.

The url is now worked out from the address the socket ended up bound to, which
the bind has already resolved, so that a name and every spelling of an address
arrive as one form. Loopback, which GRIST_HOST unset gives, reaches no peer, so
nothing is published in its place, not even an address the server does have
elsewhere. An address of the machine's own is the address. The unspecified
address, which the docker image asks for with GRIST_HOST=0.0.0.0, names nothing,
so Grist takes the interface it reaches Redis on, since every fleet member
reaches the same Redis. APP_DOC_INTERNAL_URL and GRIST_ROUTER_URL still override
it.

The restart shell owns the listening socket, so it hands the address it bound to
the worker, as it already hands it the port.

The id comes from that url. APP_DOC_URL serves as the internal url where none is
given, and names the worker too, since a client reaches the worker holding a
document through it and no two can share one. The name is taken from the address
as the operator wrote it, not from the published url, which has a version tag on
the end that changes with every build. Where no url names this server, such as a
loopback address, the machine does instead. GRIST_DOC_WORKER_ID still overrides
it.

A fleet proxies clients on from whichever server they reach, so a worker's
public url is never used, and where it stands in for the internal url peers
leave the cluster and come back through the public front end. APP_DOC_URL set
with GRIST_FLEET is refused at startup.

A server that ends up with no url peers can reach says so at startup.

Test Plan: added tests

Reviewers: Spoffy

Reviewed By: Spoffy

Differential Revision: https://phab.getgrist.com/D5042
P
Paul Fitzpatrick committed
ee28810b010c91dcfcdd5c0a7614a08408a661e5
Parent: 43e1e9a