Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit ee82bd3

Browse files
authored
Update SignallingWebServer platform scripts to support Mac (#389)
* Update SignallingWebServer platform scripts to support Mac x86_64 and Arm64 * Update bash scripts to default to Linux * Update coturn URLs to use the binaries provided by the PixelStreamingInfrastructure
1 parent 952b309 commit ee82bd3

File tree

3 files changed

+57
-18
lines changed

3 files changed

+57
-18
lines changed

SignallingWebServer/platform_scripts/bash/Start_TURNServer.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ echo ""
2525

2626
# Hmm, plain text
2727
realm="PixelStreaming"
28-
process="turnserver"
28+
process=""
29+
if [ "$(uname)" == "Darwin" ]; then
30+
process="${BASH_LOCATION}/coturn/bin/turnserver"
31+
else
32+
process="turnserver"
33+
fi
2934
arguments="-c turnserver.conf --allowed-peer-ip=$localip -p ${turnport} -r $realm -X $publicip -E $localip -L $localip --no-cli --no-tls --no-dtls --pidfile /var/run/turnserver.pid -f -a -v -u ${turnusername}:${turnpassword}"
3035

3136
# Add arguments passed to script to arguments for executable

SignallingWebServer/platform_scripts/bash/setup.sh

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
# Copyright Epic Games, Inc. All Rights Reserved.
33
BASH_LOCATION=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
NODE_VERSION=v18.17.0
45

56
pushd "${BASH_LOCATION}" > /dev/null
67

@@ -128,10 +129,25 @@ node_version=""
128129
if [[ -f "${BASH_LOCATION}/node/bin/node" ]]; then
129130
node_version=$("${BASH_LOCATION}/node/bin/node" --version)
130131
fi
131-
check_and_install "node" "$node_version" "v18.17.0" "curl https://nodejs.org/dist/v18.17.0/node-v18.17.0-linux-x64.tar.gz --output node.tar.xz
132-
&& tar -xf node.tar.xz
133-
&& rm node.tar.xz
134-
&& mv node-v*-linux-x64 \"${BASH_LOCATION}/node\""
132+
133+
node_url=""
134+
if [ "$(uname)" == "Darwin" ]; then
135+
arch=$(uname -m)
136+
if [[ $arch == x86_64* ]]; then
137+
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-darwin-x64.tar.gz"
138+
elif [[ $arch == arm* ]]; then
139+
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-darwin-arm64.tar.gz"
140+
else
141+
echo 'Incompatible architecture. Only x86_64 and ARM64 are supported'
142+
exit -1
143+
fi
144+
else
145+
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz"
146+
fi
147+
check_and_install "node" "$node_version" "$NODE_VERSION" "curl $node_url --output node.tar.xz
148+
&& tar -xf node.tar.xz
149+
&& rm node.tar.xz
150+
&& mv node-v*-*-* \"${BASH_LOCATION}/node\""
135151

136152
PATH="${BASH_LOCATION}/node/bin:$PATH"
137153
"${BASH_LOCATION}/node/lib/node_modules/npm/bin/npm-cli.js" install
@@ -144,20 +160,38 @@ setup_frontend
144160

145161
popd > /dev/null # BASH_SOURCE
146162

147-
#command #dep_name #get_version_string #version_min #install command
148-
coturn_version=$(if command -v turnserver &> /dev/null; then echo 1; else echo 0; fi)
149-
if [ $coturn_version -eq 0 ]; then
150-
if ! command -v apt-get &> /dev/null; then
151-
echo "Setup for the scripts is designed for use with distros that use the apt-get package manager" \
152-
"if you are seeing this message you will have to update \"${BASH_LOCATION}/setup.sh\" with\n" \
153-
"a package manger and the equivalent packages for your distribution. Please follow the\n" \
154-
"instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
155-
exit 1
163+
if [ "$(uname)" == "Darwin" ]; then
164+
if [ -d "${BASH_LOCATION}/coturn" ]; then
165+
echo 'CoTURN directory found...skipping install.'
156166
else
157-
if [ `id -u` -eq 0 ]; then
158-
check_and_install "coturn" "$coturn_version" "1" "apt-get install -y coturn"
167+
echo 'CoTURN directory not found...beginning CoTURN download for Mac.'
168+
coturn_url=""
169+
if [[ $arch == x86_64* ]]; then
170+
coturn_url="https://github.com/EpicGames/PixelStreamingInfrastructure/releases/download/v4.6.2-coturn-mac-x86_64/turnserver.zip"
171+
elif [[ $arch == arm* ]]; then
172+
coturn_url="https://github.com/EpicGames/PixelStreamingInfrastructure/releases/download/v4.6.2-coturn-mac-arm64/turnserver.zip"
173+
fi
174+
curl -L -o ./turnserver.zip "$coturn_url"
175+
mkdir "${BASH_LOCATION}/coturn"
176+
tar -xf turnserver.zip -C "${BASH_LOCATION}/coturn"
177+
rm turnserver.zip
178+
fi
179+
else
180+
#command #dep_name #get_version_string #version_min #install command
181+
coturn_version=$(if command -v turnserver &> /dev/null; then echo 1; else echo 0; fi)
182+
if [ $coturn_version -eq 0 ]; then
183+
if ! command -v apt-get &> /dev/null; then
184+
echo "Setup for the scripts is designed for use with distros that use the apt-get package manager" \
185+
"if you are seeing this message you will have to update \"${BASH_LOCATION}/setup.sh\" with\n" \
186+
"a package manger and the equivalent packages for your distribution. Please follow the\n" \
187+
"instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
188+
exit 1
159189
else
160-
check_and_install "coturn" "$coturn_version" "1" "sudo apt-get install -y coturn"
190+
if [ `id -u` -eq 0 ]; then
191+
check_and_install "coturn" "$coturn_version" "1" "apt-get install -y coturn"
192+
else
193+
check_and_install "coturn" "$coturn_version" "1" "sudo apt-get install -y coturn"
194+
fi
161195
fi
162196
fi
163197
fi

SignallingWebServer/platform_scripts/cmd/setup_coturn.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if exist coturn\ (
1212
echo CoTURN directory not found...beginning CoTURN download for Windows.
1313

1414
@Rem Download nodejs and follow redirects.
15-
curl -L -o ./turnserver.zip "https://github.com/mcottontensor/coturn/releases/download/v4.5.2-windows/turnserver.zip"
15+
curl -L -o ./turnserver.zip "https://github.com/EpicGames/PixelStreamingInfrastructure/releases/download/v4.5.2-coturn-windows/turnserver.zip"
1616

1717
@Rem Unarchive the .zip to a directory called "turnserver"
1818
mkdir coturn & tar -xf turnserver.zip -C coturn

0 commit comments

Comments
 (0)