2022-07-14 10:55:56 +12:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
|
|
|
|
if [ -z "$(docker images -q neko_server_app 2> /dev/null)" ]; then
|
|
|
|
|
echo "Image 'neko_server_app' not found. Running ./build first."
|
|
|
|
|
./build
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z $NEKO_PORT ]; then
|
|
|
|
|
NEKO_PORT="3000"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z $NEKO_MUX ]; then
|
|
|
|
|
NEKO_MUX="52100"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z $NEKO_NAT1TO1 ]; then
|
|
|
|
|
for i in $(ifconfig -l 2>/dev/null); do
|
|
|
|
|
NEKO_NAT1TO1=$(ipconfig getifaddr $i)
|
|
|
|
|
if [ ! -z $NEKO_NAT1TO1 ]; then
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ -z $NEKO_NAT1TO1 ]; then
|
|
|
|
|
NEKO_NAT1TO1=$(hostname -i 2>/dev/null)
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-04-05 09:52:15 +12:00
|
|
|
|
# if first argument is nvidia, start with nvidia runtime
|
|
|
|
|
if [ "$1" = "nvidia" ]; then
|
|
|
|
|
echo "Starting nvidia docker image"
|
|
|
|
|
EXTRAOPTS="--gpus all"
|
|
|
|
|
CONFIG="config.nvidia.yml"
|
|
|
|
|
else
|
|
|
|
|
echo "Starting default docker image"
|
|
|
|
|
EXTRAOPTS=""
|
|
|
|
|
CONFIG="config.yml"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-07-14 10:55:56 +12:00
|
|
|
|
echo "Using app port: ${NEKO_PORT}"
|
|
|
|
|
echo "Using mux port: ${NEKO_MUX}"
|
|
|
|
|
echo "Using IP address: ${NEKO_NAT1TO1}"
|
|
|
|
|
|
|
|
|
|
# start server
|
|
|
|
|
docker run --rm -it \
|
|
|
|
|
--name "neko_server_dev" \
|
|
|
|
|
-p "${NEKO_PORT}:8080" \
|
|
|
|
|
-p "${NEKO_MUX}:${NEKO_MUX}/tcp" \
|
|
|
|
|
-p "${NEKO_MUX}:${NEKO_MUX}/udp" \
|
|
|
|
|
-e "NEKO_WEBRTC_UDPMUX=${NEKO_MUX}" \
|
|
|
|
|
-e "NEKO_WEBRTC_TCPMUX=${NEKO_MUX}" \
|
|
|
|
|
-e "NEKO_WEBRTC_NAT1TO1=${NEKO_NAT1TO1}" \
|
2023-03-28 05:33:51 +13:00
|
|
|
|
-e "NEKO_SESSION_FILE=/home/neko/sessions.txt" \
|
2023-04-05 09:52:15 +12:00
|
|
|
|
-v "${PWD}/runtime/$CONFIG:/etc/neko/neko.yml" \
|
2022-07-14 10:55:56 +12:00
|
|
|
|
-e "NEKO_DEBUG=1" \
|
2023-04-05 09:52:15 +12:00
|
|
|
|
--shm-size=2G \
|
|
|
|
|
$EXTRAOPTS \
|
2022-07-14 10:55:56 +12:00
|
|
|
|
neko_server_app:latest;
|