diff --git a/README.md b/README.md index 5abea417a..0aafdee6a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -# /Træfɪk/ +![/Træfɪk/](docs/img/traefik.logo.png "/Træfɪk/") /Træfɪk/ is a modern HTTP reverse proxy and load balancer made to deploy microservices with ease. It supports several backends (Docker, Mesos/Marathon, Consul, Etcd, Rest API, file...) to manage its configuration automatically and dynamically (hot-reload). -## Features +![Backends](docs/img/backends.png "Backends") + +# Features * No dependency hell, single binary made with go * Simple json Rest API @@ -17,14 +19,14 @@ It supports several backends (Docker, Mesos/Marathon, Consul, Etcd, Rest API, fi * SSL backends support * SSL frontend support -## Plumbing +# Plumbing -* [Oxy](https://github.com/mailgun/oxy/): an awsome proxy librarymade by Mailgun guys +* [Oxy](https://github.com/mailgun/oxy/): an awsome proxy library made by Mailgun guys * [Gorilla mux](https://github.com/gorilla/mux): famous request router * [Negroni](https://github.com/codegangsta/negroni): web middlewares made simple * [Graceful](https://github.com/tylerb/graceful): graceful shutdown of http.Handler servers -## Quick start +# Quick start * The simple way: go to the [releases](https://github.com/emilevauge/traefik/releases) page and get a binary. * Or simply execute: @@ -38,11 +40,30 @@ go get github.com/emilevauge/traefik ./traefik traefik.toml ``` -## Configuration +# Configuration -Here is a sample configuration TOML file: +## Global configuration ```toml +# traefik.toml +port = ":80" +graceTimeOut = 10 +logLevel = "DEBUG" +traefikLogsStdout = true +# traefikLogsFile = "log/traefik.log" +# accessLogsFile = "log/access.log" +# CertFile = "traefik.crt" +# KeyFile = "traefik.key" +``` + +## File backend + +Like any other reverse proxy, /Træfɪk/ can be configured with a file. You have two choices: + +* simply add your configuration at the end of the global configuration file ```traefik.tml``` : + +```toml +# traefik.toml port = ":80" graceTimeOut = 10 logLevel = "DEBUG" @@ -52,25 +73,7 @@ traefikLogsStdout = true # CertFile = "traefik.crt" # KeyFile = "traefik.key" -[web] -address = ":8080" - -# [docker] -# endpoint = "unix:///var/run/docker.sock" -# watch = true -# domain = "localhost" -# filename = "docker.tmpl" - -# [marathon] -# endpoint = "http://127.0.0.1:8080" -# networkInterface = "eth0" -# watch = true -# domain = "localhost" -# filename = "marathon.tmpl" - -# [file] -# filename = "rules.toml" -# watch = true +[file] [backends] [backends.backend1] @@ -98,3 +101,55 @@ address = ":8080" value = "/test" ``` + +* or put your configuration in a separate file, for example ```rules.tml```: + +```toml +# traefik.toml +port = ":80" +graceTimeOut = 10 +logLevel = "DEBUG" +traefikLogsStdout = true +# traefikLogsFile = "log/traefik.log" +# accessLogsFile = "log/access.log" +# CertFile = "traefik.crt" +# KeyFile = "traefik.key" + +[file] +filename = "rules.toml" +``` + +```toml +# rules.toml +[backends] + [backends.backend1] + [backends.backend1.servers.server1] + url = "http://172.17.0.2:80" + weight = 10 + [backends.backend1.servers.server2] + url = "http://172.17.0.3:80" + weight = 1 + [backends.backend2] + [backends.backend2.servers.server1] + url = "http://172.17.0.4:80" + weight = 1 + +[routes] + [routes.route1] + backend = "backend2" + [routes.route1.rules.test1] + category = "Host" + value = "test.localhost" + [routes.route2] + backend = "backend1" + [routes.route2.rules.test2] + category = "Path" + value = "/test" +``` + +If you want /Træfɪk/ to watch file changes automatically, just add: + +```toml +[file] +watch = true +``` diff --git a/ROADMAP.md b/docs/ROADMAP.md similarity index 92% rename from ROADMAP.md rename to docs/ROADMAP.md index fb6dde2f6..8b2f54167 100644 --- a/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1,5 +1,6 @@ - # /træfɪk/ +# /Træfɪk/ +* Add traefik.protocol label * Providers recovery * tls client verification * Default configuration values diff --git a/docs/img/backends.png b/docs/img/backends.png new file mode 100644 index 000000000..7e387c6bc Binary files /dev/null and b/docs/img/backends.png differ diff --git a/docs/img/traefik.logo.png b/docs/img/traefik.logo.png new file mode 100644 index 000000000..9e5c88252 Binary files /dev/null and b/docs/img/traefik.logo.png differ diff --git a/traefik.toml b/traefik.toml index bdd05ca27..84fc95dfd 100644 --- a/traefik.toml +++ b/traefik.toml @@ -2,7 +2,7 @@ port = ":8001" graceTimeOut = 10 # traefikLogsFile = "log/traefik.log" traefikLogsStdout = true -# accessLogsFile = "log/access.log" +accessLogsFile = "log/access.log" logLevel = "DEBUG" # CertFile = "traefik.crt" # KeyFile = "traefik.key" @@ -10,7 +10,7 @@ logLevel = "DEBUG" [docker] endpoint = "unix:///var/run/docker.sock" watch = true -domain = "toto.fr" +domain = "localhost" # filename = "docker.tmpl" # [marathon] @@ -23,9 +23,9 @@ domain = "toto.fr" [web] address = ":8010" -# [file] +#[file] # filename = "rules.toml" -# watch = true +watch = true [backends] [backends.backend1] @@ -37,15 +37,18 @@ address = ":8010" weight = 1 [backends.backend2] [backends.backend2.servers.server1] - url = "http://172.17.0.2:80" - weight = 100 + url = "https://www.google.fr" + weight = 1 + [backends.backend2.servers.server2] + url = "http://www.wikipedia.fr" + weight = 2 [routes] [routes.route1] backend = "backend2" [routes.route1.rules.test_zenika_1] category = "Host" - value = "test.zenika.fr" + value = "test.localhost" [routes.route2] backend = "backend1" [routes.route2.rules.test_zenika_2]