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

Add script for deploying web game server #609

Merged
merged 1 commit into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions assets/scripts/setgame.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

sudo apt-get update > /dev/null; sudo apt-get -y install nodejs > /dev/null; sudo apt-get -y install git > /dev/null

git clone https://github.com/Jerenaux/westward.git > /dev/null

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 > /dev/null

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

sudo apt-get update > /dev/null

sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mongodb-org=4.0.5 mongodb-org-server=4.0.5 mongodb-org-shell=4.0.5 mongodb-org-mongos=4.0.5 mongodb-org-tools=4.0.5 > /dev/null

sudo service mongod start

cd ~/westward

sudo npm install > /dev/null

touch .env

sudo nohup node dist/server.js 1>/dev/null 2>&1 &

str=$(curl https://api.ipify.org)

printf "\nGameServer is ready. Access http://%s:8081\n" $str
37 changes: 37 additions & 0 deletions src/testclient/scripts/sequentialFullTest/deploy-game-js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
TestSetFile=${4:-../testSet.env}
if [ ! -f "$TestSetFile" ]; then
echo "$TestSetFile does not exist."
exit
fi
source $TestSetFile
source ../conf.env

echo "####################################################################"
echo "## Command (SSH) to MCIS "
echo "####################################################################"

CSP=${1}
REGION=${2:-1}
POSTFIX=${3:-developer}

source ../common-functions.sh
getCloudIndex $CSP

MCISID=${CONN_CONFIG[$INDEX, $REGION]}-${POSTFIX}

if [ "${INDEX}" == "0" ]; then
# MCISPREFIX=avengers
MCISID=${MCISPREFIX}-${POSTFIX}
fi

CMD="wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/master/assets/scripts/setgame.sh -O ~/setgame.sh; chmod +x ~/setgame.sh; sudo ~/setgame.sh"
echo "CMD: $CMD"

VAR1=$(curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NSID/cmd/mcis/$MCISID -H 'Content-Type: application/json' -d @- <<EOF
{
"command" : "${CMD}"
}
EOF
)
echo "${VAR1}" | jq ''
echo ""