- Go 99%
- Dockerfile 1%
| .gitea/workflows | ||
| .vscode | ||
| api | ||
| cli | ||
| docs | ||
| nodes | ||
| refresher | ||
| .gitignore | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
| Taskfile.yml | ||
Lobby 2 - simple service discovery
This is second version of my Lobby projects that doesn't require NATS. All clients uses single service discovery server that keeps track of their presence.
Each instance, except its liveness can share labels which describe what's hosted on this instance and that can used by others instances for various things. There is also a simple KV store for additional info.
Configuration
Lobby2 can be configured entirely through environment variables. When any of the node refresher variables below is present, the refresher runs in strict env mode and does not read or create the JSON files at CONFIG_PATH and NODE_PATH.
Master/API settings:
LISTEN- API listen address, default0.0.0.0:1352TOKEN- API bearer tokenDUMP_PATH- path to the persisted nodes dump, default/var/lib/lobby2/nodes.jsonDROP_AFTER_SECONDS- how long a node stays alive without refresh, default60
Node refresher settings:
MASTER_HOST- master node host, required in env modeMASTER_PROTO- master protocol, defaulthttpMASTER_TOKEN- master token, required in env modeMASTER_PORT- master port, default1352NODE_HOSTNAME- node hostname, defaults to the local hostnameNODE_LABELS- comma-separated labels, for examplelaptop,dev,amd64NODE_KV- comma-separatedkey=valuepairs, for exampleprometheus_host=fw.rosti.cz,prometheus_port=9999
Example env-only node setup:
export TOKEN='super-secret-api-token'
export MASTER_HOST='master.example.internal'
export MASTER_TOKEN='super-secret-master-token'
export MASTER_PROTO='https'
export MASTER_PORT='443'
export NODE_HOSTNAME='laptop-01'
export NODE_LABELS='laptop,workstation'
export NODE_KV='prometheus_host=fw.rosti.cz,prometheus_port=9999'
lobby2 node
If you do not set any of the node refresher env vars, Lobby2 keeps using the JSON files at CONFIG_PATH and NODE_PATH.