File size: 1,056 Bytes
925a64b
 
 
 
 
 
 
 
 
40f4ce7
 
 
925a64b
40f4ce7
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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