{"id":41847556,"url":"https://github.com/mpepping/discovery-service","last_synced_at":"2026-01-25T10:04:24.919Z","repository":{"id":322804844,"uuid":"1090958374","full_name":"mpepping/discovery-service","owner":"mpepping","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-06T12:39:12.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-06T13:16:18.735Z","etag":null,"topics":["service-discovery","talos","talos-linux"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpepping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-06T11:16:01.000Z","updated_at":"2025-11-06T12:39:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf48efd0-cae6-4058-aabb-9030e2007a36","html_url":"https://github.com/mpepping/discovery-service","commit_stats":null,"previous_names":["mpepping/discovery-service"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mpepping/discovery-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpepping%2Fdiscovery-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpepping%2Fdiscovery-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpepping%2Fdiscovery-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpepping%2Fdiscovery-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpepping","download_url":"https://codeload.github.com/mpepping/discovery-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpepping%2Fdiscovery-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28751099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T09:58:17.166Z","status":"ssl_error","status_checked_at":"2026-01-25T09:55:56.104Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["service-discovery","talos","talos-linux"],"created_at":"2026-01-25T10:04:24.785Z","updated_at":"2026-01-25T10:04:24.912Z","avatar_url":"https://github.com/mpepping.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discovery Service\n\nAn ephemeral cluster discovery service that enables nodes to exchange membership information. Complatible with Talos Linux service discovery and MIT licensed.\n\n## Features\n\n- **gRPC API** - Full-featured gRPC service for cluster discovery\n- **Real-time Updates** - Streaming watch API for real-time affiliate changes\n- **Privacy-First** - Stores only encrypted data blobs, never has decryption keys\n- **Ephemeral Storage** - All data in-memory with configurable TTL (default 30 minutes)\n- **Rate Limiting** - Per-IP rate limiting to prevent abuse\n- **Prometheus Metrics** - Built-in metrics for monitoring\n- **HTTP Landing Page** - Web UI for cluster inspection\n- **Auto Garbage Collection** - Automatic cleanup of expired affiliates\n\n## Quick Start\n\n### Building from Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/mpepping/discovery-service\ncd discovery-service\n\n# Build the binary\nmake build\n\n# Run the service\n./bin/discovery-service\n```\n\n### Using Docker\n\n```bash\n# Build the Docker image\nmake docker-build\n\n# Run the container\ndocker run -p 3000:3000 -p 3001:3001 -p 2122:2122 discovery-service:latest\n```\n\n### Using Pre-built Binaries\n\nDownload the latest release from the [releases page](https://github.com/mpepping/discovery-service/releases).\n\n## Configuration\n\nThe service is configured via command-line flags:\n\n```bash\n./bin/discovery-service \\\n  -listen-addr :3000 \\\n  -landing-addr :3001 \\\n  -metrics-addr :2122 \\\n  -gc-interval 1m \\\n  -debug\n```\n\n### Available Flags\n\n| Flag                 | Default | Description                                   |\n| -------------------- | ------- | --------------------------------------------- |\n| `-listen-addr`       | `:3000` | gRPC server listen address                    |\n| `-landing-addr`      | `:3001` | HTTP landing page address (empty to disable)  |\n| `-metrics-addr`      | `:2122` | Prometheus metrics address (empty to disable) |\n| `-redirect-endpoint` | ``      | Optional redirect endpoint for Hello RPC      |\n| `-gc-interval`       | `1m`    | Garbage collection interval                   |\n| `-debug`             | `false` | Enable debug logging                          |\n\n### Environment Variables\n\n- `MODE=development` - Enables development logging with colored output\n\n## API Reference\n\n### gRPC Service\n\nThe service implements the `Cluster` service with the following methods:\n\n#### Hello\n\nInitial handshake that returns the client's observed IP address.\n\n```protobuf\nrpc Hello(HelloRequest) returns (HelloResponse);\n```\n\n#### AffiliateUpdate\n\nCreate or update an affiliate record with encrypted data and endpoints.\n\n```protobuf\nrpc AffiliateUpdate(AffiliateUpdateRequest) returns (AffiliateUpdateResponse);\n```\n\n#### AffiliateDelete\n\nRemove an affiliate from the cluster.\n\n```protobuf\nrpc AffiliateDelete(AffiliateDeleteRequest) returns (AffiliateDeleteResponse);\n```\n\n#### List\n\nRetrieve all current affiliates for a cluster.\n\n```protobuf\nrpc List(ListRequest) returns (ListResponse);\n```\n\n#### Watch\n\nStream real-time affiliate changes (snapshot + deltas).\n\n```protobuf\nrpc Watch(WatchRequest) returns (stream WatchResponse);\n```\n\n### HTTP Endpoints\n\n- `GET /` - Landing page with service information\n- `GET /inspect?clusterID=\u003cid\u003e` - Cluster inspection UI\n- `GET /metrics` - Prometheus metrics (port 2122)\n\n## Limits and Constraints\n\n- **Max Affiliates per Cluster:** 100\n- **Max Endpoints per Affiliate:** 20\n- **Default TTL:** 30 minutes (configurable via request)\n- **Rate Limit:** 15 requests/second per IP\n- **Burst Allowance:** 60 requests per IP\n\n## Testing with grpcurl\n\n```bash\n# Install grpcurl\ngo install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest\n\n# Test Hello endpoint\ngrpcurl -plaintext \\\n  -d '{\"cluster_id\": \"test-cluster\", \"client_version\": \"1.0.0\"}' \\\n  localhost:3000 \\\n  discovery.cluster.v1.Cluster/Hello\n\n# Update an affiliate\ngrpcurl -plaintext \\\n  -d '{\"cluster_id\": \"test-cluster\", \"affiliate_id\": \"node1\", \"data\": \"ZW5jcnlwdGVkLWRhdGE=\"}' \\\n  localhost:3000 \\\n  discovery.cluster.v1.Cluster/AffiliateUpdate\n\n# List affiliates\ngrpcurl -plaintext \\\n  -d '{\"cluster_id\": \"test-cluster\"}' \\\n  localhost:3000 \\\n  discovery.cluster.v1.Cluster/List\n\n# Watch for changes\ngrpcurl -plaintext \\\n  -d '{\"cluster_id\": \"test-cluster\"}' \\\n  localhost:3000 \\\n  discovery.cluster.v1.Cluster/Watch\n```\n\n## Prometheus Metrics\n\nThe service exposes the following metrics on `/metrics`:\n\n- `discovery_clusters_total` - Total number of clusters\n- `discovery_affiliates_total` - Total number of affiliates\n- `discovery_endpoints_total` - Total number of endpoints\n- `discovery_subscriptions_total` - Active watch subscriptions\n- `discovery_gc_runs_total` - Total GC runs\n- `discovery_gc_collected_clusters_total` - Clusters collected by GC\n- `discovery_gc_collected_affiliates_total` - Affiliates collected by GC\n- `discovery_hello_requests_total` - Hello requests by client version\n\n## Development\n\n### Prerequisites\n\n- Go 1.23 or later\n- Make (optional)\n- Docker (optional)\n\n### Project Structure\n\n```\ndiscovery-service/\n├── api/                    # API definitions and generated code\n│   └── cluster/v1/        # Cluster service protobuf\n├── cmd/                    # Command-line applications\n│   └── discovery-service/ # Main service entry point\n├── internal/               # Private application code\n│   ├── landing/           # HTTP landing page\n│   ├── limiter/           # Rate limiting\n│   └── state/             # State management\n├── pkg/                    # Public library code\n│   ├── limits/            # Limit constants\n│   └── server/            # gRPC server implementation\n├── Dockerfile             # Container image\n├── Makefile              # Build automation\n└── README.md             # This file\n```\n\n### Building\n\n```bash\n# Build the binary\nmake build\n\n# Run tests\nmake test\n\n# Build Docker image\nmake docker-build\n\n# Run locally\nmake run\n\n# Clean build artifacts\nmake clean\n```\n\n### Running Tests\n\n```bash\n# Run all tests\ngo test ./...\n\n# Run tests with coverage\ngo test -cover ./...\n\n# Run tests with race detector\ngo test -race ./...\n```\n\n## Deployment\n\n### Docker Compose\n\n```yaml\nversion: \"3.8\"\nservices:\n  discovery:\n    image: discovery-service:latest\n    ports:\n      - \"3000:3000\" # gRPC\n      - \"3001:3001\" # HTTP\n      - \"2122:2122\" # Metrics\n    command:\n      - \"-debug\"\n      - \"-gc-interval=1m\"\n```\n\n### Kubernetes\n\nSee the `deploy/kubernetes/` directory for example manifests.\n\n```bash\nkubectl apply -f deploy/kubernetes/\n```\n\n## Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n### Development Workflow\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Run tests (`make test`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\nThis project maintains API compatibility with the original [Talos discovery service](https://github.com/siderolabs/discovery-service) while using a different license and implementation.\n\n## Support\n\n- **Issues:** [GitHub Issues](https://github.com/mpepping/discovery-service/issues)\n- **Documentation:** [API Research Document](API_RESEARCH.md)\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for release history.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpepping%2Fdiscovery-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpepping%2Fdiscovery-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpepping%2Fdiscovery-service/lists"}