From c719aa3db888598181753657ca7c8f4de4b042e1 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Mon, 11 Jul 2016 12:36:35 +0100 Subject: [PATCH 01/10] Fix default etcd port Fixes #508 --- configuration.go | 2 +- docs/toml.md | 2 +- examples/compose-etcd.yml | 2 +- examples/etcd-config.sh | 32 +++++++++++++-------------- integration/etcd_test.go | 2 +- integration/fixtures/etcd/simple.toml | 4 ++-- traefik.sample.toml | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/configuration.go b/configuration.go index 4dfa40115..a30e66e11 100644 --- a/configuration.go +++ b/configuration.go @@ -251,7 +251,7 @@ func NewTraefikDefaultPointersConfiguration() *TraefikConfiguration { // default Etcd var defaultEtcd provider.Etcd defaultEtcd.Watch = true - defaultEtcd.Endpoint = "127.0.0.1:400" + defaultEtcd.Endpoint = "127.0.0.1:2379" defaultEtcd.Prefix = "/traefik" defaultEtcd.Constraints = []types.Constraint{} diff --git a/docs/toml.md b/docs/toml.md index b3106aacf..b95646072 100644 --- a/docs/toml.md +++ b/docs/toml.md @@ -793,7 +793,7 @@ Træfɪk can be configured to use Etcd as a backend configuration: # # Required # -endpoint = "127.0.0.1:4001" +endpoint = "127.0.0.1:2379" # Enable watch Etcd changes # diff --git a/examples/compose-etcd.yml b/examples/compose-etcd.yml index 62df465d3..83ba52f72 100644 --- a/examples/compose-etcd.yml +++ b/examples/compose-etcd.yml @@ -1,4 +1,4 @@ etcd: image: gcr.io/google_containers/etcd:2.2.1 net: host - command: ['/usr/local/bin/etcd', '--addr=127.0.0.1:4001', '--bind-addr=0.0.0.0:4001', '--data-dir=/var/etcd/data'] \ No newline at end of file + command: ['/usr/local/bin/etcd', '--addr=127.0.0.1:2379', '--bind-addr=0.0.0.0:2379', '--data-dir=/var/etcd/data'] diff --git a/examples/etcd-config.sh b/examples/etcd-config.sh index 648ad970b..6515f9b76 100755 --- a/examples/etcd-config.sh +++ b/examples/etcd-config.sh @@ -1,25 +1,25 @@ #!/bin/sh # backend 1 -curl -i -H "Accept: application/json" -X PUT -d value="NetworkErrorRatio() > 0.5" http://localhost:4001/v2/keys/traefik/backends/backend1/circuitbreaker/expression -curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.2:80" http://localhost:4001/v2/keys/traefik/backends/backend1/servers/server1/url -curl -i -H "Accept: application/json" -X PUT -d value="10" http://localhost:4001/v2/keys/traefik/backends/backend1/servers/server1/weight -curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.3:80" http://localhost:4001/v2/keys/traefik/backends/backend1/servers/server2/url -curl -i -H "Accept: application/json" -X PUT -d value="1" http://localhost:4001/v2/keys/traefik/backends/backend1/servers/server2/weight +curl -i -H "Accept: application/json" -X PUT -d value="NetworkErrorRatio() > 0.5" http://localhost:2379/v2/keys/traefik/backends/backend1/circuitbreaker/expression +curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.2:80" http://localhost:2379/v2/keys/traefik/backends/backend1/servers/server1/url +curl -i -H "Accept: application/json" -X PUT -d value="10" http://localhost:2379/v2/keys/traefik/backends/backend1/servers/server1/weight +curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.3:80" http://localhost:2379/v2/keys/traefik/backends/backend1/servers/server2/url +curl -i -H "Accept: application/json" -X PUT -d value="1" http://localhost:2379/v2/keys/traefik/backends/backend1/servers/server2/weight # backend 2 -curl -i -H "Accept: application/json" -X PUT -d value="drr" http://localhost:4001/v2/keys/traefik/backends/backend2/loadbalancer/method -curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.4:80" http://localhost:4001/v2/keys/traefik/backends/backend2/servers/server1/url -curl -i -H "Accept: application/json" -X PUT -d value="1" http://localhost:4001/v2/keys/traefik/backends/backend2/servers/server1/weight -curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.5:80" http://localhost:4001/v2/keys/traefik/backends/backend2/servers/server2/url -curl -i -H "Accept: application/json" -X PUT -d value="2" http://localhost:4001/v2/keys/traefik/backends/backend2/servers/server2/weight +curl -i -H "Accept: application/json" -X PUT -d value="drr" http://localhost:2379/v2/keys/traefik/backends/backend2/loadbalancer/method +curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.4:80" http://localhost:2379/v2/keys/traefik/backends/backend2/servers/server1/url +curl -i -H "Accept: application/json" -X PUT -d value="1" http://localhost:2379/v2/keys/traefik/backends/backend2/servers/server1/weight +curl -i -H "Accept: application/json" -X PUT -d value="http://172.17.0.5:80" http://localhost:2379/v2/keys/traefik/backends/backend2/servers/server2/url +curl -i -H "Accept: application/json" -X PUT -d value="2" http://localhost:2379/v2/keys/traefik/backends/backend2/servers/server2/weight # frontend 1 -curl -i -H "Accept: application/json" -X PUT -d value="backend2" http://localhost:4001/v2/keys/traefik/frontends/frontend1/backend -curl -i -H "Accept: application/json" -X PUT -d value="http" http://localhost:4001/v2/keys/traefik/frontends/frontend1/entrypoints -curl -i -H "Accept: application/json" -X PUT -d value="Host:test.localhost" http://localhost:4001/v2/keys/traefik/frontends/frontend1/routes/test_1/rule +curl -i -H "Accept: application/json" -X PUT -d value="backend2" http://localhost:2379/v2/keys/traefik/frontends/frontend1/backend +curl -i -H "Accept: application/json" -X PUT -d value="http" http://localhost:2379/v2/keys/traefik/frontends/frontend1/entrypoints +curl -i -H "Accept: application/json" -X PUT -d value="Host:test.localhost" http://localhost:2379/v2/keys/traefik/frontends/frontend1/routes/test_1/rule # frontend 2 -curl -i -H "Accept: application/json" -X PUT -d value="backend1" http://localhost:4001/v2/keys/traefik/frontends/frontend2/backend -curl -i -H "Accept: application/json" -X PUT -d value="http" http://localhost:4001/v2/keys/traefik/frontends/frontend2/entrypoints -curl -i -H "Accept: application/json" -X PUT -d value="Path:/test" http://localhost:4001/v2/keys/traefik/frontends/frontend2/routes/test_2/rule +curl -i -H "Accept: application/json" -X PUT -d value="backend1" http://localhost:2379/v2/keys/traefik/frontends/frontend2/backend +curl -i -H "Accept: application/json" -X PUT -d value="http" http://localhost:2379/v2/keys/traefik/frontends/frontend2/entrypoints +curl -i -H "Accept: application/json" -X PUT -d value="Path:/test" http://localhost:2379/v2/keys/traefik/frontends/frontend2/routes/test_2/rule diff --git a/integration/etcd_test.go b/integration/etcd_test.go index 316d989b3..4698e7729 100644 --- a/integration/etcd_test.go +++ b/integration/etcd_test.go @@ -30,7 +30,7 @@ func (s *EtcdSuite) SetUpSuite(c *check.C) { s.composeProject.Start(c) etcd.Register() - url := s.composeProject.Container(c, "etcd").NetworkSettings.IPAddress + ":4001" + url := s.composeProject.Container(c, "etcd").NetworkSettings.IPAddress + ":2379" kv, err := libkv.NewStore( store.ETCD, []string{url}, diff --git a/integration/fixtures/etcd/simple.toml b/integration/fixtures/etcd/simple.toml index bbc35e3c6..d3180c30a 100644 --- a/integration/fixtures/etcd/simple.toml +++ b/integration/fixtures/etcd/simple.toml @@ -8,9 +8,9 @@ logLevel = "DEBUG" [etcd] - endpoint = "{{.EtcdHost}}:4001" + endpoint = "{{.EtcdHost}}:2379" prefix = "/traefik" watch = true [web] - address = ":8081" \ No newline at end of file + address = ":8081" diff --git a/traefik.sample.toml b/traefik.sample.toml index 88f610cad..55ec2556b 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -405,7 +405,7 @@ # # Required # -# endpoint = "127.0.0.1:4001" +# endpoint = "127.0.0.1:2379" # Enable watch Etcd changes # @@ -545,4 +545,4 @@ # [frontends.frontend3] # entrypoints = ["http", "https"] # overrides defaultEntryPoints # backend = "backend2" -# rule = "Path: /test, /other" \ No newline at end of file +# rule = "Path: /test, /other" From c98a56172218812121cc0e1a4ed91c7f7faff2ae Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Wed, 13 Jul 2016 17:49:00 +0200 Subject: [PATCH 02/10] Fix GraceTimeOut flag description Signed-off-by: Emile Vauge --- configuration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration.go b/configuration.go index 4dfa40115..5b55e4370 100644 --- a/configuration.go +++ b/configuration.go @@ -20,7 +20,7 @@ type TraefikConfiguration struct { // GlobalConfiguration holds global configuration (with providers, etc.). // It's populated from the traefik configuration file passed as an argument to the binary. type GlobalConfiguration struct { - GraceTimeOut int64 `short:"g" description:"Configuration file to use (TOML)."` + GraceTimeOut int64 `short:"g" description:"Duration to give active requests a chance to finish during hot-reload"` Debug bool `short:"d" description:"Enable debug mode"` AccessLogsFile string `description:"Access logs file"` TraefikLogsFile string `description:"Traefik logs file"` From 24d3a698a042bee0f8eecb9b8ac2f73c9ceb13bd Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Mon, 11 Jul 2016 16:43:23 +0200 Subject: [PATCH 03/10] Fix acme checkOnDemandDomain Signed-off-by: Emile Vauge --- server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 89bf6d4d3..6f9c6ff9e 100644 --- a/server.go +++ b/server.go @@ -299,7 +299,10 @@ func (server *Server) createTLSConfig(entryPointName string, tlsOption *TLS, rou if _, ok := server.serverEntryPoints[server.globalConfiguration.ACME.EntryPoint]; ok { if entryPointName == server.globalConfiguration.ACME.EntryPoint { checkOnDemandDomain := func(domain string) bool { - if router.GetHandler().Match(&http.Request{URL: &url.URL{}, Host: domain}, &mux.RouteMatch{}) { + routeMatch := &mux.RouteMatch{} + router := router.GetHandler() + match := router.Match(&http.Request{URL: &url.URL{}, Host: domain}, routeMatch) + if match && routeMatch.Route != nil { return true } return false From bd29bac716ccc06ba97856ed84994546a69a8aff Mon Sep 17 00:00:00 2001 From: Jsewill Date: Thu, 14 Jul 2016 03:22:18 -0500 Subject: [PATCH 04/10] Update server.go Fixed a bug that caused a panic when sending multiple signals: signals are no longer sent on the server.signals channel after it has closed. --- server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server.go b/server.go index 6f9c6ff9e..c2d0e63f3 100644 --- a/server.go +++ b/server.go @@ -108,6 +108,7 @@ func (server *Server) Close() { server.routinesPool.Stop() close(server.configurationChan) close(server.configurationValidatedChan) + signal.Stop(server.signals) close(server.signals) close(server.stopChan) server.loggerMiddleware.Close() From 3c5cb3177521a225d39d96918e69598cc8c0e19f Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Wed, 13 Jul 2016 19:05:30 +0200 Subject: [PATCH 05/10] default values logs from WARN to DEBUG Signed-off-by: Emile Vauge --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index 89bf6d4d3..a1e83acc3 100644 --- a/server.go +++ b/server.go @@ -184,7 +184,7 @@ func (server *Server) defaultConfigurationValues(configuration *types.Configurat for backendName, backend := range configuration.Backends { _, err := types.NewLoadBalancerMethod(backend.LoadBalancer) if err != nil { - log.Warnf("Error loading load balancer method '%+v' for backend %s: %v. Using default wrr.", backend.LoadBalancer, backendName, err) + log.Debugf("Error loading load balancer method '%+v' for backend %s: %v. Using default wrr.", backend.LoadBalancer, backendName, err) backend.LoadBalancer = &types.LoadBalancer{Method: "wrr"} } } From bf95e6def9e20524fccc6f359ac4e2e57014e69f Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Sun, 17 Jul 2016 15:14:07 +0200 Subject: [PATCH 06/10] Add deploy-pr on non master branch Signed-off-by: Emile Vauge --- script/deploy-pr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/deploy-pr.sh b/script/deploy-pr.sh index 7fd79407c..ed818a2da 100755 --- a/script/deploy-pr.sh +++ b/script/deploy-pr.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -if ([ "$TRAVIS_BRANCH" = "master" ] && [ -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$DOCKER_VERSION" = "1.10.1" ]; then +if ([ -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$DOCKER_VERSION" = "1.10.1" ]; then echo "Deploying PR..." else echo "Skipping deploy PR" From 516608d8830ab537f1fc4868e2c0efb4f33b8812 Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Wed, 13 Jul 2016 17:54:18 +0200 Subject: [PATCH 07/10] Bump containous/oxy version with SSE support Signed-off-by: Emile Vauge --- glide.lock | 139 ++++++++++++++++++++++++++++++++++++++++++++--------- glide.yaml | 2 +- 2 files changed, 118 insertions(+), 23 deletions(-) diff --git a/glide.lock b/glide.lock index c2c0495a3..04fedd331 100644 --- a/glide.lock +++ b/glide.lock @@ -1,10 +1,10 @@ -hash: 22c20a7d7419e9624267d7f0041cd8ad87afc876d2738fa559527c74f9917c3a -updated: 2016-07-05T14:48:30.023831407+02:00 +hash: 234c57cf3696be155463b9a92cd8d104bb52c16c821b64dd24d8d88097d80dd8 +updated: 2016-07-18T17:58:15.732937572+02:00 imports: - name: github.com/boltdb/bolt - version: 3f7947a25d970e1e5f512276c14d5dcf731ccd5e + version: acc803f0ced151102ed51bf824f8709ebd6602bc - name: github.com/BurntSushi/toml - version: f0aeabca5a127c4078abb8c8d64298b147264b55 + version: 99064174e013895bbd9b025c31100bd1d9b590ca - name: github.com/BurntSushi/ty version: 6add9cd6ad42d389d6ead1dde60b4ad71e46fd74 subpackages: @@ -12,11 +12,11 @@ imports: - name: github.com/cenkalti/backoff version: cdf48bbc1eb78d1349cbda326a4a037f7ba565c6 - name: github.com/codahale/hdrhistogram - version: 9208b142303c12d8899bae836fd524ac9338b4fd + version: f8ad88b59a584afeee9d334eff879b104439117b - name: github.com/codegangsta/cli - version: bf4a526f48af7badd25d2cb02d587e1b01be3b50 + version: 1efa31f08b9333f1bd4882d61f9d668a70cd902e - name: github.com/codegangsta/negroni - version: dcaac9107a7a6ba4cf5143afc145e2b70a1c12c2 + version: dc6b9d037e8dab60cbfc09c61d6932537829be8b - name: github.com/containous/flaeg version: b98687da5c323650f4513fda6b6203fcbdec9313 - name: github.com/containous/mux @@ -24,10 +24,8 @@ imports: - name: github.com/containous/staert version: e2aa88e235a02dd52aa1d5d9de75f9d9139d1602 - name: github.com/coreos/etcd - version: c400d05d0aa73e21e431c16145e558d624098018 + version: 1c9e0a0e33051fed6c05c141e6fcbfe5c7f2a899 subpackages: - - Godeps/_workspace/src/github.com/ugorji/go/codec - - Godeps/_workspace/src/golang.org/x/net/context - client - pkg/pathutil - pkg/types @@ -36,14 +34,67 @@ imports: subpackages: - spew - name: github.com/docker/distribution - version: 4e17ab5d319ac5b70b2769442947567a83386fbc + version: f8083b7ff32b224921c5f66c0f4df3e58dab49f5 subpackages: - reference - digest + - registry/api/errcode + - registry/client/auth + - registry/client/transport + - registry/client + - context + - registry/api/v2 + - registry/storage/cache + - registry/storage/cache/memory + - uuid - name: github.com/docker/docker version: 9837ec4da53f15f9120d53a6e1517491ba8b0261 subpackages: - namesgenerator + - pkg/namesgenerator + - pkg/random + - cliconfig + - cliconfig/configfile + - pkg/jsonmessage + - pkg/promise + - pkg/stdcopy + - pkg/term + - reference + - registry + - runconfig/opts + - pkg/homedir + - pkg/jsonlog + - pkg/system + - pkg/term/windows + - image + - image/v1 + - pkg/ioutils + - opts + - pkg/httputils + - pkg/mflag + - pkg/stringid + - pkg/tarsum + - pkg/mount + - pkg/signal + - pkg/urlutil + - builder + - builder/dockerignore + - pkg/archive + - pkg/fileutils + - pkg/progress + - pkg/streamformatter + - layer + - pkg/longpath + - api/types/backend + - pkg/chrootarchive + - pkg/gitutils + - pkg/symlink + - pkg/idtools + - pkg/pools + - daemon/graphdriver + - pkg/reexec + - pkg/plugins + - pkg/plugins/transport - name: github.com/docker/engine-api version: 3d3d0b6c9d2651aac27f416a6da0224c1875b3eb subpackages: @@ -51,10 +102,10 @@ imports: - types - types/events - types/filters - - client/transport - - client/transport/cancellable - types/container - types/network + - client/transport + - client/transport/cancellable - types/reference - types/registry - types/time @@ -71,6 +122,20 @@ imports: version: f2d77a61e3c169b43402a0a1e84f06daf29b8190 - name: github.com/docker/libcompose version: 8ee7bcc364f7b8194581a3c6bd9fa019467c7873 + subpackages: + - docker + - project + - project/events + - project/options + - config + - docker/builder + - docker/client + - labels + - logger + - lookup + - utils + - yaml + - version - name: github.com/docker/libkv version: 35d3e2084c650109e7bcc7282655b1bc8ba924ff subpackages: @@ -94,7 +159,7 @@ imports: - name: github.com/gorilla/context version: aed02d124ae4a0e94fea4541c8effd05bf0c8296 - name: github.com/hashicorp/consul - version: 6e061b2d580d80347b7c5c4dfc8730de7403a145 + version: 548fb6eb3f407147e20d923521296e0500f57ef0 subpackages: - api - name: github.com/hashicorp/go-cleanhttp @@ -106,8 +171,12 @@ imports: - serf - name: github.com/libkermit/docker version: 3b5eb2973efff7af33cfb65141deaf4ed25c6d02 + subpackages: + - compose - name: github.com/libkermit/docker-check version: bb75a86b169c6c5d22c0ee98278124036f272d7b + subpackages: + - compose - name: github.com/mailgun/manners version: fada45142db3f93097ca917da107aa3fad0ffcb5 - name: github.com/mailgun/timetools @@ -123,7 +192,7 @@ imports: - name: github.com/ogier/pflag version: 45c278ab3607870051a2ea9040bb85fcb8557481 - name: github.com/opencontainers/runc - version: 7221e387826c9918fa9fd6e7975baf4d30c8fa54 + version: 1b49d9b4db3fe7ffbe53698a79124e7b4aa78180 subpackages: - libcontainer/user - name: github.com/parnurzeal/gorequest @@ -139,7 +208,7 @@ imports: subpackages: - zk - name: github.com/Sirupsen/logrus - version: f3cfb454f4c209e6668c95216c4744b8fddb2356 + version: a283a10442df8dc09befd873fab202bf8a253d6a - name: github.com/streamrail/concurrent-map version: 65a174a3a4188c0b7099acbc6cfa0c53628d3287 - name: github.com/stretchr/objx @@ -151,6 +220,10 @@ imports: - assert - name: github.com/thoas/stats version: 69e3c072eec2df2df41afe6214f62eb940e4cd80 +- name: github.com/ugorji/go + version: b94837a2404ab90efe9289e77a70694c355739cb + subpackages: + - codec - name: github.com/unrolled/render version: 198ad4d8b8a4612176b804ca10555b222a086b40 - name: github.com/vdemeester/docker-events @@ -158,7 +231,7 @@ imports: - name: github.com/vdemeester/shakers version: 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3 - name: github.com/vulcand/oxy - version: 8d476862d38b9be356eaa83b5712cad561be08a1 + version: ab7796d7036b425fbc945853cd1b7e7adf43b0d6 repo: https://github.com/containous/oxy.git vcs: git subpackages: @@ -174,7 +247,7 @@ imports: - name: github.com/vulcand/route version: cb89d787ddbb1c5849a7ac9f79004c1fd12a4a32 - name: github.com/vulcand/vulcand - version: 42492a3a85e294bdbdd1bcabb8c12769a81ea284 + version: 28a4e5c0892167589737b95ceecbcef00295be50 subpackages: - plugin/rewrite - plugin @@ -185,17 +258,17 @@ imports: subpackages: - acme - name: golang.org/x/crypto - version: 0c565bf13221fb55497d7ae2bb95694db1fd1bff + version: f28b56427a527c2e35c0bcac123f0a6a8a943cd3 subpackages: - ocsp - name: golang.org/x/net - version: 6460565bec1e8891e29ff478184c71b9e443ac36 + version: b400c2eff1badec7022a8c8f5bea058b6315eed7 subpackages: - context - publicsuffix - proxy - name: golang.org/x/sys - version: eb2c74142fd19a79b3f237334c7384d5167b1b46 + version: 62bee037599929a6e9146f29d10dd5208c43507d subpackages: - unix - windows @@ -210,4 +283,26 @@ imports: subpackages: - cipher - json -devImports: [] +testImports: +- name: github.com/Azure/go-ansiterm + version: fa152c58bc15761d0200cb75fe958b89a9d4888e + subpackages: + - winterm +- name: github.com/cloudfoundry-incubator/candiedyaml + version: 99c3df83b51532e3615f851d8c2dbb638f5313bf +- name: github.com/flynn/go-shlex + version: 3f9db97f856818214da2e1057f8ad84803971cff +- name: github.com/gorilla/mux + version: 9fa818a44c2bf1396a17f9d5a3c0f6dd39d2ff8e +- name: github.com/vbatts/tar-split + version: 28bc4c32f9fa9725118a685c9ddd7ffdbdbfe2c8 + subpackages: + - tar/asm + - tar/storage + - archive/tar +- name: github.com/xeipuuv/gojsonpointer + version: e0fe6f68307607d540ed8eac07a342c33fa1b54a +- name: github.com/xeipuuv/gojsonreference + version: e02fc20de94c78484cd5ffb007f8af96be030a45 +- name: github.com/xeipuuv/gojsonschema + version: 66a3de92def23708184148ae337750915875e7c1 diff --git a/glide.yaml b/glide.yaml index 3ca211d25..38166363f 100644 --- a/glide.yaml +++ b/glide.yaml @@ -10,7 +10,7 @@ import: - package: github.com/containous/flaeg version: b98687da5c323650f4513fda6b6203fcbdec9313 - package: github.com/vulcand/oxy - version: 8d476862d38b9be356eaa83b5712cad561be08a1 + version: ab7796d7036b425fbc945853cd1b7e7adf43b0d6 repo: https://github.com/containous/oxy.git vcs: git subpackages: From d1b5cf99d0a2e20696b2a5f8e7b5411ee2ccf30b Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Wed, 13 Jul 2016 17:50:57 +0200 Subject: [PATCH 08/10] Add GraceTimeOut support Signed-off-by: Emile Vauge --- server.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index a1e83acc3..f9fbae66b 100644 --- a/server.go +++ b/server.go @@ -7,6 +7,7 @@ import ( "crypto/tls" "encoding/json" "errors" + "golang.org/x/net/context" "net/http" "net/url" "os" @@ -97,20 +98,37 @@ func (server *Server) Start() { // Stop stops the server func (server *Server) Stop() { - for _, serverEntryPoint := range server.serverEntryPoints { - serverEntryPoint.httpServer.BlockingClose() + for serverEntryPointName, serverEntryPoint := range server.serverEntryPoints { + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(server.globalConfiguration.GraceTimeOut)*time.Second) + go func() { + log.Debugf("Waiting %d seconds before killing connections on entrypoint %s...", 30, serverEntryPointName) + serverEntryPoint.httpServer.BlockingClose() + cancel() + }() + <-ctx.Done() } server.stopChan <- true } // Close destroys the server func (server *Server) Close() { + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(server.globalConfiguration.GraceTimeOut)*time.Second) + go func(ctx context.Context) { + <-ctx.Done() + if ctx.Err() == context.Canceled { + return + } else if ctx.Err() == context.DeadlineExceeded { + log.Debugf("I love you all :'( ✝") + os.Exit(1) + } + }(ctx) server.routinesPool.Stop() close(server.configurationChan) close(server.configurationValidatedChan) close(server.signals) close(server.stopChan) server.loggerMiddleware.Close() + cancel() } func (server *Server) startHTTPServers() { From 2d759df47acd70ddd1a7ea2834d64e8cf3a2237c Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Tue, 19 Jul 2016 10:25:47 +0200 Subject: [PATCH 09/10] Fix basics doc Signed-off-by: Emile Vauge --- docs/basics.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/basics.md b/docs/basics.md index fca49afec..01515cfc6 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -80,24 +80,24 @@ Here is an example of frontends definition: [frontends.frontend1] backend = "backend2" [frontends.frontend1.routes.test_1] - rule = "Host: test.localhost, test2.localhost" + rule = "Host:test.localhost,test2.localhost" [frontends.frontend2] backend = "backend1" passHostHeader = true priority = 10 entrypoints = ["https"] # overrides defaultEntryPoints [frontends.frontend2.routes.test_1] - rule = "Host: localhost, {subdomain:[a-z]+}.localhost" + rule = "Host:localhost,{subdomain:[a-z]+}.localhost" [frontends.frontend3] backend = "backend2" [frontends.frontend3.routes.test_1] - rule = "Host: test3.localhost;Path:/test" + rule = "Host:test3.localhost;Path:/test" ``` - Three frontends are defined: `frontend1`, `frontend2` and `frontend3` -- `frontend1` will forward the traffic to the `backend2` if the rule `Host: test.localhost, test2.localhost` is matched -- `frontend2` will forward the traffic to the `backend1` if the rule `Host: localhost, {subdomain:[a-z]+}.localhost` is matched (forwarding client `Host` header to the backend) -- `frontend3` will forward the traffic to the `backend2` if the rules `Host: test3.localhost` **and** `Path:/test` are matched +- `frontend1` will forward the traffic to the `backend2` if the rule `Host:test.localhost,test2.localhost` is matched +- `frontend2` will forward the traffic to the `backend1` if the rule `Host:localhost,{subdomain:[a-z]+}.localhost` is matched (forwarding client `Host` header to the backend) +- `frontend3` will forward the traffic to the `backend2` if the rules `Host:test3.localhost` **AND** `Path:/test` are matched ### Combining multiple rules @@ -108,19 +108,19 @@ In TOML file, you can use multiple routes: [frontends.frontend3] backend = "backend2" [frontends.frontend3.routes.test_1] - rule = "Host: test3.localhost" + rule = "Host:test3.localhost" [frontends.frontend3.routes.test_2] - rule = "Host: Path:/test" + rule = "Host:Path:/test" ``` -Here `frontend3` will forward the traffic to the `backend2` if the rules `Host: test3.localhost` **and** `Path:/test` are matched. -You can also use the notation using a `;` separator: +Here `frontend3` will forward the traffic to the `backend2` if the rules `Host:test3.localhost` **AND** `Path:/test` are matched. +You can also use the notation using a `;` separator, same result: ```toml [frontends.frontend3] backend = "backend2" [frontends.frontend3.routes.test_1] - rule = "Host: test3.localhost;Path:/test" + rule = "Host:test3.localhost;Path:/test" ``` Finally, you can create a rule to bind multiple domains or Path to a frontend, using the `,` separator: @@ -128,7 +128,7 @@ Finally, you can create a rule to bind multiple domains or Path to a frontend, u ```toml [frontends.frontend2] [frontends.frontend2.routes.test_1] - rule = "Host: test1.localhost,Host: test2.localhost" + rule = "Host:test1.localhost,test2.localhost" [frontends.frontend3] backend = "backend2" [frontends.frontend3.routes.test_1] @@ -137,7 +137,7 @@ Finally, you can create a rule to bind multiple domains or Path to a frontend, u ### Priorities -By default, routes will be sorted using rules length (to avoid path overlap): +By default, routes will be sorted (in descending order) using rules length (to avoid path overlap): `PathPrefix:/12345` will be matched before `PathPrefix:/1234` that will be matched before `PathPrefix:/1`. You can customize priority by frontend: @@ -158,6 +158,8 @@ You can customize priority by frontend: rule = "PathPrefix:/toto" ``` +Here, `frontend1` will be matched before `frontend2` (`10 > 5`). + ## Backends A backend is responsible to load-balance the traffic coming from one or more frontends to a set of http servers. From 1b25e492c7fa5e1eb7752890521721bcc2950f3d Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Tue, 19 Jul 2016 16:05:03 +0200 Subject: [PATCH 10/10] Prepare release v1.0.1 Signed-off-by: Emile Vauge --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 668f585da..78e2d5800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Change Log +## [v1.0.1](https://github.com/containous/traefik/tree/v1.0.1) (2016-07-19) +[Full Changelog](https://github.com/containous/traefik/compare/v1.0.0...v1.0.1) + +**Implemented enhancements:** + +- Error with -consulcatalog and missing load balance method on 1.0.0 [\#524](https://github.com/containous/traefik/issues/524) +- Kubernetes provider: should allow the master url to be override [\#501](https://github.com/containous/traefik/issues/501) + +**Fixed bugs:** + +- Flag --etcd.endpoint default [\#508](https://github.com/containous/traefik/issues/508) +- Conditional ACME on demand generation [\#505](https://github.com/containous/traefik/issues/505) +- Important delay with streams \(Mozilla EventSource\) [\#503](https://github.com/containous/traefik/issues/503) + +**Closed issues:** + +- Can I use Traefik without a domain name? [\#539](https://github.com/containous/traefik/issues/539) +- Priortities in 1.0.0 not behaving [\#506](https://github.com/containous/traefik/issues/506) +- Route by path [\#500](https://github.com/containous/traefik/issues/500) + +**Merged pull requests:** + +- Update server.go [\#531](https://github.com/containous/traefik/pull/531) ([Jsewill](https://github.com/Jsewill)) +- Add sse support [\#527](https://github.com/containous/traefik/pull/527) ([emilevauge](https://github.com/emilevauge)) +- Fix acme checkOnDemandDomain [\#512](https://github.com/containous/traefik/pull/512) ([emilevauge](https://github.com/emilevauge)) +- Fix default etcd port [\#511](https://github.com/containous/traefik/pull/511) ([errm](https://github.com/errm)) + ## [v1.0.0](https://github.com/containous/traefik/tree/v1.0.0) (2016-07-05) [Full Changelog](https://github.com/containous/traefik/compare/v1.0.0-rc3...v1.0.0)