Merge pull request #1080 from weaveworks/1014-weave-env
rename proxy-(env|config) to (env|config) Closes #1014.
This commit is contained in:
commit
cf7fff3da2
5 files changed
+25
-20
No files matched your search
+2
-2
@@ -143,9 +143,9 @@ Let's begin by configuring weave's allocator to manage multiple
|
|||||||
subnets:
|
subnets:
|
||||||
|
|
||||||
host1$ weave launch -iprange 10.2.0.0/16 -ipsubnet 10.2.1.0/24
|
host1$ weave launch -iprange 10.2.0.0/16 -ipsubnet 10.2.1.0/24
|
||||||
host1$ eval $(weave proxy-env)
|
host1$ eval $(weave env)
|
||||||
host2$ weave launch -iprange 10.2.0.0/16 -ipsubnet 10.2.1.0/24 $HOST1
|
host2$ weave launch -iprange 10.2.0.0/16 -ipsubnet 10.2.1.0/24 $HOST1
|
||||||
host2$ eval $(weave proxy-env)
|
host2$ eval $(weave env)
|
||||||
|
|
||||||
This delegates the entire 10.2.0.0/16 subnet to weave, and instructs
|
This delegates the entire 10.2.0.0/16 subnet to weave, and instructs
|
||||||
it to allocate from 10.2.1.0/24 within that if no specific subnet is
|
it to allocate from 10.2.1.0/24 within that if no specific subnet is
|
||||||
|
|||||||
+3
-3
@@ -49,13 +49,13 @@ All docker commands can be run via the proxy, so it is safe to adjust
|
|||||||
your `DOCKER_HOST` to point at the proxy. Weave provides a convenient
|
your `DOCKER_HOST` to point at the proxy. Weave provides a convenient
|
||||||
command for this:
|
command for this:
|
||||||
|
|
||||||
host1$ eval "$(weave proxy-env)"
|
host1$ eval "$(weave env)"
|
||||||
host1$ docker ps
|
host1$ docker ps
|
||||||
...
|
...
|
||||||
|
|
||||||
Alternatively, the proxy host can be set on a per-command basis with
|
Alternatively, the proxy host can be set on a per-command basis with
|
||||||
|
|
||||||
host1$ docker $(weave proxy-config) ps
|
host1$ docker $(weave config) ps
|
||||||
|
|
||||||
The proxy can be stopped independently with
|
The proxy can be stopped independently with
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ with
|
|||||||
|
|
||||||
$ mkdir -pv ~/.docker
|
$ mkdir -pv ~/.docker
|
||||||
$ cp -v {ca,cert,key}.pem ~/.docker
|
$ cp -v {ca,cert,key}.pem ~/.docker
|
||||||
$ eval "$(weave proxy-env)"
|
$ eval "$(weave env)"
|
||||||
$ export DOCKER_TLS_VERIFY=1
|
$ export DOCKER_TLS_VERIFY=1
|
||||||
$ docker version
|
$ docker version
|
||||||
...
|
...
|
||||||
|
|||||||
+3
-3
@@ -33,13 +33,13 @@ Weave Docker API proxy via `launch`:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
host1$ weave launch
|
host1$ weave launch
|
||||||
host1$ eval $(weave proxy-env)
|
host1$ eval $(weave env)
|
||||||
```
|
```
|
||||||
or independently via `launch-dns`:
|
or independently via `launch-dns`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
host1$ weave launch-router && weave launch-dns && weave launch-proxy
|
host1$ weave launch-router && weave launch-dns && weave launch-proxy
|
||||||
host1$ eval $(weave proxy-env)
|
host1$ eval $(weave env)
|
||||||
```
|
```
|
||||||
|
|
||||||
The first form is more convenient, however you can only pass weaveDNS
|
The first form is more convenient, however you can only pass weaveDNS
|
||||||
@@ -128,7 +128,7 @@ container, this time on the 2nd host, and then run some ping tests...
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
host2$ weave launch
|
host2$ weave launch
|
||||||
host2$ eval $(weave proxy-env)
|
host2$ eval $(weave env)
|
||||||
host2$ docker run -dti --name=pingme ubuntu
|
host2$ docker run -dti --name=pingme ubuntu
|
||||||
|
|
||||||
root@ubuntu:/# ping -nq -c 1 pingme
|
root@ubuntu:/# ping -nq -c 1 pingme
|
||||||
|
|||||||
@@ -4,15 +4,19 @@
|
|||||||
|
|
||||||
start_suite "Configure the docker daemon for the proxy"
|
start_suite "Configure the docker daemon for the proxy"
|
||||||
|
|
||||||
|
# No output when nothing running
|
||||||
|
assert "weave_on $HOST1 env" ""
|
||||||
|
assert "weave_on $HOST1 config" ""
|
||||||
|
|
||||||
weave_on $HOST1 launch-proxy
|
weave_on $HOST1 launch-proxy
|
||||||
|
|
||||||
CMD="run -e WEAVE_CIDR=10.2.1.4/24 $SMALL_IMAGE $CHECK_ETHWE_UP"
|
CMD="run -e WEAVE_CIDR=10.2.1.4/24 $SMALL_IMAGE $CHECK_ETHWE_UP"
|
||||||
assert_raises "eval '$(weave_on $HOST1 proxy-env)' ; docker $CMD"
|
assert_raises "eval '$(weave_on $HOST1 env)' ; docker $CMD"
|
||||||
assert_raises "docker $(weave_on $HOST1 proxy-config) $CMD"
|
assert_raises "docker $(weave_on $HOST1 config) $CMD"
|
||||||
|
|
||||||
# Check we can use the weave script through the proxy
|
# Check we can use the weave script through the proxy
|
||||||
assert_raises "eval '$(weave_on $HOST1 proxy-env)' ; $WEAVE version"
|
assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE version"
|
||||||
assert_raises "eval '$(weave_on $HOST1 proxy-env)' ; $WEAVE ps"
|
assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE ps"
|
||||||
assert_raises "eval '$(weave_on $HOST1 proxy-env)' ; $WEAVE launch-router"
|
assert_raises "eval '$(weave_on $HOST1 env)' ; $WEAVE launch-router"
|
||||||
|
|
||||||
end_suite
|
end_suite
|
||||||
@@ -48,8 +48,8 @@ usage() {
|
|||||||
echo "weave hide [<addr> ...]"
|
echo "weave hide [<addr> ...]"
|
||||||
echo "weave ps [<container_id> ...]"
|
echo "weave ps [<container_id> ...]"
|
||||||
echo "weave status"
|
echo "weave status"
|
||||||
echo "weave proxy-env"
|
echo "weave env"
|
||||||
echo "weave proxy-config"
|
echo "weave config"
|
||||||
echo "weave version"
|
echo "weave version"
|
||||||
echo "weave stop"
|
echo "weave stop"
|
||||||
echo "weave stop-router"
|
echo "weave stop-router"
|
||||||
@@ -932,10 +932,9 @@ proxy_args() {
|
|||||||
proxy_addr() {
|
proxy_addr() {
|
||||||
if addr=$(docker logs $PROXY_CONTAINER_NAME 2>&1 | head -n3 | grep -oE "proxy listening on .*"); then
|
if addr=$(docker logs $PROXY_CONTAINER_NAME 2>&1 | head -n3 | grep -oE "proxy listening on .*"); then
|
||||||
echo "${1}${addr##* }" | sed "s/0.0.0.0/$PROXY_HOST/g"
|
echo "${1}${addr##* }" | sed "s/0.0.0.0/$PROXY_HOST/g"
|
||||||
return 0
|
else
|
||||||
|
echo "$PROXY_CONTAINER_NAME container is not present. Have you launched it?" >&2
|
||||||
fi
|
fi
|
||||||
echo "$PROXY_CONTAINER_NAME container is not present. Have you launched it?" >&2
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -1128,10 +1127,12 @@ case "$COMMAND" in
|
|||||||
launch_proxy "$@"
|
launch_proxy "$@"
|
||||||
echo $PROXY_CONTAINER
|
echo $PROXY_CONTAINER
|
||||||
;;
|
;;
|
||||||
proxy-env)
|
env|proxy-env)
|
||||||
|
[ "$COMMAND" = "env" ] || echo "$COMMAND is deprecated, please use 'weave env'" >&2
|
||||||
proxy_addr "export DOCKER_HOST="
|
proxy_addr "export DOCKER_HOST="
|
||||||
;;
|
;;
|
||||||
proxy-config)
|
config|proxy-config)
|
||||||
|
[ "$COMMAND" = "config" ] || echo "$COMMAND is deprecated, please use 'weave config'" >&2
|
||||||
proxy_addr "-H="
|
proxy_addr "-H="
|
||||||
;;
|
;;
|
||||||
connect)
|
connect)
|
||||||
|
|||||||
Reference in new issue
Block a user