Spaces:
Runtime error
Runtime error
File size: 1,070 Bytes
8dc7642 8f25d8f 8dc7642 8f25d8f 8dc7642 8f25d8f 8dc7642 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/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"
log() {
local line
line="[$(date -Iseconds)] $*"
echo "$line" | tee -a "$log_file" >&2
}
service_status() {
local name url
name="$1"
url="$2"
if curl -fsS --max-time 2 "$url" >/dev/null 2>&1; then
echo "$name=up"
else
echo "$name=down"
fi
}
log "start_space.sh boot"
(
while true; do
log "$(service_status nginx http://127.0.0.1/) $(service_status publite2 http://127.0.0.1/pubstatus) $(service_status tomcat http://127.0.0.1:8080/freeciv-web/)"
sleep 2
done
) &
log "starting uvicorn immediately"
exec python -m uvicorn server.app:app --host 0.0.0.0 --port 8000 --ws-ping-interval 300 --ws-ping-timeout 300
|