{"id":18295111,"url":"https://github.com/codesuki/ecs-gen","last_synced_at":"2025-04-05T12:31:23.343Z","repository":{"id":46685722,"uuid":"74730659","full_name":"codesuki/ecs-gen","owner":"codesuki","description":"docker-gen for AWS ECS","archived":false,"fork":false,"pushed_at":"2019-11-04T20:21:39.000Z","size":29,"stargazers_count":48,"open_issues_count":6,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-21T03:51:15.278Z","etag":null,"topics":["aws","config","config-template","container","docker","docker-gen","docker-image","ecs","elastic-container-service","template"],"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/codesuki.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":"2016-11-25T06:12:46.000Z","updated_at":"2024-03-15T16:44:30.000Z","dependencies_parsed_at":"2022-09-26T19:53:30.578Z","dependency_job_id":null,"html_url":"https://github.com/codesuki/ecs-gen","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesuki%2Fecs-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesuki%2Fecs-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesuki%2Fecs-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesuki%2Fecs-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codesuki","download_url":"https://codeload.github.com/codesuki/ecs-gen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247338755,"owners_count":20922994,"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":["aws","config","config-template","container","docker","docker-gen","docker-image","ecs","elastic-container-service","template"],"created_at":"2024-11-05T14:33:27.280Z","updated_at":"2025-04-05T12:31:18.329Z","avatar_url":"https://github.com/codesuki.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ecs-gen\n[![License](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](./LICENSE)\n[![Build Status](http://img.shields.io/travis/codesuki/ecs-gen.svg?style=flat)](https://travis-ci.org/codesuki/ecs-gen)\n\nInspired by [docker-gen](https://github.com/jwilder/docker-gen) ecs-gen lets you generate config files from templates using AWS ECS cluster information. [ecs-nginx-proxy](https://github.com/codesuki/ecs-nginx-proxy) uses ecs-gen to generate nginx config files.\n\n## Installation\n### Go\n`go get -u github.com/codesuki/ecs-gen`\n\n### Docker\nUse the `codesuki/ecs-gen` docker image.\n\n## Usage\n```\nusage: ecs-gen --cluster=CLUSTER --template=TEMPLATE --output=OUTPUT [\u003cflags\u003e]\n\ndocker-gen for AWS ECS.\n\nFlags:\n      --help                     Show context-sensitive help (also try --help-long and --help-man).\n  -r, --region=\"ap-northeast-1\"  AWS region.\n  -c, --cluster=CLUSTER          ECS cluster name.\n  -t, --template=TEMPLATE        Path to template file.\n  -o, --output=OUTPUT            Path to output file.\n      --task=\"ecs-nginx-proxy\"   Name of ECS task containing nginx.\n  -s, --signal=\"nginx -s reload\"\n                                 Command to run to signal change.\n  -f, --frequency=30             Time in seconds between polling. Must be \u003e0.\n      --once                     Only execute the template once and exit.\n      --version                  Show application version.\n```\n\n### Using with Docker\nWhen using the docker image directly you can set all parameters using environment variables:\n* ECS_GEN_REGION\n* ECS_GEN_CLUSTER\n* ECS_GEN_TEMPLATE\n* ECS_GEN_OUTPUT\n* ECS_GEN_TASK\n* ECS_GEN_SIGNAL\n* ECS_GEN_FREQUENCY\n* ECS_GEN_ONCE\n\n## Example\n### Fill a template once\nRunning the following on the commandline `ecs-gen` will query the specified cluster, execute the template and exit.\n```\necs-gen --once --region=ap-northeast-1 --cluster=\"Cluster name\" --template=template.tmpl --output=output.conf\n```\n\n\n### Continuously update a config\nTo keep a config up to date try a variation of the following.\n```\necs-gen --signal=\"nginx -s reload\" --cluster=my-cluster --template=nginx.tmpl --output=/etc/nginx/conf.d/default.conf\n```\n\n## Template parameters\nFor now the available parameters are limited to things needed to make a nginx reverse proxy. If there is demand any information available from the AWS ECS API can be exposed.\n\n```go\ntype Container struct {\n    Name    string // first host (space delimited) in VIRTUAL_HOST\n    Host    string // VIRTUAL_HOST environment variable\n    Port    string\n    Address string\n    Env     map[string]string\n}\n```\n\n**Note:** The Host field can contain more than one (space delimited) hostname - this is to allow for tasks to respond to more than one hostname (for instance, `example.com` and `www.example.com`). If using the nginx template, using the VIRTUAL_HOST string `example.com www.example.com` would result in a single upstream definition for `example.com`, and a server_name of `example.com www.example.com`, so that nginx responds to both (an advanced use case would be to use a regex definition for the second hostname).\n\n## TODO\n* Expose more information\n* Expose VIRTUAL_HOST under environment variables instead of `Host`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesuki%2Fecs-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesuki%2Fecs-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesuki%2Fecs-gen/lists"}