selfhosted_templates icon indicating copy to clipboard operation
selfhosted_templates copied to clipboard

[APP REQUEST]: Traefik

Open SkalCore opened this issue 4 years ago • 0 comments

Dockerhub Link:

https://hub.docker.com/_/traefik

Description

Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.

Traefik integrates with your existing infrastructure components (Docker, Swarm mode, Kubernetes, Marathon, Consul, Etcd, Rancher, Amazon ECS, ...) and configures itself automatically and dynamically.

Pointing Traefik at your orchestrator should be the only configuration step you need.

Separate Database?

no

Fill this out as best as you can. Documentation about these can be found here: https://www.portainer.io/documentation/how-to-use-templates/

version: "3.3"

services:

traefik: image: "traefik:v2.3" container_name: "traefik" command: #- "--log.level=DEBUG" - "--api.insecure=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" ports: - "80:80" - "8080:8080" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro"

whoami: image: "traefik/whoami" container_name: "simple-service" labels: - "traefik.enable=true" - "traefik.http.routers.whoami.rule=Host(whoami.localhost)" - "traefik.http.routers.whoami.entrypoints=web"

Replace whoami.localhost by your own domain within the traefik.http.routers.whoami.rule label of the whoami service. Run docker-compose up -d within the folder where you created the previous file. Wait a bit and visit http://your_own_domain to confirm everything went fine. You should see the output of the whoami service. Something similar to:

Hostname: d7f919e54651 IP: 127.0.0.1 IP: 192.168.64.2 GET / HTTP/1.1 Host: whoami.localhost User-Agent: curl/7.52.1 Accept: / Accept-Encoding: gzip X-Forwarded-For: 192.168.64.1 X-Forwarded-Host: whoami.localhost X-Forwarded-Port: 80 X-Forwarded-Proto: http X-Forwarded-Server: 7f0c797dbc51 X-Real-Ip: 192.168.64.1

SkalCore avatar Oct 25 '20 14:10 SkalCore