Merge pull request #2372 from weaveworks/issues/2310-more-checkpoint
Add kernel version, Docker version and awsvpc setting to checkpoint info Fixes #2310
This commit is contained in:
commit
b00e7d088e
5 files changed
+91
-38
No files matched your search
@@ -84,6 +84,15 @@ func (c *Client) Info() string {
|
|||||||
return fmt.Sprintf("Docker API on %s: %v", c.Endpoint(), env)
|
return fmt.Sprintf("Docker API on %s: %v", c.Endpoint(), env)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) DockerVersion() string {
|
||||||
|
if env, err := c.Version(); err == nil {
|
||||||
|
if v, found := env.Map()["Version"]; found {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
// AddObserver adds an observer for docker events
|
// AddObserver adds an observer for docker events
|
||||||
func (c *Client) AddObserver(ob ContainerObserver) error {
|
func (c *Client) AddObserver(ob ContainerObserver) error {
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync/atomic"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/weaveworks/go-checkpoint"
|
||||||
|
)
|
||||||
|
|
||||||
|
var checker *checkpoint.Checker
|
||||||
|
var newVersion atomic.Value
|
||||||
|
|
||||||
|
const (
|
||||||
|
updateCheckPeriod = 6 * time.Hour
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkForUpdates(dockerVersion string, network string) {
|
||||||
|
newVersion.Store("")
|
||||||
|
|
||||||
|
handleResponse := func(r *checkpoint.CheckResponse, err error) {
|
||||||
|
if err != nil {
|
||||||
|
Log.Printf("Error checking version: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if r.Outdated {
|
||||||
|
newVersion.Store(r.CurrentVersion)
|
||||||
|
Log.Printf("Weave version %s is available; please update at %s",
|
||||||
|
r.CurrentVersion, r.CurrentDownloadURL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var uts syscall.Utsname
|
||||||
|
syscall.Uname(&uts)
|
||||||
|
flags := map[string]string{
|
||||||
|
"docker-version": dockerVersion,
|
||||||
|
"kernel-version": charsToString(uts.Release[:]),
|
||||||
|
}
|
||||||
|
if network != "" {
|
||||||
|
flags["network"] = network
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start background version checking
|
||||||
|
params := checkpoint.CheckParams{
|
||||||
|
Product: "weave-net",
|
||||||
|
Version: version,
|
||||||
|
SignatureFile: "",
|
||||||
|
Flags: flags,
|
||||||
|
}
|
||||||
|
checker = checkpoint.CheckInterval(¶ms, updateCheckPeriod, handleResponse)
|
||||||
|
}
|
||||||
|
|
||||||
|
func charsToString(ca []int8) string {
|
||||||
|
s := make([]byte, len(ca))
|
||||||
|
i := 0
|
||||||
|
for ; i < len(ca); i++ {
|
||||||
|
if ca[i] == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
s[i] = uint8(ca[i])
|
||||||
|
}
|
||||||
|
return string(s[:i])
|
||||||
|
}
|
||||||
+7
-34
@@ -9,7 +9,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/mflag"
|
"github.com/docker/docker/pkg/mflag"
|
||||||
@@ -17,7 +16,6 @@ import (
|
|||||||
"github.com/pkg/profile"
|
"github.com/pkg/profile"
|
||||||
"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"
|
||||||
@@ -30,8 +28,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var version = "(unreleased version)"
|
var version = "(unreleased version)"
|
||||||
var checker *checkpoint.Checker
|
|
||||||
var newVersion atomic.Value
|
|
||||||
|
|
||||||
var Log = common.Log
|
var Log = common.Log
|
||||||
|
|
||||||
@@ -53,34 +49,6 @@ type dnsConfig struct {
|
|||||||
ResolvConf string
|
ResolvConf string
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
updateCheckPeriod = 6 * time.Hour
|
|
||||||
)
|
|
||||||
|
|
||||||
func checkForUpdates() {
|
|
||||||
newVersion.Store("")
|
|
||||||
|
|
||||||
handleResponse := func(r *checkpoint.CheckResponse, err error) {
|
|
||||||
if err != nil {
|
|
||||||
Log.Printf("Error checking version: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if r.Outdated {
|
|
||||||
newVersion.Store(r.CurrentVersion)
|
|
||||||
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: "",
|
|
||||||
}
|
|
||||||
checker = checkpoint.CheckInterval(¶ms, updateCheckPeriod, handleResponse)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ipamConfig) Enabled() bool {
|
func (c *ipamConfig) Enabled() bool {
|
||||||
var (
|
var (
|
||||||
hasPeerCount = c.PeerCount > 0
|
hasPeerCount = c.PeerCount > 0
|
||||||
@@ -238,8 +206,6 @@ func main() {
|
|||||||
|
|
||||||
Log.Println("Command line options:", options())
|
Log.Println("Command line options:", options())
|
||||||
|
|
||||||
checkForUpdates()
|
|
||||||
|
|
||||||
if prof != "" {
|
if prof != "" {
|
||||||
defer profile.Start(profile.CPUProfile, profile.ProfilePath(prof), profile.NoShutdownHook).Stop()
|
defer profile.Start(profile.CPUProfile, profile.ProfilePath(prof), profile.NoShutdownHook).Stop()
|
||||||
}
|
}
|
||||||
@@ -295,6 +261,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
dockerCli = dc
|
dockerCli = dc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
network := ""
|
||||||
|
if isAWSVPC {
|
||||||
|
network = "awsvpc"
|
||||||
|
}
|
||||||
|
checkForUpdates(dockerCli.DockerVersion(), network)
|
||||||
|
|
||||||
observeContainers := func(o docker.ContainerObserver) {
|
observeContainers := func(o docker.ContainerObserver) {
|
||||||
if dockerCli != nil {
|
if dockerCli != nil {
|
||||||
if err := dockerCli.AddObserver(o); err != nil {
|
if err := dockerCli.AddObserver(o); err != nil {
|
||||||
|
|||||||
@@ -31,12 +31,20 @@ With Weave Net downloaded onto your VMs or hosts, you are ready to launch a Weav
|
|||||||
Weave Net [periodically contacts Weaveworks servers for available
|
Weave Net [periodically contacts Weaveworks servers for available
|
||||||
versions](https://github.com/weaveworks/go-checkpoint). New versions
|
versions](https://github.com/weaveworks/go-checkpoint). New versions
|
||||||
are announced in the log and in [the status
|
are announced in the log and in [the status
|
||||||
summary](/site/troubleshooting.md#weave-status). To disable this
|
summary](/site/troubleshooting.md#weave-status).
|
||||||
check, run the following before launching Weave Net:
|
|
||||||
|
The information sent in this check is:
|
||||||
|
|
||||||
|
* Host UUID hash
|
||||||
|
* Kernel version
|
||||||
|
* Docker version
|
||||||
|
* Weave Net version
|
||||||
|
* Network mode, e.g. 'awsvpc'
|
||||||
|
|
||||||
|
To disable this check, run the following before launching Weave Net:
|
||||||
|
|
||||||
export CHECKPOINT_DISABLE=1
|
export CHECKPOINT_DISABLE=1
|
||||||
|
|
||||||
|
|
||||||
###Guides for Specific Platforms
|
###Guides for Specific Platforms
|
||||||
|
|
||||||
CoreOS users see [here](/guides/networking-docker-containers-with-weave-on-coreos/) for an example of installing Weave using cloud-config.
|
CoreOS users see [here](/guides/networking-docker-containers-with-weave-on-coreos/) for an example of installing Weave using cloud-config.
|
||||||
|
|||||||
+1
-1
Submodule vendor/github.com/weaveworks/go-checkpoint updated: b6cc8365a3...62324982ab.
Reference in new issue
Block a user