Lobby Server

The Lobby Server is a public server which handles Player authentication and lists Drafting Servers to help Players and Spectators find and join them.

 

Development

The Lobby Server project can be found in the NautDrafter_Lobby project in the repository.

 

Installation

The Lobby Server requires the following in order to run:

  • Java 8
  • Networking
    • The ability to bind to a port (default 50000)
    • Unfiltered network access on that port (will NOT work through a HTTP proxy)
    • Persistant connections must be allowed (will NOT work through a proxy that kills idle connections)
  • Filesystem Access
    • Must be able to write to whatever directory it is installed to. This is so it can save database files.
  • Config
    • Requires a Steam API key in a file named STEAM_API_KEY in the installation directory. This file can be found in the private NautDrafter Installer repository.

A distributable package of the Lobby Server and its dependencies can be created by cloning the repository, and running ./gradlew NautDrafter_Lobby:disttar

 

Updating

To build a Lobby Server
./gradlew clean distTar
To upload a Lobby Server to the DigitalOcean instance
username= # your username on the DigitalOcean instance
version=  # "0.3.0 (for stable) or 0.3.0-dev (for dev)
scp NautDrafter_Lobby/build/distributions/NautDrafter_Lobby.tar ${username}@server.nautdrafter.monky-games.com:~/lobby.tar
ssh ${username}@server.nautdrafter.monky-games.com
mkdir /opt/nautdrafter/versions/{version}
cd /opt/nautdrafter/versions/{version}
tar -xvf ~/lobby.tar
To (re)start the Lobby Servers
 cd /opt/nautdrafter
./servers.sh
/opt/nautdrafter/servers.sh
#!/bin/bash
set_steam() {
        rm stable/STEAM_API_KEY
        rm dev/STEAM_API_KEY
        ln -s /opt/nautdrafter/STEAM_API_KEY stable/STEAM_API_KEY
        ln -s /opt/nautdrafter/STEAM_API_KEY dev/STEAM_API_KEY
}
# runs the server
run() {
    {
        echo
        echo "--------------------------------------------"
        echo
        echo
        nohup NautDrafter_Lobby/bin/NautDrafter_Lobby
    } >>lobby.log 2>&1 &
}
run_with_save() {
    {
        echo
        echo "--------------------------------------------"
        echo
        echo
        nohup NautDrafter_Lobby/bin/NautDrafter_Lobby server.nautdrafter.monky-games.com 50001 /opt/nautdrafter/summaries
    } >>lobby.log 2>&1 &
}
print_usage(){
    echo "Usage: server.bash both|stable|dev"
}
kill_java(){
    echo "Killing any running servers"
    echo "(hope you're not running any other java programs :P)"
    killall java
}
setup_servers(){
    kill_java
    echo "Settings Steam API Key"
    set_steam
}
start_stable_server(){
    echo "Starting stable server"
    pushd .
    cd stable
    run
    popd
}
start_dev_server(){
    echo "Starting dev server"
    pushd .
    cd dev
    run_with_save
    popd
}

if [ "$#" -ne 1 ]; then
    print_usage
    exit 1;
fi

if [ $1 == 'both' ]; then
    setup_servers
    start_stable_server
    start_dev_server
elif [ $1 == 'stable' ]; then
    setup_servers
    start_stable_server
elif [ $1 == 'dev' ]; then
    setup_servers
    start_dev_server
else
    print_usage
    exit 1;
fi
echo "Servers started"