forked from facebookresearch/fbpcf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-millionaire-sample.sh
executable file
·56 lines (48 loc) · 1.31 KB
/
run-millionaire-sample.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
PROG_NAME=$0
usage() {
cat << EOF >&2
Usage: $PROG_NAME [-u | -c]
-c: runs the millionaire sample using the centos docker image
-u: runs the millionaire sample using the ubuntu docker image (default)
EOF
exit 1
}
IMAGE_PREFIX="ubuntu"
while getopts u,c o; do
case $o in
(u) IMAGE_PREFIX="ubuntu";;
(c) IMAGE_PREFIX="centos";;
(*) usage
esac
done
shift "$((OPTIND - 1))"
FBPCF_IMAGE=fbpcf/${IMAGE_PREFIX}:latest
if docker image inspect ${FBPCF_IMAGE} > /dev/null 2>&1; then
printf "Found %s docker image... \n" ${FBPCF_IMAGE}
else
printf "ERROR: Unable to find docker image %s. Please run build-docker.sh \n" ${FBPCF_IMAGE}
exit 1
fi
docker run --rm \
--network=host ${FBPCF_IMAGE} \
millionaire \
--role=1 \
--port=5000 \
2>&1 publisher & # Fork to background so "partner" can run below
if docker run --rm \
--network=host ${FBPCF_IMAGE} \
millionaire \
--role=2 \
--port=5000 \
--server_ip=127.0.0.1; then
printf "Millionaire ran successfully! "
else
printf "Something went wrong. You may want to check the logs above."
exit 1
fi