{"id":20443908,"url":"https://github.com/jonas-merkle/container-traefik","last_synced_at":"2025-10-15T09:44:07.239Z","repository":{"id":142777636,"uuid":"574556582","full_name":"jonas-merkle/container-traefik","owner":"jonas-merkle","description":"A Docker Compose container setup for Traefik.","archived":false,"fork":false,"pushed_at":"2025-02-15T10:12:42.000Z","size":49,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T08:25:04.171Z","etag":null,"topics":["docker-compose","traefik"],"latest_commit_sha":null,"homepage":"","language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonas-merkle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"jonas-merkle","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-12-05T15:13:03.000Z","updated_at":"2024-11-14T19:41:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6d57cab-a320-4774-a32d-c17c44d509d2","html_url":"https://github.com/jonas-merkle/container-traefik","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonas-merkle/container-traefik","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-merkle%2Fcontainer-traefik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-merkle%2Fcontainer-traefik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-merkle%2Fcontainer-traefik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-merkle%2Fcontainer-traefik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonas-merkle","download_url":"https://codeload.github.com/jonas-merkle/container-traefik/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonas-merkle%2Fcontainer-traefik/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272847119,"owners_count":25003137,"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-08-30T02:00:09.474Z","response_time":77,"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":["docker-compose","traefik"],"created_at":"2024-11-15T09:49:55.048Z","updated_at":"2025-10-15T09:44:07.115Z","avatar_url":"https://github.com/jonas-merkle.png","language":"Smarty","funding_links":["https://github.com/sponsors/jonas-merkle"],"categories":[],"sub_categories":[],"readme":"# container-traefik\n\nA Docker Compose container setup for [Traefik](https://traefik.io/).\n\n## Table of contents\n\n- [container-traefik](#container-traefik)\n  - [Table of contents](#table-of-contents)\n  - [Setup](#setup)\n    - [0. Requirements](#0-requirements)\n    - [1. Create an api key for Cloudflare](#1-create-an-api-key-for-cloudflare)\n    - [2. Fix file permissions](#2-fix-file-permissions)\n    - [3. Add environment variables](#3-add-environment-variables)\n    - [4. Generate `traefik.yml` config file from `traefik.tpl` template file](#4-generate-traefikyml-config-file-from-traefiktpl-template-file)\n    - [5. Create docker network for traefik](#5-create-docker-network-for-traefik)\n    - [6. First run](#6-first-run)\n  - [env file](#env-file)\n  - [Usage](#usage)\n    - [Start container](#start-container)\n    - [Stop container](#stop-container)\n    - [View the recent traefik logs](#view-the-recent-traefik-logs)\n    - [Use the console within the container](#use-the-console-within-the-container)\n  - [License](#license)\n\n## Setup\n\n### 0. Requirements\n\n- Docker\n- (Docker Compose)\n- htpasswd -\u003e run this to install htpasswd:\n\n    ```bash\n    sudo apt update \u0026\u0026 sudo apt install apache2-utils\n    ```\n\n- this setup assumes that [Cloudflare](https://www.cloudflare.com/) is the DNS provider for your domain.\n\n### 1. Create an api key for Cloudflare\n\n- Go to [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens)\n- Click on `Generate new Token`\n- Use the `Zone-DNS edit` template\n- Set a meaningfull name like `traefik @ docker01`\n- Make sure that there is a permission: `Zone - DNS - Edit`\n- Add the permission: `Zone - Zone - Read`\n- Add the zone ressource: `Add - All Zones`\n- Leave the ttl empty\n- Create the token\n\n### 2. Fix file permissions\n\n```bash\nchmod +x init.sh\nchmod 600 ./config/certs/acme.json\n```\n\n### 3. Add environment variables\n\nAdd the missing information for the environment variables:\n\n```bash\nnano .env\n```\n\nUse the following command to create a username-password string:\n\n```bash\necho $(htpasswd -nb \u003cuser\u003e '\u003cpassword\u003e')\n```\n\nMark the `.env` file so it's not tracked by git:\n\n```bash\ngit update-index --assume-unchanged .env\ngit update-index --assume-unchanged config/certs/acme.json\n```\n\n### 4. Generate `traefik.yml` config file from `traefik.tpl` template file\n\n```bash\n./init.sh\n````\n\n### 5. Create docker network for traefik\n\n```bash\ndocker network create traefik-net\n```\n\n### 6. First run\n\n1. Generate the crowdsec bouncer key:\n   - start the container for the first time. wait some time before proceeding\n   - execute the following command to get the crowdsec bouncer key:\n\n        ```bash\n        docker compose exec -t crowdsec-server cscli bouncers add bouncer-traefik\n        ```\n\n   - use the output and add it to the `.env` file in the section `TRAEFIK_CONT_BOUNCER_KEY`\n   - restart the container\n\n2. enable crowdsec auto collection update via cron\n\n   - run the following command to edit the cron entries:\n\n        ```bash\n        sudo crontab -e\n        ````\n\n   - And add this line:\n\n        ```txt\n        0 * * * * docker exec crowdsec cscli hub update \u0026\u0026 docker exec crowdsec-server cscli hub upgrade\n        ```\n\n3. add the crowdsec instance to the [crowdsec dashboard](https://app.crowdsec.net/)\n\n   - login to the crowdsec dashboard\n   - click on add instance\n   - copy the key and run this command:\n\n        ```bash\n        docker exec crowdsec-server cscli console enroll \u003ckey\u003e\n        ```\n\n## env file\n\nthe .env file must include the following values:\n\n```text\nTRAEFIK_CONT_CF_DNS_API_TOKEN=\"\"\nTRAEFIK_CONT_ACME_EMAIL=\"\"\nTRAEFIK_CONT_MAIN_URL=\"\"\nTRAEFIK_CONT_SANS_URL=\"\"\nTRAEFIK_CONT_WEB_UI_URL=\"\"\nTRAEFIK_CONT_BASIC_AUTH=\"\"\nTRAEFIK_CONT_BOUNCER_KEY=\"\"\n```\n\n- TRAEFIK_CONT_CF_DNS_API_TOKEN\n    This var must contain the api token created in [4. Create an api key for Cloudflare](#4-create-an-api-key-for-cloudflare)\n- TRAEFIK_CONT_ACME_EMAIL\n    The email wich should be associated with the let's encrypt registration. e.g.: [info@example.com](mailto:info@example.com)\n- TRAEFIK_CONT_MAIN_URL\n    The main tld. e.g.: [example.com](https://example.com)\n- TRAEFIK_CONT_SANS_URL\n    A list of subdomains secured by this traefik instance. e.g.: [\\*.example.com](https://*.example.com),[\\*.host.example.com](https://*.host.example.comm)\n- TRAEFIK_CONT_WEB_UI_URL\n    The domain for the traefik web ui. e.g.: [traefik.host.example.com](https://traefik.host.example.com)\n- TRAEFIK_CONT_BASIC_AUTH\n    The user config create with this command `echo $(htpasswd -nb \u003cuser\u003e '\u003cpassword\u003e')`\n- TRAEFIK_CONT_BOUNCER_KEY\n    This var must contain the api token created in [6. First run](#6-first-run)\n\n## Usage\n\n### Start container\n\n```bash\ndocker compose up -d\n````\n\n### Stop container\n\n```bash\ndocker compose down\n```\n\n### View the recent traefik logs\n\n```bash\ndocker exec traefik-server cat /var/log/traefik/traefik.log\n```\n\n### Use the console within the container\n\n```bash\ndocker exec -it traefik-server /bin/sh\n```\n\n## License\n\nThis project is licensed under the [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.html) (LGPLv3). You are free to use, modify, and distribute this software under the terms specified in the LGPLv3.\n\nSee the [LICENSE](./LICENSE) file for more detailed information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas-merkle%2Fcontainer-traefik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonas-merkle%2Fcontainer-traefik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonas-merkle%2Fcontainer-traefik/lists"}