internal/website/docs/architecture/adr-004-mdns-default-registry.md
Accepted
Service discovery is critical for microservices. Common approaches:
For local development and getting started, requiring infrastructure setup is a barrier. Production deployments typically have existing service discovery infrastructure.
Use mDNS as the default registry for service discovery.
// Default - uses mDNS automatically
svc := micro.NewService(micro.Name("myservice"))
// Production - swap to Consul
reg := consul.NewConsulRegistry()
svc := micro.NewService(
micro.Name("myservice"),
micro.Registry(reg),
)
go run main.go just worksMICRO_REGISTRY=consul)Rejected because:
Rejected because:
Rejected because:
Start with mDNS, migrate to production registry:
# Development
go run main.go
# Staging
MICRO_REGISTRY=consul MICRO_REGISTRY_ADDRESS=consul:8500 go run main.go
# Production (Kubernetes)
MICRO_REGISTRY=nats MICRO_REGISTRY_ADDRESS=nats://nats:4222 ./service