Move prog/v2-plugin to prog/plugin-v2

This commit is contained in:
Martynas Pumputis authored and Bryan Boreham committed 2017-04-12 13:05:39 +00:00
1 parent 82b56848a9
commit 4916badcc4
2 files changed

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
{
"description": "Weave Net plugin for Docker",
"documentation": "https://weave.works",
"entrypoint": [
"/home/weave/launch.sh"
],
"interface": {
"socket": "weave.sock",
"types": [
"docker.networkdriver/1.0"
]
},
"linux": {
"capabilities": [
"CAP_SYS_ADMIN",
"CAP_NET_ADMIN"
]
},
"mounts": [
{
"destination": "/procmount",
"type": "proc",
"source": "proc"
},
{
"destination": "/var/run/docker.sock",
"source": "/var/run/docker.sock",
"type": "bind",
"options": ["rbind"]
},
{
"destination": "/var/lib/weave",
"source": "/var/lib/weave",
"type": "bind",
"options": ["rbind"]
}
],
"network": {
"type": "host"
},
"workdir": ""
}
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
set -e
# Default if not supplied - same as weave net default
IPALLOC_RANGE=${IPALLOC_RANGE:-10.32.0.0/12}
HTTP_ADDR=${WEAVE_HTTP_ADDR:-127.0.0.1:6784}
STATUS_ADDR=${WEAVE_STATUS_ADDR:-0.0.0.0:6782}
HOST_ROOT=${HOST_ROOT:-/host}
LOG_FILE=/var/lib/weave/weaver.log
echo "Starting launch.sh" >>$LOG_FILE
# Check if the IP range overlaps anything existing on the host
/usr/bin/weaveutil netcheck $IPALLOC_RANGE weave
SWARM_PEERS=$(/usr/bin/weaveutil swarm-manager-peers 2>>$LOG_FILE)
! /usr/bin/weaveutil is-swarm-manager 2>>$LOG_FILE || IS_SWARM_MANAGER=1
/home/weave/weave --local create-bridge --force >>$LOG_FILE 2>&1
BRIDGE_OPTIONS="--datapath=datapath"
if [ "$(/home/weave/weave --local bridge-type)" = "bridge" ]; then
# TODO: Call into weave script to do this
if ! ip link show vethwe-pcap >/dev/null 2>&1; then
ip link add name vethwe-bridge type veth peer name vethwe-pcap
ip link set vethwe-bridge up
ip link set vethwe-pcap up
ip link set vethwe-bridge master weave
fi
BRIDGE_OPTIONS="--iface=vethwe-pcap"
fi
if [ -z "$IPALLOC_INIT" ]; then
if [ $IS_SWARM_MANAGER == "1" ]; then
IPALLOC_INIT="consensus=$(echo $SWARM_PEERS | wc -l)"
else
IPALLOC_INIT="observer"
fi
fi
/home/weave/weaver $EXTRA_ARGS --port=6783 $BRIDGE_OPTIONS \
--http-addr=$HTTP_ADDR --status-addr=$STATUS_ADDR --docker-api='' --no-dns \
--ipalloc-range=$IPALLOC_RANGE \
--ipalloc-init $IPALLOC_INIT \
--nickname "$(hostname)" \
$(echo $SWARM_PEERS | tr '\n' ' ') \
>>$LOG_FILE 2>&1 &
WEAVE_PID=$!
# Wait for weave process to become responsive
while true; do
curl $HTTP_ADDR/status >/dev/null 2>&1 && break
if ! kill -0 $WEAVE_PID >/dev/null 2>&1; then
echo Weave process has died >&2
exit 1
fi
sleep 1
done
/home/weave/plugin --meshsocket='' --docker-api='' >/var/lib/weave/plugin.log 2>&1 &
echo "End of launch.sh" >>$LOG_FILE
wait $WEAVE_PID