# OpenFUT FIFA-17 FUT backend — declarative deployment (server side, runs on 120).
#
#   cp .env.example .env    # set OPENFUT_ADVERTISE to THIS host's LAN IP
#   docker compose up -d --build
#
# Brings up the 5 responders the game dials. OPENFUT_ADVERTISE is the address
# the servers hand the client (105) for every next hop (Blaze, roster, UTAS,
# POW) and is required — there is no silent loopback fallback in remote mode.
#
# The client (105) still needs its first-hop redirect (hook or DNAT) plus
# autopatch.py running locally; see client_arm.sh and the FIFARUNBOOK.
name: openfut-fut-backend

services:
  fut-backend:
    build:
      context: ../..
      dockerfile: docker/fifa17-python/Dockerfile
    image: openfut-fut-backend:dev
    container_name: openfut-fut-backend
    restart: unless-stopped
    environment:
      # Bind all interfaces inside the container.
      OPENFUT_BIND: "${OPENFUT_BIND:-0.0.0.0}"
      # Address advertised to the client for the next hop. MUST be this host's
      # LAN IP as seen from the game machine (105). Required (see .env.example).
      OPENFUT_ADVERTISE: "${OPENFUT_ADVERTISE:?set OPENFUT_ADVERTISE in .env to this host's LAN IP, e.g. 203.0.113.10}"
      # POW content advertises port 8080 by default, which collides with the
      # openfut-core publish on this host. Remap it to 8085 on the host and
      # advertise the remapped endpoint.
      POW_CONTENT_ADDR: "0.0.0.0:8080"
      POW_CONTENT_HOST: "${OPENFUT_ADVERTISE}:8085"
      # Launcher-selected EA/Origin identity shared by LSX, Blaze, POW and UTAS.
      # FUT saves are isolated by persona beneath /state/accounts.
      FUT_ACCOUNT_PATH: "/state/active_account.json"
      FUT_PROFILE_ROOT: "/state/accounts"
      FUT_SETTINGS: "off"
      FUT_MODES: "1"
    volumes:
      - "../state:/state"
    ports:
      - "4216:4216"      # LSX (Origin bootstrap)
      - "42127:42127"    # Blaze redirector (TLS)
      - "42130:42130"    # Blaze main
      - "42131:42131"    # Nucleus OAuth stub
      - "8081:8081"      # FUT roster XML (HTTPS)
      - "8099:8099"      # UTAS / RS4 FUT REST API
      - "8094:8094"      # POW / EASFC API
      - "8085:8080"      # POW content (host 8085 -> container 8080; avoids core:8080)
