-
Notifications
You must be signed in to change notification settings - Fork 19
Description
When a user runs tsnsrv as follows:
TS_AUTHKEY=... tsnsrv --name first http://localhost:9090
Then everything works wonderfully.
However if I try and start a second instance.
TS_AUTHKEY=... tsnsrv --name second http://localhost:9090
Then the second instance will fail and the tailscale console will report the error: "Duplicate node key" under the Machine tab.
The conflict is caused by the tsnsrv alwasys using the .config/tsnet-tsnsrv directory (on Linux) to store configuration. This behavior can be avoided by using the -stateDir or TS_STATE_DIR for the second instance however the failure is surprising and will likely lead to confusion. A better solution would be to use a unique directory name (based on the --name parameter) for each tsnsrv instance such as .config/tsnet-tsnsrv-. This would eliminate the surprises and confusion for users.
The cost of this proposal is that it is a backwards incompatible change and that existing users would need to recreate their instances (use a new key). If desired tsnsrv could warn users of the incompatibility by warning all users that have a .config/tsnet-tsnsrv directory that they should delete this directory and recreate their instances.