Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow users to specify app and probe arguments. #169

Merged
merged 1 commit into from
Jun 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh

usage() {
echo "$0 --dns <IP> --hostname <NAME> --searchpath <SEARCHPATH>"
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)
Expand All @@ -19,12 +23,30 @@ while true; do
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/app.args
echo "$PROBE_ARGS" >/etc/weave/probe.args

if [ -n "$DNS_SERVER" -a -n "$SEARCHPATH" ]; then
echo "domain $SEARCHPATH" >/etc/resolv.conf
echo "search $SEARCHPATH" >>/etc/resolv.conf
Expand All @@ -36,7 +58,6 @@ fi
# using Weave DNS. We stick these in /etc/weave/probes
# for the run-app script to pick up.
MANUAL_PROBES=$@
mkdir -p /etc/weave
echo "$MANUAL_PROBES" >/etc/weave/probes

exec /sbin/runsvdir /etc/service
2 changes: 1 addition & 1 deletion docker/run-app
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec /home/weave/app $(cat /etc/weave/probes)
exec /home/weave/app $(cat /etc/weave/app.args) $(cat /etc/weave/probes)
2 changes: 1 addition & 1 deletion docker/run-probe
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec /home/weave/probe
exec /home/weave/probe $(cat /etc/weave/probe.args)