Files
weave-scope/docker/entrypoint.sh
Peter Bourgon 7d51f173ea Probes POST to apps
- App takes POST report on /api/report
- Probe publishes to configured target(s)
- Name resolution happens on probe-side
- There's no longer an xfer.ProbePort
- xfer.Collector responsibility is reduced
- Fixes to remaining experimental components.
- rm experimental/bridge: it's not being used, and by changing the
  app/probe comm model, it would require a complete refactor anyway. We
  can easily rebuild it when we need to. It will even be much simpler.
- rm experimental/graphviz: it's broken for some time anyway, and we
  don't really need to play around with it as a rendering option
  anymore.
- rm experimental/oneshot: we never use this anymore.
2015-08-07 15:45:15 +02:00

64 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
usage() {
echo "$0 --dns <IP> --hostname <NAME> --searchpath <SEARCHPATH> --app.foo bar --probe.foo bar"
exit 1
}
# This script exists to modify the network settings in the scope containers
# as docker doesn't allow it when started with --net=host
APP_ARGS=""
PROBE_ARGS=""
while true; do
case "$1" in
--dns)
[ $# -gt 1 ] || usage
DNS_SERVER="$2"
shift 2
;;
--searchpath)
[ $# -gt 1 ] || usage
SEARCHPATH="$2"
shift 2
;;
--app.*)
[ $# -gt 1 ] || usage
ARG_NAME=$(echo "$1" | sed 's/\-\-app\.//')
ARG_VALUE="$2"
shift 2
APP_ARGS="$APP_ARGS -$ARG_NAME=$ARG_VALUE"
;;
--probe.*)
[ $# -gt 1 ] || usage
ARG_NAME=$(echo "$1" | sed 's/\-\-probe\.//')
ARG_VALUE="$2"
shift 2
PROBE_ARGS="$PROBE_ARGS -$ARG_NAME=$ARG_VALUE"
;;
*)
break
;;
esac
done
mkdir -p /etc/weave
echo "$APP_ARGS" >/etc/weave/scope-app.args
echo "$PROBE_ARGS" >/etc/weave/scope-probe.args
if [ -n "$DNS_SERVER" -a -n "$SEARCHPATH" ]; then
echo "domain $SEARCHPATH" >/etc/resolv.conf
echo "search $SEARCHPATH" >>/etc/resolv.conf
echo "nameserver $DNS_SERVER" >>/etc/resolv.conf
fi
# End of the command line can optionally be some
# addresses of apps to connect to, for people not
# using Weave DNS. We stick these in /etc/weave/apps
# for the run-probe script to pick up.
MANUAL_APPS=$@
echo "$MANUAL_APPS" >/etc/weave/apps
exec /sbin/runsvdir /etc/service