{"id":23501222,"url":"https://github.com/zekker6/hosts-generator","last_synced_at":"2026-04-26T13:04:14.738Z","repository":{"id":37101948,"uuid":"294793006","full_name":"zekker6/hosts-generator","owner":"zekker6","description":"Tool which is able to generate hosts file content for services discovered from different sources","archived":false,"fork":false,"pushed_at":"2025-04-15T06:39:44.000Z","size":302,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T07:34:53.526Z","etag":null,"topics":["caddy","dns","docker","kubernetes","networking","routing","traefik"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zekker6.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-09-11T19:17:04.000Z","updated_at":"2025-04-15T06:39:47.000Z","dependencies_parsed_at":"2023-12-14T00:26:03.889Z","dependency_job_id":"46087b0f-562f-49ee-8071-cbacefb33a17","html_url":"https://github.com/zekker6/hosts-generator","commit_stats":{"total_commits":78,"total_committers":4,"mean_commits":19.5,"dds":"0.23076923076923073","last_synced_commit":"69058d456311abf9adce49fe74efebd96be83f46"},"previous_names":["zekker6/traefik-hosts-generator"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekker6%2Fhosts-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekker6%2Fhosts-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekker6%2Fhosts-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zekker6%2Fhosts-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zekker6","download_url":"https://codeload.github.com/zekker6/hosts-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249140666,"owners_count":21219332,"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":["caddy","dns","docker","kubernetes","networking","routing","traefik"],"created_at":"2024-12-25T07:13:41.655Z","updated_at":"2026-03-14T08:06:45.168Z","avatar_url":"https://github.com/zekker6.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hosts generator\n\nA small tool which is able to generate hosts file content for services discovered from different sources:\n* [Traefik](https://traefik.io)\n* Kubernetes\n* [Caddy](https://caddyserver.com/)\n\nAvailable as docker image:\n- v0.6.0+ published [here](https://github.com/zekker6/hosts-generator/pkgs/container/hosts-generator)\n- previous versions published [here](https://github.com/users/zekker6/packages/container/package/traefik-hosts-generator)\n\n# Usage\n\nInitially it was developed to enhance local development toolchain which helps to work on several projects at the same time. Workflow suggested having multiple docker-compose apps running and having Traefik as reverse-proxy with dynamic discovery over docker socket.\n\nExample config:\n```yaml\n\nversion: \"3\"\n\nservices:\n  traefik:\n    image: traefik:v3.0.1\n    restart: unless-stopped\n    labels:\n      traefik.port: 8080\n    volumes:\n      - \"./traefik.toml:/etc/traefik/traefik.toml\"\n      - \"/var/run/docker.sock:/var/run/docker.sock\"\n    ports:\n      - \"80:80\"\n    networks:\n      - tk_web\n\n  tk-hosts:\n    image: ghcr.io/zekker6/hosts-generator:v1.0.1\n    restart: unless-stopped\n    volumes:\n      - /etc/hosts:/hosts\n    command: \"-platform=linux -traefikUrl=http://traefik:8080/api -file=/hosts -watch=true -freq=10\"\n    networks:\n      - tk_web\n    depends_on:\n      - traefik\n\nnetworks:\n  tk_web:\n    external: true\n```\n\nThis config will use external network `tk_web` to establish communication with application container.\nIt is needed to add this network to all containers which will be connected via Traefik.\n\nYou can create this network with the following command:\n\n```sh\ndocker network create tk_web\n```\n\nFully working example can be found at [examples folder](example/).\n\n## Command line flags\n\nCLI flags will allow to override default behaviour such as line endings for different host operating systems(useful when using docker image), changing generated block postfix(to allow using several concurrent instances of traefik generator).\n\n```\n  -caddyURL string\n        specify custom caddy API url, example: 'http://127.0.0.1:2019/config/'\n  -file string\n        specify custom hosts file location, example: '/etc/hosts_custom' (default \"/etc/hosts\")\n  -freq int\n        poll every N seconds (default 5)\n  -ip string\n        specify custom ip to use in hosts file, example: '192.168.33.10' (default \"127.0.0.1\")\n  -kubeconfig string\n        specify full path to kubeconfig (default \"/home/zekker/.kube/config\")\n  -platform string\n        change line-endings style for hosts file, default: '', available: darwin, windows, linux\n  -postfix string\n        use unique postfix if 2 parallel instances are running\n  -quiet\n        disable logging\n  -skipWildcard\n        remove wildcard entries in hosts file. Not all DNS servers support wildcard entries, so this option can be used to filter out unsupported entries.\n  -traefikUrl string\n        specify custom traefik API url, example: 'http://127.0.0.1:8080/api' (default \"http://localhost:8080/api\")\n  -watch\n        enable API polling mode: true/false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekker6%2Fhosts-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzekker6%2Fhosts-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekker6%2Fhosts-generator/lists"}