{"id":16746963,"url":"https://github.com/selfup/gdsm","last_synced_at":"2025-07-29T23:32:43.680Z","repository":{"id":42494505,"uuid":"195897178","full_name":"selfup/gdsm","owner":"selfup","description":"Go Daemon Socket Manager - Distribute Go apps with ease","archived":false,"fork":false,"pushed_at":"2025-02-18T03:57:36.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T02:27:15.889Z","etag":null,"topics":[],"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/selfup.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}},"created_at":"2019-07-08T23:04:11.000Z","updated_at":"2025-02-18T03:57:40.000Z","dependencies_parsed_at":"2022-08-23T21:41:05.157Z","dependency_job_id":null,"html_url":"https://github.com/selfup/gdsm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/selfup/gdsm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Fgdsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Fgdsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Fgdsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Fgdsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfup","download_url":"https://codeload.github.com/selfup/gdsm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Fgdsm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267780054,"owners_count":24143201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-13T02:08:46.000Z","updated_at":"2025-07-29T23:32:43.645Z","avatar_url":"https://github.com/selfup.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitLabCI](https://gitlab.com/selfup/gdsm/badges/master/pipeline.svg)](https://gitlab.com/selfup/gdsm/pipelines)\n[![GoDoc](https://godoc.org/github.com/selfup/gdsm?status.svg)](https://godoc.org/github.com/selfup/gdsm)\n\n# GDSM (MATTD)\n\n_aka MATT (Map Active TCP Tunnels) Daemon_\n\nSimilar to [EPMD (Erlang Port Mapper Daemon)](http://erlang.org/doc/man/epmd.html) but for Go!\n\nVery much ALPHA STAGE. API is subject to change. Single Node Manager might go away and a Manager-less system might become a reality.\n\n![Screenshot from 2019-07-20 09-45-55](https://user-images.githubusercontent.com/9837366/61580072-38d7d100-aad3-11e9-93a7-04e5ec4c7e27.png)\n\n### What does this do?\n\nThis is a manager based (single node manager) solution that can help truly distributed Golang apps to exist.\n\nAny worker node you have can connect to the manager. If any other worker nodes are connected to the manager, they will be updated with the new worker in a pipe delimeted list of IPs.\n\nExample:\n\n```\n192.168.16.3:8081|192.168.16.4:8081\n```\n\nThe manager (IP/DNS name) needs to be known.\n\nIf the manager goes down, the workers will keep the same list of workers until the manager comes back up. All workers will attempt to reconnect every second.\n\nSemaphores are heavily utilized. No race conditions should occur.\n\nCan be used as a health indicator for a fleet of nodes in a cluster.\n\n### How to use?\n\n_Non blocking_\n\n```go\npackage main\n\nimport (\n  \"log\"\n  \"time\"\n\n  \"github.com/selfup/gdsm\"\n)\n\nfunc main() {\n  daemon := gdsm.BuildDaemon()\n  go gdsm.BootDaemon(daemon)\n\n  time.Sleep(2 * time.Second)\n\n  nodes := daemon.Nodes()\n  log.Println(\"nodes\", nodes)\n\n  workers := daemon.Workers()\n  log.Println(\"workers\", workers)\n\n  log.Println(\"not blocked\")\n}\n```\n\n_Blocking_\n\n```go\npackage main\n\nimport (\n  \"github.com/selfup/gdsm\"\n)\n\nfunc main() {\n  daemon := gdsm.BuildDaemon()\n  gdsm.BootDaemon(daemon)\n}\n```\n\nFor the MANAGER node, just expose an ENV: `MANAGER=true go run cmd/daemon/main.go`\n\nFor the worker nodes: `UPLINK=manager_dns_or_ip_and:port go run cmd/daemon/main.go`\n\nIf running on the same IP you will need to assign separate PORT ENVs for each process:\n\nExample (different shells/tabs/panes/terminals):\n\n```\nMANAGER=true go run cmd/daemon/main.go\nUPLINK=localhost:8081 PORT=8082 go run cmd/daemon/main.go\nUPLINK=localhost:8081 PORT=8083 go run cmd/daemon/main.go\nUPLINK=localhost:8081 PORT=8084 go run cmd/daemon/main.go\n```\n\nPlease reference the quite simple `docker-compose.yml` to understand the order and ENV variables needed.\n\nExample logs of workers and a manager booting and attaching:\n\n```\nmanager_1  | 2019/07/19 19:23:41 gdsm manager has booted..\nworkers_1  | 2019/07/19 19:23:42 gdsm worker has booted..\nworkers_1  | 2019/07/19 19:23:42 dial tcp 192.168.16.2:8081: connect: ..connected\nworkers_2  | 2019/07/19 19:24:26 gdsm worker has booted..\nworkers_2  | 2019/07/19 19:24:26 dial tcp 192.168.16.2:8081: connect: ..connected\n```\n\n### Using client/main.go to query the manager\n\n`go run cmd/client/main.go`\n\nThen ask for questions in the shell:\n\n```\n$ go run cmd/client/main.go\nworkers\n172.23.0.3:8081|172.23.0.6:8081|172.23.0.7:8081|172.23.0.9:8081\nservers\n172.23.0.3|172.23.0.6|172.23.0.7|172.23.0.9\nnodes\n172.23.0.7|172.23.0.9|172.23.0.3|172.23.0.6\nclients\n172.23.0.3:52824|172.23.0.1:34626|172.23.0.6:35436|172.23.0.7:54964|172.23.0.9:51984\n```\n\nYou may also set ENV vars for the IP and PORT as so:\n\n`IP=0.0.0.0 PORT=8081 go run cmd/client/main.go`\n\nYou can also query the workers, but typically the manager should be the only node exposed.\n\n### Registry\n\nregistry.gitlab.com\n\n### Docker Image (1.5MB)\n\nregistry.gitlab.com/selfup/gdsm:latest\n\n### Release Repo\n\nhttps://gitlab.com/selfup/gdsm\n\n### Watch\n\nYou will need `entr`\n\n`./scripts/watch.sh`\n\n### Watch, build container, and run manager/workers with docker-compose\n\nYou will need `entr`\n\n`./scripts/docker.watch.sh`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Fgdsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfup%2Fgdsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Fgdsm/lists"}