{"id":16307064,"url":"https://github.com/fujiwara/tuggle","last_synced_at":"2025-03-22T20:33:22.106Z","repository":{"id":57518610,"uuid":"81062622","full_name":"fujiwara/tuggle","owner":"fujiwara","description":"Distributed file mirroring proxy in Consul cluster","archived":false,"fork":false,"pushed_at":"2017-06-02T16:31:22.000Z","size":29,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T14:22:48.669Z","etag":null,"topics":["consul","deployment","go","golang","kayac","mirroring","stretcher","tuggle"],"latest_commit_sha":null,"homepage":null,"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/fujiwara.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":"2017-02-06T08:01:16.000Z","updated_at":"2023-12-13T12:18:42.000Z","dependencies_parsed_at":"2022-09-26T21:22:08.494Z","dependency_job_id":null,"html_url":"https://github.com/fujiwara/tuggle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2Ftuggle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2Ftuggle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2Ftuggle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2Ftuggle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fujiwara","download_url":"https://codeload.github.com/fujiwara/tuggle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245020147,"owners_count":20548154,"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","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":["consul","deployment","go","golang","kayac","mirroring","stretcher","tuggle"],"created_at":"2024-10-10T21:12:23.837Z","updated_at":"2025-03-22T20:33:21.763Z","avatar_url":"https://github.com/fujiwara.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tuggle\n\nDistributed file mirroring proxy in Consul cluster\n\n## Install\n\n```\ngo get -u github.com/fujiwara/tuggle\n```\n\n```\nUsage of tuggle:\n  -data-dir string\n    \tdata directory (default \"./data\")\n  -fetch-rate string\n    \tMax fetch rate limit(/sec) (default \"unlimited\")\n  -fetch-timeout string\n    \tfetch timeout (default \"10m0s\")\n  -namespace string\n    \tnamespace (default \"tuggle\")\n  -port int\n    \tlisten port (default 8900)\n  -slave\n    \tslave mode (fetch only)\n```\n\n## Getting Started\n\n### Run\n\nRun `tuggle` process in a Consul cluster. (e.g. node1, node2, node3)\n\n```\n[node{1,2,3}]$ mkdir /tmp/tuggle\n[node{1,2,3}]$ tuggle -data-dir /tmp/tuggle\n```\n\n- comunicate with consul agent via 127.0.0.1:8500.\n- store files in -data-dir.\n- listen port tcp/8900\n\n### Put file\n\ntuggle accepts files by HTTP POST method.\n\n```\n[node1]$ curl -XPUT -H\"Content-Type: application/gzip\" --data-binary @test.gz localhost:8900/test.gz\n```\n\nList stored files.\n\n```\n[node1]$ curl -s localhost:8900 | jq .\n[\n  {\n    \"id\": \"6524a9d7b3bde0f3543f1ead0ae8604f\",\n    \"name\": \"test.gz\",\n    \"content_type\": \"application/gzip\",\n    \"size\": 8764510,\n    \"created_at\": \"2017-02-13T07:46:18.809409122Z\"\n  }\n]\n```\n\nID is md5 hex of filename.\n\ntuggle will register to Consul service(name=tuggle, tag=ID).\n\n```\n$ curl -s localhost:8500/v1/catalog/service/tuggle?tag=6524a9d7b3bde0f3543f1ead0ae8604f | jq .\n[\n  {\n    \"ID\": \"ec22d2d8-0728-406b-6212-02e55c5c14a0\",\n    \"Node\": \"ip-172-31-17-183\",\n    \"Address\": \"172.31.17.183\",\n    \"TaggedAddresses\": {\n      \"lan\": \"172.31.17.183\",\n      \"wan\": \"172.31.17.183\"\n    },\n    \"NodeMeta\": {},\n    \"ServiceID\": \"tuggle\",\n    \"ServiceName\": \"tuggle\",\n    \"ServiceTags\": [\n      \"6524a9d7b3bde0f3543f1ead0ae8604f\"\n    ],\n    \"ServiceAddress\": \"\",\n    \"ServicePort\": 8900,\n    \"ServiceEnableTagOverride\": false,\n    \"CreateIndex\": 10055,\n    \"ModifyIndex\": 46156\n  }\n]\n```\n\n### Get files from other nodes\n\n```\n[node2]$ curl --head localhost:8900/test.gz\nHTTP/1.1 200 OK\nContent-Length: 8764510\nContent-Type: application/gzip\nLast-Modified: Mon, 13 Feb 2017 07:46:18 UTC\nX-Tuggle-Object-Id: 6524a9d7b3bde0f3543f1ead0ae8604f\nDate: Mon, 13 Feb 2017 07:53:46 GMT\n```\n\n```\n[node2]$ curl localhost:8900/test.gz \u003e test.gz\n[node2]$ ls -l test.gz\n-rw-rw-r-- 1 foo bar 8764510 Feb 13 07:55 test.gz\n```\n\ntuggle on node{2,3} works as below.\n- Find test.gz in data-dir\n- If it is not found\n  - Fetch test.gz from `[MD5 of filename].tuggle.service.consul`\n  - Store into data-dir.\n  - Register myself to Consul service.\n  - Serve file to http client.\n\n### Delete files\n\n```\n[node1]$ curl -X DELETE localhost:8900/test.gz\n```\n\nDELETE is enable on any nodes.\n\n## LICENSE\n\nMIT License\n\nCopyright (c) 2017 FUJIWARA Shunichiro / KAYAC Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujiwara%2Ftuggle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffujiwara%2Ftuggle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujiwara%2Ftuggle/lists"}