{"id":24308902,"url":"https://github.com/mangadex-pub/mcw","last_synced_at":"2026-04-17T18:32:27.059Z","repository":{"id":271777642,"uuid":"912748202","full_name":"mangadex-pub/mcw","owner":"mangadex-pub","description":"MCRouter configuration management, for Kubernetes \u0026 dynamic environments","archived":false,"fork":false,"pushed_at":"2025-01-13T22:02:43.000Z","size":121,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T20:17:16.773Z","etag":null,"topics":["dns","kubernetes","mcrouter","memcache","memcached"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mangadex-pub.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}},"created_at":"2025-01-06T10:09:12.000Z","updated_at":"2025-01-13T22:02:40.000Z","dependencies_parsed_at":"2025-01-09T20:41:12.480Z","dependency_job_id":null,"html_url":"https://github.com/mangadex-pub/mcw","commit_stats":null,"previous_names":["mangadex-pub/mcw"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mangadex-pub/mcw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangadex-pub%2Fmcw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangadex-pub%2Fmcw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangadex-pub%2Fmcw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangadex-pub%2Fmcw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mangadex-pub","download_url":"https://codeload.github.com/mangadex-pub/mcw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangadex-pub%2Fmcw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31940830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["dns","kubernetes","mcrouter","memcache","memcached"],"created_at":"2025-01-17T05:11:53.755Z","updated_at":"2026-04-17T18:32:27.045Z","avatar_url":"https://github.com/mangadex-pub.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCW - MCRouter Config Watcher\n\n#### Dynamic DNS (re)configuration for MCRouter\n\n**STATUS:** !! Experimental !!\n\n## Summary\n\nMCRouter is great, but it resolves server hosts only once, via simple A/AAAA hostname resolution, and never cares again later.\n\nThis is a problem in many environments where target memcache instances might come and go, or change IPs from time to time. Especially in a Kubernetes\nenvironment, it's best to be able to rely on things like DNS SRV records exposed by headless services.\n\nMCW is designed to make this problem go away entirely, in a robust and reasonably flexible way.\n\n## How It Works\n\nThe mode of operation of MCW is as follows:\n\n1. Watch a configuration template\n2. On change and on a schedule, re-resolve dynamic tokens it contains\n3. Output a rendered configuration with only IP:Port formatted servers\n\nFor example, with the following template:\n\n```json\n{\n  \"pools\": {\n    \"kubernetes\": {\n      \"servers\": [\n        \"dns://memcache.domain\"\n      ]\n    }\n  }\n}\n```\n\nIf `memcache.domain` contains the following A records:\n\n- 10.0.0.1\n- 10.0.0.2\n- 10.0.0.3\n\nThen MCW will output the following configuration:\n\n```json\n{\n  \"pools\": {\n    \"kubernetes\": {\n      \"servers\": [\n        \"10.0.0.1:11211\",\n        \"10.0.0.2:11211\",\n        \"10.0.0.3:11211\"\n      ]\n    }\n  }\n}\n```\n\n### Supported Tokens\n\nThe following server tokens are supported:\n\n- `dns://domain.example`: Will result in a server per A record on `domain.example`, with port `11211`\n- `dns+1234://domain.example` Same as above, but with port `1234`\n- `dnssrv://_memcache._tcp.domain.example` Will use the records returned by an SRV query of `_memcache._tcp.domain.example`\n\nFinally, any server not matching these tokens is kept as-is, and you can safely mix-and-match static and dynamic server entries.\n\n## Quick Start\n\nWrite your MCRouter configuration template using [server tokens](#supported-tokens), then run:\n\n```text\n/path/to/mcw\n  --source file:///configuration/mcrouter/template.json\n  --output file:///configuration/mcrouter/configuration.json\n```\n\nAnd MCW will automatically:\n\n1. Read `template.json`\n2. Resolve servers it references\n3. Render `configuration.json`\n\nThen, anytime `template.json` changes, or every `render-ttl`, it will update `configuration.json` accordingly.\n\n## Server Ordering\n\nMCW attempts to keep a stable server order, as such dynamic tokens are only ever expanded in-place, and are not deduplicated (so if a server shows up as part of\n2 different dynamic tokens in the same pool, the pool will have 2 entries pointing to it).\n\n### For A-based Server Records (`dns[+port]://`)\n\nMCW takes the record in the order they are returned to it.\n\nSince `dns://` and `dns+port://` servers are resolved via an `A` DNS query, and do not provide any metadata (such a name) for the underlying servers, you must\nensure that your resolver returns a consistently ordered list of records.\n\n\u003e This is highly uncommon, and the majority of DNS resolvers and nameservers return A records in a randomized order.\n\n### For SRV-based Server Records (`dnssrv://`)\n\nSRV records are sorted by:\n\n1. Their priority, then\n2. Their target, lexicographically\n\nFor example, given the following SRV response:\n\n```text\n_memcache._tcp.memcache-srv IN SRV 10 100 11211 memcache-B\n_memcache._tcp.memcache-srv IN SRV 50 100 11211 memcache-C\n_memcache._tcp.memcache-srv IN SRV 10 100 11211 memcache-A\n```\n\nMCW will render `[memcache-A, memcache-B, memcache-C]`\n\n\u003e Note 1: The weight value of SRV records is ignored\n\u003e\n\u003e Note 2: If an SRV record has a target that resolves to multiple A records, they will all be included, and their sorting follows A-based sorting logic. But\n\u003e also don't do that to yourself, life's too short...\n\nFor best efficiency, ensure you always return the same _set_ of SRV records. For example, it is best to not remove an SRV record for a server going away 10\nseconds during a rolling restart, and to instead rely on MCRouter's native healthchecking of servers.\n\nIn a Kubernetes environment, you can ensure an SRV record for any pod in a StatefulSet, no matter the pod's readiness, with the following headless Service\nparameter:\n\n```yaml\napiVersion: v1\nkind: Service\n# ...\nspec:\n  publishNotReadyAddresses: true\n  # ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangadex-pub%2Fmcw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmangadex-pub%2Fmcw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangadex-pub%2Fmcw/lists"}