Periocially check for up to date versions of weave.

This commit is contained in:
Tom Wilkie committed 2016-02-26 15:35:12 +00:00
1 parent 752baa4bd6
commit b228bbb9fb
7 files changed
+50

No files matched your search

+9
View File
@@ -58,3 +58,12 @@
[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/certifi/gocertifi"]
path = vendor/github.com/certifi/gocertifi
url = https://github.com/certifi/gocertifi
[submodule "vendor/github.com/hashicorp/go-cleanhttp"]
path = vendor/github.com/hashicorp/go-cleanhttp
url = http://github.com/hashicorp/go-cleanhttp
+6
View File
@@ -55,6 +55,12 @@ 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. To disable this, run:
```
CHECKPOINT_DISABLE=true weave launch
```
## Quick Start Screencast
<a href="https://youtu.be/kihQCCT1ykE" alt="Click to watch the screencast" target="_blank">
+29
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,32 @@ type dnsConfig struct {
EffectiveListenAddress string
}
const (
signatureFile = "/etc/weave/signature"
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: 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 +156,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
+3
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,8 @@ launch_router() {
ROUTER_CONTAINER=$(docker run --name=$CONTAINER_NAME \
-d --privileged --net=host $(docker_sock_options) \
-e WEAVE_PASSWORD \
-e CHECKPOINT_DISABLE \
-v /etc/weave:/etc/weave \
$WEAVE_DOCKER_ARGS $IMAGE $COVERAGE_ARGS \
--port $CONTAINER_PORT --name "$PEERNAME" --nickname "$(hostname)" \
$(router_opts_$BRIDGE_TYPE) \