Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update the run_demo script to add background mode and usage info #423

Merged
merged 3 commits into from
Mar 16, 2020
Merged
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
39 changes: 37 additions & 2 deletions demo/run_demo
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ do
fi
case $i in
--events)
EVENTS=1
if [[ "${AGENT}" == "performance" ]] ; then
echo -e "\nIgnoring the \"--events\" option when running the ${AGENT} agent.\n"
else
EVENTS=1
fi
continue
;;
--debug-ptvsd)
Expand Down Expand Up @@ -46,6 +50,37 @@ do
echo "For example, to create the directory and then set the permissions use: 'mkdir ../logs; chmod uga+rws ../logs'"
exit 1
fi
;;
--bg)
if [[ "${AGENT}" == "alice" ]] || [[ "${AGENT}" == "faber" ]] || [[ "${AGENT}" == "acme" ]]; then
DOCKER_OPTS="-d"
echo -e "\nRunning in ${AGENT} in the background. Note that you cannot use the command line console in this mode."
echo To see the logs use: \"docker logs ${AGENT}\".
echo While viewing logs, hit CTRL-C to return to the command line.
echo To stop the agent, use: \"docker stop ${AGENT}\". The docker environment will
echo -e "be removed on stop.\n\n"
else
echo The "bg" option \(for running docker in detached mode\) is only for agents Alice, Faber and Acme.
echo Ignoring...
fi
continue
;;
--help)
cat <<EOF

Usage:
./demo_run <agent> [OPTIONS]

- <agent> is one of alice, faber, acme, performance.
- Options:
--events - display on the terminal the webhook events from the ACA-Py agent.
--timing - at the end of the run, display timing; relevant to the "performance" agent.
--bg - run the agent in the background; for use when using OpenAPI/Swagger interface
debug options: --debug-pycharm-agent-port <port>; --debug-pycharm-controller-port <port>
--debug-pycharm; --debug-ptvsd

EOF
exit 0
;;
esac
ARGS="${ARGS:+$ARGS }$i"
Expand Down Expand Up @@ -128,7 +163,7 @@ fi
DOCKER=${DOCKER:-docker}

echo "Starting $AGENT..."
$DOCKER run --name $AGENT --rm -it \
$DOCKER run --name $AGENT --rm -it ${DOCKER_OPTS} \
-p 0.0.0.0:$AGENT_PORT_RANGE:$AGENT_PORT_RANGE \
-v "/$(pwd)/../logs:/home/indy/logs" \
$DOCKER_ENV \
Expand Down