freeciv_env / scripts /start_space.sh
thomasm6m6's picture
Upload folder using huggingface_hub
40f4ce7 verified
#!/usr/bin/env bash
set -eu
export FREECIV_SERVER_URL="${FREECIV_SERVER_URL:-http://127.0.0.1}"
export FREECIV_USERNAME="${FREECIV_USERNAME:-openenvbot}"
export FREECIV_CLIENT_PORT="${FREECIV_CLIENT_PORT:-6000}"
export FREECIV_TURN_TIMEOUT_S="${FREECIV_TURN_TIMEOUT_S:-120}"
export ENABLE_WEB_INTERFACE="${ENABLE_WEB_INTERFACE:-true}"
log_file=/tmp/start_space.log
: > "$log_file"
echo "[$(date -Iseconds)] start_space.sh boot" >> "$log_file"
(
while true; do
nginx=down
publite2=down
tomcat=down
if curl -fsS --max-time 2 http://127.0.0.1/ >/dev/null 2>&1; then nginx=up; fi
if curl -fsS --max-time 2 http://127.0.0.1/pubstatus >/dev/null 2>&1; then publite2=up; fi
if curl -fsS --max-time 2 http://127.0.0.1:8080/freeciv-web/ >/dev/null 2>&1; then tomcat=up; fi
echo "[$(date -Iseconds)] nginx=$nginx publite2=$publite2 tomcat=$tomcat" >> "$log_file"
sleep 2
done
) &
exec python -m uvicorn server.app:app --host 0.0.0.0 --port 8000 --ws-ping-interval 300 --ws-ping-timeout 300