introduce 'weave stop'

which, as well as stopping&removing the weave container also clears
the UDP connection tracking for the weave port, without which UDP
connections to a quickly (<3min) re-started weave would fail.

Fixes #18
This commit is contained in:
Matthias Radestock committed 2014-09-01 16:08:47 +01:00
1 parent aed818fb22
commit 0a7df2220c
2 files changed
+38 -12

No files matched your search

+14 -8
View File
@@ -30,8 +30,15 @@ To run weave on a host, you need to install...
https://raw.githubusercontent.com/zettio/weave/master/weaver/weave
sudo chmod a+x /usr/local/bin/weave
3. ethtool. On many systems that is installed already; if not then
grab it via your favourite package manager.
3. (recommended) ethtool. On many systems this is installed already;
if not then grab it via your favourite package manager. On some
systems, weave application container networking may not operate
correctly unless ethtool is available.
4. (optional) conntrack. Install this via your favourite package
manager. Without conntrack, the weave network may not re-establish
itself fully when individual weave instances are stopped (with
`weave stop`) and restarted quickly (typically within ~3 minutes).
## Example
@@ -286,12 +293,11 @@ the partition heals.
The weave container is very light-weight - just over 8MB image size
and a few 10s of MBs of runtime memory - and disposable. I.e. should
weave ever run into difficulty, one can simply bounce the weave
container (though note
[issue #18](https://github.com/zettio/weave/issues/18)). Application
containers do *not* have to be restarted in that event, and indeed may
not even experience a temporary connectivity failure if the weave
container is restarted quickly enough.
weave ever run into difficulty, one can simply stop it (with `weave
stop`) and restart it. Application containers do *not* have to be
restarted in that event, and indeed may not even experience a
temporary connectivity failure if the weave container is restarted
quickly enough.
## Troubleshooting
+24 -4
View File
@@ -6,6 +6,7 @@ usage() {
echo "weave launch <ipaddr>/<subnet> [-passwd <passwd>] <peer_host> ..."
echo "weave run <ipaddr>/<subnet> <docker run args> ..."
echo "weave expose <ipaddr>/<subnet>"
echo "weave stop"
exit 1
}
@@ -14,16 +15,15 @@ usage() {
exit 1
}
[ $# -gt 1 ] || usage
[ $# -gt 0 ] || usage
BRIDGE=weave
CONTAINER_IFNAME=ethwe
MTU=65535
COMMAND=$1
IPADDR=$2
shift 2
shift 1
create_bridge() {
[ ! -d /sys/class/net/$BRIDGE ] && {
@@ -50,6 +50,9 @@ setup_masquerading() {
case "$COMMAND" in
launch)
[ $# -gt 0 ] || usage
IPADDR=$1
shift 1
create_bridge
setup_masquerading
# We set the router name to the bridge mac since that is
@@ -64,18 +67,35 @@ case "$COMMAND" in
IFACE=eth0
;;
run)
[ $# -gt 0 ] || usage
IPADDR=$1
shift 1
create_bridge
CONTAINER=$(docker run -d "$@")
echo $CONTAINER
IFACE=$CONTAINER_IFNAME
;;
expose)
[ $# -gt 0 ] || usage
IPADDR=$1
shift 1
if ! ip addr list dev $BRIDGE | grep -qF $IPADDR
then
ip addr add dev $BRIDGE $IPADDR
fi
exit 0
;;
stop)
docker kill weave > /dev/null
docker rm weave > /dev/null
if command -v conntrack >/dev/null 2>&1
then
conntrack -D -p udp --dport 6783 >/dev/null 2>&1
else
echo "Cannot find conntrack; please install it. Continuing without it." >&2
fi
exit 0
;;
*)
echo "Unknown weave command '$COMMAND'"
usage
@@ -114,7 +134,7 @@ if command -v ethtool >/dev/null 2>&1
then
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
else
echo "Cannot find ethtool; continuing without it" >&2
echo "Cannot find ethtool; please install it. Continuing without it." >&2
fi
[ -f /var/run/netns/$NSPID ] && rm -f /var/run/netns/$NSPID