Merge pull request #1954 from weaveworks/version-check

Periodically check for up to date versions of weave.
This commit is contained in:
Adam Harrison committed 2016-02-26 17:25:24 +00:00
commit 31a964ba9b
9 files changed
+4535 -1

No files matched your search

+6
View File
@@ -58,3 +58,9 @@
[submodule "vendor/github.com/boltdb/bolt"]
path = vendor/github.com/boltdb/bolt
url = https://github.com/boltdb/bolt
[submodule "vendor/github.com/weaveworks/go-checkpoint"]
path = vendor/github.com/weaveworks/go-checkpoint
url = https://github.com/weaveworks/go-checkpoint
[submodule "vendor/github.com/hashicorp/go-cleanhttp"]
path = vendor/github.com/hashicorp/go-cleanhttp
url = http://github.com/hashicorp/go-cleanhttp
+9
View File
@@ -55,6 +55,15 @@ For installing weave on other platforms, follow the [integration guides](http://
Weave respects the environment variable `DOCKER_HOST`, so you can run
it locally to control a weave network on a remote host.
Weave will periodically check with our servers to see if a new version is available.
New versions are announced in the log. To disable this, run:
```
CHECKPOINT_DISABLE=true weave launch
```
For more information, [read this](https://github.com/weaveworks/go-checkpoint).
## Quick Start Screencast
<a href="https://youtu.be/kihQCCT1ykE" alt="Click to watch the screencast" target="_blank">
+1
View File
@@ -3,4 +3,5 @@ MAINTAINER Weaveworks Inc <help@weave.works>
LABEL works.weave.role=system
WORKDIR /home/weave
ADD ./weaver /home/weave/
COPY ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/home/weave/weaver"]
File diff suppressed because it is too large. Load diff
+28
View File
@@ -15,6 +15,7 @@ import (
"github.com/gorilla/mux"
"github.com/weaveworks/mesh"
"github.com/weaveworks/go-checkpoint"
. "github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/common/docker"
"github.com/weaveworks/weave/db"
@@ -35,6 +36,31 @@ type dnsConfig struct {
EffectiveListenAddress string
}
const (
versionCheckPeriod = 6 * time.Hour
)
func check() {
handleResponse := func(r *checkpoint.CheckResponse, err error) {
if err != nil {
Log.Printf("Error checking version: %v", err)
} else if r.Outdated {
Log.Printf("Weave version %s is available; please update at %s",
r.CurrentVersion, r.CurrentDownloadURL)
}
}
// Start background version checking
params := checkpoint.CheckParams{
Product: "weave-net",
Version: version,
SignatureFile: "",
}
resp, err := checkpoint.Check(&params)
handleResponse(resp, err)
checkpoint.CheckInterval(&params, versionCheckPeriod, handleResponse)
}
func main() {
procs := runtime.NumCPU()
// packet sniffing can block an OS thread, so we need one thread
@@ -129,6 +155,8 @@ func main() {
Log.Println("Command line options:", options())
Log.Println("Command line peers:", peers)
go check()
if prof != "" {
p := *profile.CPUProfile
p.ProfilePath = prof
+1 -1
View File
@@ -118,7 +118,7 @@ weave_on() {
host=$1
shift 1
[ -z "$DEBUG" ] || greyly echo "Weave on $host:$DOCKER_PORT: $@" >&2
DOCKER_HOST=tcp://$host:$DOCKER_PORT $WEAVE "$@"
CHECKPOINT_DISABLE=true DOCKER_HOST=tcp://$host:$DOCKER_PORT $WEAVE "$@"
}
stop_router_on() {
+2
View File
@@ -131,6 +131,7 @@ exec_remote() {
-e DOCKER_CLIENT_ARGS \
-e PROXY_HOST="$PROXY_HOST" \
-e COVERAGE \
-e CHECKPOINT_DISABLE \
$WEAVEEXEC_DOCKER_ARGS $EXEC_IMAGE --local "$@"
}
@@ -1592,6 +1593,7 @@ launch_router() {
ROUTER_CONTAINER=$(docker run --name=$CONTAINER_NAME \
-d --privileged --net=host $(docker_sock_options) \
-e WEAVE_PASSWORD \
-e CHECKPOINT_DISABLE \
$WEAVE_DOCKER_ARGS $IMAGE $COVERAGE_ARGS \
--port $CONTAINER_PORT --name "$PEERNAME" --nickname "$(hostname)" \
$(router_opts_$BRIDGE_TYPE) \