Merge pull request #1954 from weaveworks/version-check
Periodically check for up to date versions of weave.
This commit is contained in:
commit
31a964ba9b
9 files changed
+4535
-1
No files matched your search
@@ -58,3 +58,9 @@
|
|||||||
[submodule "vendor/github.com/boltdb/bolt"]
|
[submodule "vendor/github.com/boltdb/bolt"]
|
||||||
path = vendor/github.com/boltdb/bolt
|
path = vendor/github.com/boltdb/bolt
|
||||||
url = https://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
|
||||||
@@ -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
|
Weave respects the environment variable `DOCKER_HOST`, so you can run
|
||||||
it locally to control a weave network on a remote host.
|
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
|
## Quick Start Screencast
|
||||||
|
|
||||||
<a href="https://youtu.be/kihQCCT1ykE" alt="Click to watch the screencast" target="_blank">
|
<a href="https://youtu.be/kihQCCT1ykE" alt="Click to watch the screencast" target="_blank">
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ MAINTAINER Weaveworks Inc <help@weave.works>
|
|||||||
LABEL works.weave.role=system
|
LABEL works.weave.role=system
|
||||||
WORKDIR /home/weave
|
WORKDIR /home/weave
|
||||||
ADD ./weaver /home/weave/
|
ADD ./weaver /home/weave/
|
||||||
|
COPY ca-certificates.crt /etc/ssl/certs/
|
||||||
ENTRYPOINT ["/home/weave/weaver"]
|
ENTRYPOINT ["/home/weave/weaver"]
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/weaveworks/mesh"
|
"github.com/weaveworks/mesh"
|
||||||
|
|
||||||
|
"github.com/weaveworks/go-checkpoint"
|
||||||
. "github.com/weaveworks/weave/common"
|
. "github.com/weaveworks/weave/common"
|
||||||
"github.com/weaveworks/weave/common/docker"
|
"github.com/weaveworks/weave/common/docker"
|
||||||
"github.com/weaveworks/weave/db"
|
"github.com/weaveworks/weave/db"
|
||||||
@@ -35,6 +36,31 @@ type dnsConfig struct {
|
|||||||
EffectiveListenAddress string
|
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(¶ms)
|
||||||
|
handleResponse(resp, err)
|
||||||
|
checkpoint.CheckInterval(¶ms, versionCheckPeriod, handleResponse)
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
procs := runtime.NumCPU()
|
procs := runtime.NumCPU()
|
||||||
// packet sniffing can block an OS thread, so we need one thread
|
// 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 options:", options())
|
||||||
Log.Println("Command line peers:", peers)
|
Log.Println("Command line peers:", peers)
|
||||||
|
|
||||||
|
go check()
|
||||||
|
|
||||||
if prof != "" {
|
if prof != "" {
|
||||||
p := *profile.CPUProfile
|
p := *profile.CPUProfile
|
||||||
p.ProfilePath = prof
|
p.ProfilePath = prof
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ weave_on() {
|
|||||||
host=$1
|
host=$1
|
||||||
shift 1
|
shift 1
|
||||||
[ -z "$DEBUG" ] || greyly echo "Weave on $host:$DOCKER_PORT: $@" >&2
|
[ -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() {
|
stop_router_on() {
|
||||||
|
|||||||
+1
Submodule vendor/github.com/hashicorp/go-cleanhttp added at ce617e7998.
+1
Submodule vendor/github.com/weaveworks/go-checkpoint added at eea0cb58cd.
@@ -131,6 +131,7 @@ exec_remote() {
|
|||||||
-e DOCKER_CLIENT_ARGS \
|
-e DOCKER_CLIENT_ARGS \
|
||||||
-e PROXY_HOST="$PROXY_HOST" \
|
-e PROXY_HOST="$PROXY_HOST" \
|
||||||
-e COVERAGE \
|
-e COVERAGE \
|
||||||
|
-e CHECKPOINT_DISABLE \
|
||||||
$WEAVEEXEC_DOCKER_ARGS $EXEC_IMAGE --local "$@"
|
$WEAVEEXEC_DOCKER_ARGS $EXEC_IMAGE --local "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1592,6 +1593,7 @@ launch_router() {
|
|||||||
ROUTER_CONTAINER=$(docker run --name=$CONTAINER_NAME \
|
ROUTER_CONTAINER=$(docker run --name=$CONTAINER_NAME \
|
||||||
-d --privileged --net=host $(docker_sock_options) \
|
-d --privileged --net=host $(docker_sock_options) \
|
||||||
-e WEAVE_PASSWORD \
|
-e WEAVE_PASSWORD \
|
||||||
|
-e CHECKPOINT_DISABLE \
|
||||||
$WEAVE_DOCKER_ARGS $IMAGE $COVERAGE_ARGS \
|
$WEAVE_DOCKER_ARGS $IMAGE $COVERAGE_ARGS \
|
||||||
--port $CONTAINER_PORT --name "$PEERNAME" --nickname "$(hostname)" \
|
--port $CONTAINER_PORT --name "$PEERNAME" --nickname "$(hostname)" \
|
||||||
$(router_opts_$BRIDGE_TYPE) \
|
$(router_opts_$BRIDGE_TYPE) \
|
||||||
|
|||||||
Reference in new issue
Block a user