Træfik theory

Compose

Docker layout

Manage multiple containers

One file

Better than use only commands

Træfik

Emile Vauge

Written in GO

Works fine with Docker

Easy to use

French Quality

    traefik:
        image: traefik:latest
        command: --api.insecure=true --providers.docker
        ports:
          - 80:80
          - 443:443
          - 8080:8080
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
        <<: *network
    webserver:
        image: eu.gcr.io/quotatis-152617/nginx:develop
        container_name: pro-api_webserver
        working_dir: /srv/app
        networks:
            - default
        depends_on:
            - postgresql
        volumes:
            - .:/srv/app
            - ./docker/nginx/local.conf:/etc/nginx/conf.d/default.conf
            - ./var/ssl:/srv/app/var/ssl:ro
        labels:
            - traefik.http.routers.webserver-pro-api.rule=Host(`pro-api-dev.qarx.io`)
        <<: *network

Pro API sample

    webserver:
        #...
        labels:
            #...
            - traefik.http.routers.webserver-pro-api.rule=Host(`pro-api-dev.qarx.io`)
            - traefik.http.services.webserver-pro-api.loadbalancer.server.port=8080

Pro API sample

[providers.docker]
  endpoint = "unix:///var/run/docker.sock"

[api]
  insecure = true
  dashboard = true
  debug = true

[entryPoints.web]
  address = ":80"
  [entryPoints.web.http]
    [entryPoints.web.http.redirections]
      [entryPoints.web.http.redirections.entryPoint]
        to = "web-secure"
        scheme = "https"

[entryPoints.web-secure]
  address = ":443"

[accessLog]
  filePath = "/var/log/traefik/access.log"
    traefik:
        image: traefik:latest
        ports:
            - 80:80
            - 443:443
            - 8080:8080
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - ./traefik.toml:/traefik.toml
        <<*networks
    webserver:
        #...
        labels:
            #...
            - traefik.http.routers.webserver-pro-api.entrypoints=web-secure
            - traefik.http.routers.webserver-pro-api.tls=true

Pro API sample

What's next?

Replace all dns with port to only dns

Traefik theory

By darkweak

Traefik theory

  • 387