Working dedicated server on Debian 8.6 x64
-
Got it working on Debian x64. I want to share my scripts how I did it, it is like @coteyr said here but more detailed.
## Set up dedicated screeps server.
# Tested only on Debian 8.6 x64 with 512mb.
## Dependencies
# To install steam, see https://wiki.debian.org/Steam
sudo apt-get install unzip git build-essential
## Setup node
# Probably not the simplest way but it works.
# Remove everything related to node, so that `node`, `nodejs`, `npm`, `n` or `node-gyp` is not found.
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
sudo aptitude install -y nodejs
sudo npm install npm@latest -g
sudo npm install node-gyp@latest -g
node -v # v6.9.1
npm -v # 3.10.9
node-gyp -v # v3.4.0
## Create user who will run server
adduser screeps
sudo su screeps# get ~/steamworks_sdk_137.zip from your steam developer account. It has to be v1.37!
## Set variables
STEAM_USER=
BETA_INVITE_CODE=
## Setup greenworks
cd ~
git clone https://github.com/greenheartgames/greenworks.git
cd greenworks/deps/
unzip ~/steamworks_sdk_137.zip
mv sdk steamworks_sdk
cd ..
npm install # if errors, do you have correct version of node and SDK?
## Setup steamcmd
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
rm -rf steamcmd
mkdir ~/steamcmd
cd ~/steamcmd
tar -xvzf ../steamcmd_linux.tar.gz
## Setup screeps for first time. It will ask password and always slows for 5-15min in the middle of download.
~/steamcmd/steamcmd.sh +force_install_dir ~/screeps +login $STEAM_USER +app_update 464350 -beta Server -betapassword $BETA_INVITE_CODE validate +exit
## Setup config: add steam_api_key from https://steamcommunity.com/dev/apikey
cd ~/screeps/server/
nano .screepsrc
## Setup launch scripts.
echo '#!/bin/bash
cd ~/steamcmd/
./steamcmd.sh +force_install_dir ~/screeps +login '$STEAM_USER' +app_update 464350 -beta Server -betapassword '$BETA_INVITE_CODE' validate +exit
cd ~/screeps/server
cp ~/greenworks/build/Release/greenworks-linux64.node ~/screeps/server/modules/backend/greenworks/lib/greenworks-linux64.node
for M in modules/*/
do
pushd $M
rm node_modules -Rf
npm install
npm build
popd
done
pushd modules/driver/native/
node-gyp configure
node-gyp build
popd
rm logs/* -Rf
node modules/launcher/bin/screeps.js start' > ~/rebuild_server.sh
chmod +x ~/rebuild_server.sh
echo '#!/bin/bash
cd ~/screeps/server
node modules/launcher/bin/screeps.js start' > ~/launch_server.sh
chmod +x ~/launch_server.sh
## Start server!
~/rebuild_server.sh
# ~/launch_server.sh
-
Nice, will try this to recreate it on RaspberryPi. Thanks for posting
update1: Raspbian doesnt support steam's architecture, retry with just debian.
-
I got this working on Raspberry Pi 3, woo!
I had to modify backend/lib/game/server.js and backend/lib/game/api/auth.js to comment out the greenworks API calls.backend/lib/game/server.js:
// try {
// if(!greenworks.isSteamRunning()) {
// throw new Error('Steam is not running');
// }
// if(!greenworks.initAPI()) {
// throw new Error('greenworks.initAPI() failure');
// }
// console.log("Connected to local Steam client, using native authentication");
// useNativeAuth = true;
// }
// catch(e) {
// console.log("Connecting to local Steam client failed:", e.message);
// Need these lines to use Steam Web API
console.log("Using Steam Web API authentication instead");
if (!process.env.STEAM_KEY) {
throw new Error('STEAM_KEY environment variable is not set!');
}
useNativeAuth = false;
// }backend/lib/game/api/auth.js:
if(request.body.useNativeAuth) {
if(!useNativeAuth) {
return q.reject('authentication method is not supported');
}
// Removed greenworks auth stuff... do we need to do something else?
}...but now all my rooms are red and I can't choose a spawn... possibly because I can't set a password?