openvibers/source.openvibe.games Commits
Harden local SRCDS shard startup
Changes
@@@ -1,5 +1,6 @@// Shared local development defaults for OpenVibe: Source.sv_lan 1++sv_master_share_game_socket 1sv_cheats 0sv_pure 0developer 1@@@ -1,4 +1,4 @@#!/usr/bin/env bashset -euo pipefail--exec "$(dirname "$0")/run-server.sh" deathrun 27017 dr_openvibe_dev 24 openvibe_deathrun.cfg++exec "$(dirname "$0")/run-server.sh" deathrun "${OPENVIBE_DEATHRUN_PORT:-27017}" dr_openvibe_dev "${OPENVIBE_DEATHRUN_MAXPLAYERS:-24}" openvibe_deathrun.cfg@@@ -1,4 +1,4 @@#!/usr/bin/env bashset -euo pipefail--exec "$(dirname "$0")/run-server.sh" fortwars 27018 fw_openvibe_dev 32 openvibe_fortwars.cfg++exec "$(dirname "$0")/run-server.sh" fortwars "${OPENVIBE_FORTWARS_PORT:-27018}" fw_openvibe_dev "${OPENVIBE_FORTWARS_MAXPLAYERS:-32}" openvibe_fortwars.cfg@@@ -1,4 +1,4 @@#!/usr/bin/env bashset -euo pipefail--exec "$(dirname "$0")/run-server.sh" hub 27015 ov_hub 48 openvibe_hub.cfg++exec "$(dirname "$0")/run-server.sh" hub "${OPENVIBE_HUB_PORT:-27015}" ov_hub "${OPENVIBE_HUB_MAXPLAYERS:-48}" openvibe_hub.cfg@@@ -1,4 +1,4 @@#!/usr/bin/env bashset -euo pipefail--exec "$(dirname "$0")/run-server.sh" prophunt 27016 ph_openvibe_dev 24 openvibe_prophunt.cfg++exec "$(dirname "$0")/run-server.sh" prophunt "${OPENVIBE_PROPHUNT_PORT:-27016}" ph_openvibe_dev "${OPENVIBE_PROPHUNT_MAXPLAYERS:-24}" openvibe_prophunt.cfg@@@ -16,6 +16,9 @@ PORT="${OPENVIBE_SANDBOX_PORT:-27020}"MAP="${OPENVIBE_SANDBOX_MAP:-ov_hub}"MAXPLAYERS="${OPENVIBE_SANDBOX_MAXPLAYERS:-24}"BIND_IP="${OPENVIBE_BIND_IP:-127.0.0.1}"++CLIENTPORT="${OPENVIBE_CLIENTPORT:-$((PORT + 1000))}"++TVPORT="${OPENVIBE_TV_PORT:-$((PORT + 2000))}"++STEAMPORT="${OPENVIBE_STEAMPORT:-$((PORT - 115))}"MAP_DELAY="${OPENVIBE_SRCDS_MAP_DELAY:-6}"RELOAD_DELAY="${OPENVIBE_SANDBOX_RELOAD_DELAY:-8}"@@@ -50,9 +53,18 @@ server_cmd=(-usercon-ip "$BIND_IP"-port "$PORT"-- +clientport "$((PORT + 1000))"++ -steamport "$STEAMPORT"++)++++if [[ "${OPENVIBE_SRCDS_MASTER:-0}" != "1" ]]; then++ server_cmd+=(-nomaster)++fi++++server_cmd+=(++ +clientport "$CLIENTPORT"+maxplayers "$MAXPLAYERS"-- +tv_port "$((PORT + 2000))"++ +tv_port "$TVPORT"++ +sv_master_share_game_socket 1+exec openvibe_sandbox.cfg)@@@ -71,7 +83,9 @@ console_input() {filter_output() {sed -u \-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \-- -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d'++ -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d' \++ -e '/^Socket bound to non-default port 269[0-9][0-9] because original port was already in use\./d' \++ -e '/^WARNING: Port 26900 was unavailable - bound to port 269[0-9][0-9] instead/d'}if command -v script >/dev/null 2>&1; then@@@ -27,6 +27,9 @@ case "$MODE" inesacBIND_IP="${OPENVIBE_BIND_IP:-$DEFAULT_BIND_IP}"++CLIENTPORT="${OPENVIBE_CLIENTPORT:-$((PORT + 1000))}"++TVPORT="${OPENVIBE_TV_PORT:-$((PORT + 2000))}"++STEAMPORT="${OPENVIBE_STEAMPORT:-$((PORT - 115))}"if [[ ! -x "$SRCDS/srcds_linux64" ]]; thenecho "Missing 64-bit SRCDS at $SRCDS/srcds_linux64" >&2@@@ -63,9 +66,18 @@ server_cmd=(-usercon-ip "$BIND_IP"-port "$PORT"-- +clientport "$((PORT + 1000))"++ -steamport "$STEAMPORT"++)++++if [[ "${OPENVIBE_SRCDS_MASTER:-0}" != "1" ]]; then++ server_cmd+=(-nomaster)++fi++++server_cmd+=(++ +clientport "$CLIENTPORT"+maxplayers "$MAXPLAYERS"-- +tv_port "$((PORT + 2000))"++ +tv_port "$TVPORT"++ +sv_master_share_game_socket 1+exec "$CFG")@@@ -79,7 +91,9 @@ if [[ "${OPENVIBE_SRCDS_PIPE_MAP:-1}" == "1" ]]; thenfilter_output() {sed -u \-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \-- -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d'++ -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d' \++ -e '/^Socket bound to non-default port 269[0-9][0-9] because original port was already in use\./d' \++ -e '/^WARNING: Port 26900 was unavailable - bound to port 269[0-9][0-9] instead/d'}if command -v script >/dev/null 2>&1; then@@@ -1,4 +1,4 @@#!/usr/bin/env bashset -euo pipefail--exec "$(dirname "$0")/run-server.sh" traitortown 27019 tt_openvibe_dev 24 openvibe_traitortown.cfg++exec "$(dirname "$0")/run-server.sh" traitortown "${OPENVIBE_TRAITORTOWN_PORT:-27019}" tt_openvibe_dev "${OPENVIBE_TRAITORTOWN_MAXPLAYERS:-24}" openvibe_traitortown.cfg@@@ -9,12 +9,18 @@ run_check() {local name="$1"local script="$2"local map="$3"++ local port_env="$4"++ local smoke_port="$5"local log="/tmp/openvibe-srcds-$name.log"rm -f "$log"set +e-- timeout "${OPENVIBE_SRCDS_SMOKE_TIMEOUT:-70}s" "$ROOT/tools/$script" >"$log" 2>&1++ env "$port_env=$smoke_port" \++ OPENVIBE_CLIENTPORT="$((smoke_port + 1000))" \++ OPENVIBE_TV_PORT="$((smoke_port + 2000))" \++ OPENVIBE_STEAMPORT="$((smoke_port - 115))" \++ timeout "${OPENVIBE_SRCDS_SMOKE_TIMEOUT:-70}s" "$ROOT/tools/$script" >"$log" 2>&1local code=$?set -e@@@ -51,8 +57,10 @@ run_check() {echo "[srcds:$name] ok ($map)"}--run_check hub run-hub.sh ov_hub--run_check prophunt run-prophunt.sh ph_openvibe_dev--run_check deathrun run-deathrun.sh dr_openvibe_dev--run_check fortwars run-fortwars.sh fw_openvibe_dev--run_check traitortown run-traitortown.sh tt_openvibe_dev++BASE_PORT="${OPENVIBE_SRCDS_SMOKE_BASE_PORT:-37015}"++++run_check hub run-hub.sh ov_hub OPENVIBE_HUB_PORT "$BASE_PORT"++run_check prophunt run-prophunt.sh ph_openvibe_dev OPENVIBE_PROPHUNT_PORT "$((BASE_PORT + 1))"++run_check deathrun run-deathrun.sh dr_openvibe_dev OPENVIBE_DEATHRUN_PORT "$((BASE_PORT + 2))"++run_check fortwars run-fortwars.sh fw_openvibe_dev OPENVIBE_FORTWARS_PORT "$((BASE_PORT + 3))"++run_check traitortown run-traitortown.sh tt_openvibe_dev OPENVIBE_TRAITORTOWN_PORT "$((BASE_PORT + 4))"
@@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
// Shared local development defaults for OpenVibe: Source.
// Shared local development defaults for OpenVibe: Source.
sv_lan 1
sv_lan 1
+sv_master_share_game_socket 1
sv_cheats 0
sv_cheats 0
sv_pure 0
sv_pure 0
developer 1
developer 1
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail
-exec "$(dirname "$0")/run-server.sh" deathrun 27017 dr_openvibe_dev 24 openvibe_deathrun.cfg
+exec "$(dirname "$0")/run-server.sh" deathrun "${OPENVIBE_DEATHRUN_PORT:-27017}" dr_openvibe_dev "${OPENVIBE_DEATHRUN_MAXPLAYERS:-24}" openvibe_deathrun.cfg
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail
-exec "$(dirname "$0")/run-server.sh" fortwars 27018 fw_openvibe_dev 32 openvibe_fortwars.cfg
+exec "$(dirname "$0")/run-server.sh" fortwars "${OPENVIBE_FORTWARS_PORT:-27018}" fw_openvibe_dev "${OPENVIBE_FORTWARS_MAXPLAYERS:-32}" openvibe_fortwars.cfg
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail
-exec "$(dirname "$0")/run-server.sh" hub 27015 ov_hub 48 openvibe_hub.cfg
+exec "$(dirname "$0")/run-server.sh" hub "${OPENVIBE_HUB_PORT:-27015}" ov_hub "${OPENVIBE_HUB_MAXPLAYERS:-48}" openvibe_hub.cfg
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail
-exec "$(dirname "$0")/run-server.sh" prophunt 27016 ph_openvibe_dev 24 openvibe_prophunt.cfg
+exec "$(dirname "$0")/run-server.sh" prophunt "${OPENVIBE_PROPHUNT_PORT:-27016}" ph_openvibe_dev "${OPENVIBE_PROPHUNT_MAXPLAYERS:-24}" openvibe_prophunt.cfg
@@ -16,6 +16,9 @@ PORT="${OPENVIBE_SANDBOX_PORT:-27020}"
@@ -16,6 +16,9 @@ PORT="${OPENVIBE_SANDBOX_PORT:-27020}"
MAP="${OPENVIBE_SANDBOX_MAP:-ov_hub}"
MAP="${OPENVIBE_SANDBOX_MAP:-ov_hub}"
MAXPLAYERS="${OPENVIBE_SANDBOX_MAXPLAYERS:-24}"
MAXPLAYERS="${OPENVIBE_SANDBOX_MAXPLAYERS:-24}"
BIND_IP="${OPENVIBE_BIND_IP:-127.0.0.1}"
BIND_IP="${OPENVIBE_BIND_IP:-127.0.0.1}"
+CLIENTPORT="${OPENVIBE_CLIENTPORT:-$((PORT + 1000))}"
+TVPORT="${OPENVIBE_TV_PORT:-$((PORT + 2000))}"
+STEAMPORT="${OPENVIBE_STEAMPORT:-$((PORT - 115))}"
MAP_DELAY="${OPENVIBE_SRCDS_MAP_DELAY:-6}"
MAP_DELAY="${OPENVIBE_SRCDS_MAP_DELAY:-6}"
RELOAD_DELAY="${OPENVIBE_SANDBOX_RELOAD_DELAY:-8}"
RELOAD_DELAY="${OPENVIBE_SANDBOX_RELOAD_DELAY:-8}"
@@ -50,9 +53,18 @@ server_cmd=(
@@ -50,9 +53,18 @@ server_cmd=(
-usercon
-usercon
-ip "$BIND_IP"
-ip "$BIND_IP"
-port "$PORT"
-port "$PORT"
- +clientport "$((PORT + 1000))"
+ -steamport "$STEAMPORT"
+)
+
+if [[ "${OPENVIBE_SRCDS_MASTER:-0}" != "1" ]]; then
+ server_cmd+=(-nomaster)
+fi
+
+server_cmd+=(
+ +clientport "$CLIENTPORT"
+maxplayers "$MAXPLAYERS"
+maxplayers "$MAXPLAYERS"
- +tv_port "$((PORT + 2000))"
+ +tv_port "$TVPORT"
+ +sv_master_share_game_socket 1
+exec openvibe_sandbox.cfg
+exec openvibe_sandbox.cfg
)
)
@@ -71,7 +83,9 @@ console_input() {
@@ -71,7 +83,9 @@ console_input() {
filter_output() {
filter_output() {
sed -u \
sed -u \
-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \
-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \
- -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d'
+ -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d' \
+ -e '/^Socket bound to non-default port 269[0-9][0-9] because original port was already in use\./d' \
+ -e '/^WARNING: Port 26900 was unavailable - bound to port 269[0-9][0-9] instead/d'
}
}
if command -v script >/dev/null 2>&1; then
if command -v script >/dev/null 2>&1; then
@@ -27,6 +27,9 @@ case "$MODE" in
@@ -27,6 +27,9 @@ case "$MODE" in
esac
esac
BIND_IP="${OPENVIBE_BIND_IP:-$DEFAULT_BIND_IP}"
BIND_IP="${OPENVIBE_BIND_IP:-$DEFAULT_BIND_IP}"
+CLIENTPORT="${OPENVIBE_CLIENTPORT:-$((PORT + 1000))}"
+TVPORT="${OPENVIBE_TV_PORT:-$((PORT + 2000))}"
+STEAMPORT="${OPENVIBE_STEAMPORT:-$((PORT - 115))}"
if [[ ! -x "$SRCDS/srcds_linux64" ]]; then
if [[ ! -x "$SRCDS/srcds_linux64" ]]; then
echo "Missing 64-bit SRCDS at $SRCDS/srcds_linux64" >&2
echo "Missing 64-bit SRCDS at $SRCDS/srcds_linux64" >&2
@@ -63,9 +66,18 @@ server_cmd=(
@@ -63,9 +66,18 @@ server_cmd=(
-usercon
-usercon
-ip "$BIND_IP"
-ip "$BIND_IP"
-port "$PORT"
-port "$PORT"
- +clientport "$((PORT + 1000))"
+ -steamport "$STEAMPORT"
+)
+
+if [[ "${OPENVIBE_SRCDS_MASTER:-0}" != "1" ]]; then
+ server_cmd+=(-nomaster)
+fi
+
+server_cmd+=(
+ +clientport "$CLIENTPORT"
+maxplayers "$MAXPLAYERS"
+maxplayers "$MAXPLAYERS"
- +tv_port "$((PORT + 2000))"
+ +tv_port "$TVPORT"
+ +sv_master_share_game_socket 1
+exec "$CFG"
+exec "$CFG"
)
)
@@ -79,7 +91,9 @@ if [[ "${OPENVIBE_SRCDS_PIPE_MAP:-1}" == "1" ]]; then
@@ -79,7 +91,9 @@ if [[ "${OPENVIBE_SRCDS_PIPE_MAP:-1}" == "1" ]]; then
filter_output() {
filter_output() {
sed -u \
sed -u \
-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \
-e '/WARNING: Failed to load 32-bit libtinfo\.so\.5 or libncurses\.so\.5\./d' \
- -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d'
+ -e '/Please install (lib32tinfo5 \/ ncurses-libs\.i686 \/ equivalent) to enable readline\./d' \
+ -e '/^Socket bound to non-default port 269[0-9][0-9] because original port was already in use\./d' \
+ -e '/^WARNING: Port 26900 was unavailable - bound to port 269[0-9][0-9] instead/d'
}
}
if command -v script >/dev/null 2>&1; then
if command -v script >/dev/null 2>&1; then
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail
-exec "$(dirname "$0")/run-server.sh" traitortown 27019 tt_openvibe_dev 24 openvibe_traitortown.cfg
+exec "$(dirname "$0")/run-server.sh" traitortown "${OPENVIBE_TRAITORTOWN_PORT:-27019}" tt_openvibe_dev "${OPENVIBE_TRAITORTOWN_MAXPLAYERS:-24}" openvibe_traitortown.cfg
@@ -9,12 +9,18 @@ run_check() {
@@ -9,12 +9,18 @@ run_check() {
local name="$1"
local name="$1"
local script="$2"
local script="$2"
local map="$3"
local map="$3"
+ local port_env="$4"
+ local smoke_port="$5"
local log="/tmp/openvibe-srcds-$name.log"
local log="/tmp/openvibe-srcds-$name.log"
rm -f "$log"
rm -f "$log"
set +e
set +e
- timeout "${OPENVIBE_SRCDS_SMOKE_TIMEOUT:-70}s" "$ROOT/tools/$script" >"$log" 2>&1
+ env "$port_env=$smoke_port" \
+ OPENVIBE_CLIENTPORT="$((smoke_port + 1000))" \
+ OPENVIBE_TV_PORT="$((smoke_port + 2000))" \
+ OPENVIBE_STEAMPORT="$((smoke_port - 115))" \
+ timeout "${OPENVIBE_SRCDS_SMOKE_TIMEOUT:-70}s" "$ROOT/tools/$script" >"$log" 2>&1
local code=$?
local code=$?
set -e
set -e
@@ -51,8 +57,10 @@ run_check() {
@@ -51,8 +57,10 @@ run_check() {
echo "[srcds:$name] ok ($map)"
echo "[srcds:$name] ok ($map)"
}
}
-run_check hub run-hub.sh ov_hub
-run_check prophunt run-prophunt.sh ph_openvibe_dev
-run_check deathrun run-deathrun.sh dr_openvibe_dev
-run_check fortwars run-fortwars.sh fw_openvibe_dev
-run_check traitortown run-traitortown.sh tt_openvibe_dev
+BASE_PORT="${OPENVIBE_SRCDS_SMOKE_BASE_PORT:-37015}"
+
+run_check hub run-hub.sh ov_hub OPENVIBE_HUB_PORT "$BASE_PORT"
+run_check prophunt run-prophunt.sh ph_openvibe_dev OPENVIBE_PROPHUNT_PORT "$((BASE_PORT + 1))"
+run_check deathrun run-deathrun.sh dr_openvibe_dev OPENVIBE_DEATHRUN_PORT "$((BASE_PORT + 2))"
+run_check fortwars run-fortwars.sh fw_openvibe_dev OPENVIBE_FORTWARS_PORT "$((BASE_PORT + 3))"
+run_check traitortown run-traitortown.sh tt_openvibe_dev OPENVIBE_TRAITORTOWN_PORT "$((BASE_PORT + 4))"