forked from stevensu1977/UE4-PixelStreaming-Container
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tools.sh
executable file
·119 lines (94 loc) · 2.41 KB
/
tools.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
#build function
build() {
TAG_NAME=$1
if [ "$TAG_NAME" == "" ] ; then
TAG_NAME="pixelstreaming-demo"
fi
echo "TAG_NAME:${TAG_NAME}"
docker build -t ${TAG_NAME} .
}
#stop function
stop(){
docker-compose $COMPOSE_FLAGS down
}
#ps function
dcps(){
docker-compose $COMPOSE_FLAGS ps
}
start(){
# Determine which release of the Unreal Engine we will be running container images for
UNREAL_ENGINE_RELEASE="4.27"
if [[ ! -z "$1" ]]; then
HTTP_PORT="$1"
else
HTTP_PORT=10001
fi
if [[ ! -z "$2" ]]; then
TURN_PORT="$2"
else
TURN_PORT=3578
fi
if [[ ! -z "$3" ]]; then
STREAMER_PORT="$3"
else
STREAMER_PORT=8888
fi
# Verify that either curl is available
if which curl 1>/dev/null; then
HTTPS_COMMAND="curl -s"
else
echo "Please install curl"
exit 1
fi
# Retrieve the public IP address of the host system
PUBLIC_IP=$($HTTPS_COMMAND 'http://169.254.169.254/latest/meta-data/public-ipv4')
# Run the Pixel Streaming example
export UNREAL_ENGINE_RELEASE
export EXTRA_PEERCONNECTION_OPTIONS
export PUBLIC_IP
export TURN_PORT
export HTTP_PORT
export STREAMER_PORT
export PWD=$(pwd)
docker-compose $COMPOSE_FLAGS up -d --force-recreate
echo ""
echo http://${PUBLIC_IP}:${HTTP_PORT}
echo ""
}
#main
if [[ $# -lt 1 ]]; then
echo "tools.sh build|start|ps|stop"
else
if [[ ! -z "$PROJECT_NAME" ]]; then
COMPOSE_FLAGS="--project-name ${PROJECT_NAME}"
echo "docker-compose project: ${PROJECT_NAME}"
else
COMPOSE_FLAGS=""
fi
OPTION=$1
case $OPTION in
"build")
echo "############BUILD############"
build ${2}
echo "############BUILD SUCCESSFUL############"
;;
"start")
echo "############START############"
start ${2} ${3} ${4}
echo "############START SUCCESSFUL############"
;;
"ps")
echo "############PS############"
dcps
;;
"stop")
echo "############STOP############"
stop
echo "############STOP SUCCESSFUL############"
;;
*)
echo "tools.sh build|start|stop"
exit 1
esac
fi