From 640bfc4effd1a2efa28bab78917ee88da80e2392 Mon Sep 17 00:00:00 2001 From: Bill Glover Date: Sat, 1 Oct 2016 22:33:16 +0100 Subject: [PATCH 01/15] Fix syntax in Swarm example. Resolves #528 Prior to this fix the documentation for the swarm example included syntax that would fail with the following error. `Error : flag needs an argument: --docker.domain` This fix specifies flags using the `=` between the flag name and value. Tested on: Docker version 1.12.2-rc1, build 45bed2c, experimental --- docs/user-guide/swarm.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/user-guide/swarm.md b/docs/user-guide/swarm.md index 5a720fccf..456b3f20a 100644 --- a/docs/user-guide/swarm.md +++ b/docs/user-guide/swarm.md @@ -84,14 +84,14 @@ docker $(docker-machine config mhs-demo0) run \ -l DEBUG \ -c /dev/null \ --docker \ - --docker.domain traefik \ - --docker.endpoint tcp://$(docker-machine ip mhs-demo0):3376 \ + --docker.domain=traefik \ + --docker.endpoint=tcp://$(docker-machine ip mhs-demo0):3376 \ --docker.tls \ - --docker.tls.ca /ssl/ca.pem \ - --docker.tls.cert /ssl/server.pem \ - --docker.tls.key /ssl/server-key.pem \ + --docker.tls.ca=/ssl/ca.pem \ + --docker.tls.cert=/ssl/server.pem \ + --docker.tls.key=/ssl/server-key.pem \ --docker.tls.insecureSkipVerify \ - --docker.watch \ + --docker.watch \ --web ``` @@ -102,7 +102,7 @@ Let's explain this command: - `-v /var/lib/boot2docker/:/ssl`: mount the ssl keys generated by docker-machine - `-c /dev/null`: empty config file - `--docker`: enable docker backend -- `--docker.endpoint tcp://172.18.0.1:3376`: connect to the swarm master using the docker_gwbridge network +- `--docker.endpoint=tcp://172.18.0.1:3376`: connect to the swarm master using the docker_gwbridge network - `--docker.tls`: enable TLS using the docker-machine keys - `--web`: activate the webUI on port 8080 From 4a43273ee5a060df489d7a234345557e0f18c801 Mon Sep 17 00:00:00 2001 From: Victor Felder Date: Sun, 2 Oct 2016 20:07:25 +0200 Subject: [PATCH 02/15] Show current version in web UI --- web.go | 13 +++++++++++++ webui/src/app/core/version.resource.js | 14 ++++++++++++++ webui/src/app/version/version.controller.js | 10 ++++++++++ webui/src/app/version/version.module.js | 11 +++++++++++ webui/src/index.html | 5 +++++ webui/src/index.js | 4 +++- 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 webui/src/app/core/version.resource.js create mode 100644 webui/src/app/version/version.controller.js create mode 100644 webui/src/app/version/version.module.js diff --git a/web.go b/web.go index 97b31ff17..65a10f392 100644 --- a/web.go +++ b/web.go @@ -15,6 +15,7 @@ import ( "github.com/containous/traefik/middlewares" "github.com/containous/traefik/safe" "github.com/containous/traefik/types" + "github.com/containous/traefik/version" "github.com/elazarl/go-bindata-assetfs" "github.com/thoas/stats" "github.com/unrolled/render" @@ -60,6 +61,7 @@ func (provider *WebProvider) Provide(configurationChan chan<- types.ConfigMessag systemRouter.Methods("GET").Path("/ping").HandlerFunc(provider.getPingHandler) // API routes systemRouter.Methods("GET").Path("/api").HandlerFunc(provider.getConfigHandler) + systemRouter.Methods("GET").Path("/api/version").HandlerFunc(provider.getVersionHandler) systemRouter.Methods("GET").Path("/api/providers").HandlerFunc(provider.getConfigHandler) systemRouter.Methods("GET").Path("/api/providers/{provider}").HandlerFunc(provider.getProviderHandler) systemRouter.Methods("PUT").Path("/api/providers/{provider}").HandlerFunc(func(response http.ResponseWriter, request *http.Request) { @@ -144,6 +146,17 @@ func (provider *WebProvider) getConfigHandler(response http.ResponseWriter, requ templatesRenderer.JSON(response, http.StatusOK, currentConfigurations) } +func (provider *WebProvider) getVersionHandler(response http.ResponseWriter, request *http.Request) { + v := struct { + Version string + Codename string + }{ + Version: version.Version, + Codename: version.Codename, + } + templatesRenderer.JSON(response, http.StatusOK, v) +} + func (provider *WebProvider) getProviderHandler(response http.ResponseWriter, request *http.Request) { vars := mux.Vars(request) providerID := vars["provider"] diff --git a/webui/src/app/core/version.resource.js b/webui/src/app/core/version.resource.js new file mode 100644 index 000000000..5ec80d56d --- /dev/null +++ b/webui/src/app/core/version.resource.js @@ -0,0 +1,14 @@ +'use strict'; +var angular = require('angular'); + +var traefikCoreVersion = 'traefik.core.version'; +module.exports = traefikCoreVersion; + +angular + .module(traefikCoreVersion, ['ngResource']) + .factory('Version', Version); + + /** @ngInject */ + function Version($resource) { + return $resource('../api/version'); + } diff --git a/webui/src/app/version/version.controller.js b/webui/src/app/version/version.controller.js new file mode 100644 index 000000000..373f28b06 --- /dev/null +++ b/webui/src/app/version/version.controller.js @@ -0,0 +1,10 @@ +'use strict'; + +/** @ngInject */ +function VersionController($scope, $interval, $log, Version) { + Version.get(function (version) { + $scope.version = version; + }); +} + +module.exports = VersionController; diff --git a/webui/src/app/version/version.module.js b/webui/src/app/version/version.module.js new file mode 100644 index 000000000..991ed2474 --- /dev/null +++ b/webui/src/app/version/version.module.js @@ -0,0 +1,11 @@ +'use strict'; +var angular = require('angular'); +var traefikCoreVersion = require('../core/version.resource'); +var VersionController = require('./version.controller'); + +var traefikVersion = 'traefik.version'; +module.exports = traefikVersion; + +angular + .module(traefikVersion, [traefikCoreVersion]) + .controller('VersionController', VersionController); diff --git a/webui/src/index.html b/webui/src/index.html index 468431563..bec9ce4d5 100644 --- a/webui/src/index.html +++ b/webui/src/index.html @@ -27,6 +27,11 @@
  • Health