diff --git a/traefik-example/README.md b/traefik-example/README.md new file mode 100644 index 0000000..82b2c77 --- /dev/null +++ b/traefik-example/README.md @@ -0,0 +1,26 @@ +Crontab UI - Traefik Example +========== + +*Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.* + +https://containo.us/traefik/ + + + +## Running Example + +Assumes port 88 and 8088 are free. + +1. `docker-compose build` +2. `docker-compose up` + +Then go to + +- http://127.0.0.1:88/crontab to view contrab-ui +- http://127.0.0.1:88/whoami another docker container (containous/whoami) running on another path. +- http://127.0.0.1:8088/dashboard/ to view the Traefik dashbaord. + + + + + diff --git a/traefik-example/docker-compose.yml b/traefik-example/docker-compose.yml new file mode 100644 index 0000000..e58ea11 --- /dev/null +++ b/traefik-example/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3.7' +networks: + traefik_network: + +services: + proxy: + image: traefik:v2.2 + container_name: proxy + restart: unless-stopped + networks: + - traefik_network + ports: + - 88:80 + - 8088:8080 + volumes: + # So that Traefik can listen to the Docker events + - /var/run/docker.sock:/var/run/docker.sock + - ./traefik.yml:/etc/traefik/traefik.yml + command: + - "--providers.docker" + + whoami: + image: containous/whoami + networks: + - traefik_network + labels: + - traefik.enable=true + - traefik.http.routers.whoami.rule=PathPrefix(`/whoami`) + + crontab-ui: + build: .. + image: alseambusher/crontab-ui + ports: + - 8000:8000 + networks: + - traefik_network + labels: + - traefik.enable=true + - traefik.http.routers.crontab.rule=PathPrefix(`/crontab`) + environment: + BASE_URL: /crontab + BASIC_AUTH_USER: user + BASIC_AUTH_PWD: pass \ No newline at end of file diff --git a/traefik-example/traefik.yml b/traefik-example/traefik.yml new file mode 100644 index 0000000..05f57c8 --- /dev/null +++ b/traefik-example/traefik.yml @@ -0,0 +1,14 @@ +## traefik.yml + +# Docker configuration backend +providers: + docker: + # defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)" + endpoint: "unix:///var/run/docker.sock" + # swarmMode: true + network: traefik_network + exposedbydefault: false + +# API and dashboard configuration +api: + insecure: true