{"id":24374160,"url":"https://github.com/mannuelf/traefik-and-docker-vps-setup","last_synced_at":"2026-04-25T19:31:51.833Z","repository":{"id":194764835,"uuid":"691522453","full_name":"mannuelf/Traefik-and-Docker-VPS-setup","owner":"mannuelf","description":"How I host www.themwebs.me with Traefik and Docker on a single VPS and Cloudflare DNS.","archived":false,"fork":false,"pushed_at":"2025-01-31T08:05:19.000Z","size":504,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T09:19:28.914Z","etag":null,"topics":["docker","docker-compose","traefik","vps-setup"],"latest_commit_sha":null,"homepage":"https://www.themwebs.me","language":"HTML","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/mannuelf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-14T10:57:03.000Z","updated_at":"2025-01-31T08:05:22.000Z","dependencies_parsed_at":"2023-10-04T10:14:19.206Z","dependency_job_id":"fca0bd09-67d1-468c-9e02-95d7e1594ec2","html_url":"https://github.com/mannuelf/Traefik-and-Docker-VPS-setup","commit_stats":null,"previous_names":["mannuelf/them-webs-vps","mannuelf/traefik-and-docker-vps-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2FTraefik-and-Docker-VPS-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2FTraefik-and-Docker-VPS-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2FTraefik-and-Docker-VPS-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2FTraefik-and-Docker-VPS-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mannuelf","download_url":"https://codeload.github.com/mannuelf/Traefik-and-Docker-VPS-setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243207075,"owners_count":20253811,"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":["docker","docker-compose","traefik","vps-setup"],"created_at":"2025-01-19T05:26:42.287Z","updated_at":"2026-04-25T19:31:51.828Z","avatar_url":"https://github.com/mannuelf.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e This is still a fair enough approach but if you want something more automated I recommend [dokploy.com](https://dokploy.com) bare in mind it will create more containers so it will require more resources \n\n# Traefik, Docker, VPS setup\n\n[🍴 FORK repo](https://github.com/mannuelf/them-webs-vps/fork) so you get updates when they happen.\n\nSingle VPS deployment using [Traefik](https://traefik.io/traefik/).\n\nHow I host [WWW.THEMWEBS.ME](https://www.themwebs.me/) with Traefik and Docker on a single VPS and Cloudflare DNS.\n\n### Host on Hostinger \n\n[Click here](https://hostinger.com?REFERRALCODE=EJ7MANNUEKQI) (affiliate link)\n\n[Click here](https://hostinger.com) (non affiliate link)\n\n![photo1](https://res.cloudinary.com/mannuel/image/upload/v1698482073/mfcom/treafik-flow.png)\n\n## Github Action\n\n.github/workflows/deploy.yml\n\nThe repo is `rsync'ed` to the server using a Github Action.\nFollow this [guide on Zellwk blog](https://zellwk.com/blog/github-actions-deploy) to understand how it works.\n\n## Dev setup\n\n- Install [Docker](https://docs.docker.com/get-docker/)\n- Install [Docker Compose](https://docs.docker.com/compose/install/)\n\n- Each service is a docker container with its own `Dockerfile`.\n- The `docker-compose.yml` file is used to orchestrate the containers from the root of the project. You can host any kind of codebase with this.\n- `home` folder is the homepage. for this VPS. It is a static website hosted with nginx.\n- Traefik has a dashboard at `https://monitor.yourdomain.com` this is configured in `traefik_dynamic.toml` file.\n  - username: `addUserName` password: `create a hash with htpasswd`\n  - `htpasswd -nb addUserName mySecurePasswordEnteredManually`\n  - add the hash to the [traefik_dynamic.toml](./traefik_dynamic.toml) file.\n- Host your homepage in the `home` folder.\n- Traefik will route the traffic to the correct container based on the domain name / sub domain name.\n- Traefik will also automatically generate SSL certificates using [Let's Encrypt](https://letsencrypt.org/).\n- Traefik will give you a monitoring dashboard at `https://monitor.yourdomain.com` this is configured in `traefik_dynamic.toml` file.\n\nRun `docker compose up -d` in project root for the first time. This will create the network and all the containers.\n\n## Add a new service\n\n- Create a new folder in the root of the project. Add a `Dockerfile` to this new folder.\n- Update the `docker-compose.yml` with its configs, should be similar to the one in the `home` folder and home configs.\n- Google NodeJS Docker(insert favourite stack jargon) to find a nice example of NodeJS Dockerfile to build from.\n  \n  ```dockerfile\n  FROM nginx:alpine\n  COPY . /usr/share/nginx/html\n  ```\n  \n- that example will build a basic nginx container with the contents of the current folder and server a static website.\n- Push to github and the Github Action will deploy the new service to the server.\n\nlog onto server and run `docker compose up -d --build` to start the new service. (this part can also be automated with some bash script 🥸)\n\n## Run Traefik\n\nTraefik itself is also a docker container. It needs access to the docker socket to be able to listen to events and update its configuration.\n\nfor testing purpose only you can quickly run this command to see how it works. Generally always the docker compose  file will take care of this.\n\n```bash\ndocker run -d \\\n  -v /var/run/docker.sock:/var/run/docker.sock \\\n  -v $PWD/traefik.toml:/traefik.toml \\\n  -v $PWD/traefik_dynamic.toml:/traefik_dynamic.toml \\\n  -v $PWD/acme.json:/acme.json \\\n  -p 80:80 \\\n  -p 443:443 \\\n  --network web \\\n  --name traefik \\\n  traefik:latest\n```\n\n## Cloudflare DNP API (Optional)\n\nI use cloudflare as my DNS provider. To be able to update the DNS records I need to create an API token. But you can use any DNS provider\n\n\u003chttps://dash.cloudflare.com/profile/api-tokens?ref=blog.cloudflare.com\u003e\n\n\u003chttps://developers.cloudflare.com/fundamentals/api/get-started/create-token/\u003e\n\n```bash\ncurl -X GET \"https://api.cloudflare.com/client/v4/user/tokens/verify\" \\\n     -H \"Authorization: Bearer CF_DNS_API_TOKEN\" \\\n     -H \"Content-Type:application/json\"\n```\n\n## TODO\n\n- run rootless containers\n- investigate Podman for orchestration on localhost\n- add environmet variables so that you can run a local instance of the production instance.\n- make scripts automate some of the setup\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmannuelf%2Ftraefik-and-docker-vps-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmannuelf%2Ftraefik-and-docker-vps-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmannuelf%2Ftraefik-and-docker-vps-setup/lists"}