From d6fd0beff4813e5f879294e24ef84ace0500e51a Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Wed, 22 Jun 2016 13:56:14 +0000 Subject: [PATCH 1/4] Don't prepend `scope launch` with sudo --- site/installing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/installing.md b/site/installing.md index 9be45c69c7..7483d7b66f 100644 --- a/site/installing.md +++ b/site/installing.md @@ -24,7 +24,7 @@ To install Scope onto your local Docker machine in standalone mode, run the foll sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch + scope launch This script downloads and runs a recent Scope image from the Docker Hub. Scope needs to be installed onto every machine that you want to monitor. Once launched, Scope doesn’t require any other configuration and it also doesn’t depend on Weave Net. @@ -42,7 +42,7 @@ Then, install Scope onto your local Docker machine and start using Weave Cloud: sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch --service-token= + scope launch --service-token= Where, From 5d23432a6ce4662e0eb86e9dbe0d9ce8d1b005c7 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Mon, 4 Jul 2016 17:08:49 +0000 Subject: [PATCH 2/4] Check write access to unix socket --- scope | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scope b/scope index 0b58cf6327..3859e9b61a 100755 --- a/scope +++ b/scope @@ -34,6 +34,27 @@ WEAVESCOPE_DOCKER_ARGS=${WEAVESCOPE_DOCKER_ARGS:-} COMMAND=$1 shift 1 +check_docker_access() { + + # Extract socket path + DOCKER_SOCK_FILE="" + if [ -z "${DOCKER_HOST+x}" ]; then + DOCKER_SOCK_FILE="/var/run/docker.sock" + else + WITHOUT_PREFIX="${DOCKER_HOST#unix://}" + if [ "$WITHOUT_PREFIX" != "$DOCKER_HOST" ]; then + DOCKER_SOCK_FILE="$WITHOUT_PREFIX" + fi + fi + + + if [ \( -n "$DOCKER_SOCK_FILE" \) -a \( ! -w "$DOCKER_SOCK_FILE" \) ]; then + echo "ERROR: cannot write to docker socket: $DOCKER_SOCK_FILE" >&2 + echo "change socket permissions or try using sudo" + exit 1 + fi +} + # - The image embeds the weave script & Docker 1.3.1 client # - Docker versions prior to 1.5.0 do not support --pid=host # - Weave needs 1.6.0 now (image pulling changes) @@ -119,6 +140,8 @@ launch_app_command() { $WEAVESCOPE_DOCKER_ARGS $SCOPE_IMAGE --no-probe "$@" } +check_docker_access + check_docker_version case "$COMMAND" in From 59ec3b863a09c97ffe16d001ca98cfb78e3f8979 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Mon, 4 Jul 2016 17:21:12 +0000 Subject: [PATCH 3/4] Review comments --- README.md | 2 +- scope | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3d8210c2b6..c8aa7c49cd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Interact with your containers directly: pause, restart and stop containers. Laun ``` sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope -sudo scope launch +scope launch ``` This script will download and run a recent Scope image from the Docker Hub. diff --git a/scope b/scope index 3859e9b61a..ab05ef9dfe 100755 --- a/scope +++ b/scope @@ -46,11 +46,10 @@ check_docker_access() { DOCKER_SOCK_FILE="$WITHOUT_PREFIX" fi fi - if [ \( -n "$DOCKER_SOCK_FILE" \) -a \( ! -w "$DOCKER_SOCK_FILE" \) ]; then echo "ERROR: cannot write to docker socket: $DOCKER_SOCK_FILE" >&2 - echo "change socket permissions or try using sudo" + echo "change socket permissions or try using sudo" >&2 exit 1 fi } @@ -141,7 +140,6 @@ launch_app_command() { } check_docker_access - check_docker_version case "$COMMAND" in From 7b3862f05b073545c5643c1278fbadf7e40bca68 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 5 Jul 2016 10:09:40 +0000 Subject: [PATCH 4/4] Review feedback --- site/introducing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/introducing.md b/site/introducing.md index e68cd8191e..f7359c64a4 100644 --- a/site/introducing.md +++ b/site/introducing.md @@ -10,7 +10,7 @@ To install Scope on your local Docker machine, run the following commands: sudo wget -O /usr/local/bin/scope https://git.io/scope sudo chmod a+x /usr/local/bin/scope - sudo scope launch + scope launch Scope can be used in standalone mode, where you deploy it locally onto your hosts, or you can use Weave Scope in Service Mode. Scope can be depoloyed to Kubernetes, DCOS and ECS cluster. See [Installing Weave Scope](/site/installing.md) for more information.