Administration Server
Contents
Administration Server
The Administration Server manages account-level authorization and operational metadata for Spire. It maintains each account's role (trader, manager, administrator, or service), market-data entitlements, risk parameters, and trading permissions. By centralizing these attributes, it enforces access control, entitlement visibility, and trading eligibility across the system. The server integrates with the Service Locator to enumerate accounts and with a MySQL database to persist administrative data.
Configuration
The Administration Server is configured via a YAML file that defines network interfaces, database connection, Service Locator integration, and market-data entitlements. Below is the structure of the configuration file with example values:
---
server:
# Primary network interface and port the Administration Server binds to.
interface: "0.0.0.0:20100"
# List of addresses the server is reachable at (for registration with Service Locator).
# Typically includes both public-facing and local addresses.
addresses: ["198.51.100.5:20100", "10.0.0.5:20100"]
data_store:
# The address of the MySQL server (host:port).
address: "127.0.0.1:3306"
# The username for authenticating with MySQL.
username: spireadmin
# The password for the MySQL user.
password: 1234
# The name of the database schema where data is stored.
schema: spire
service_locator:
# The address of the Service Locator (host:port).
address: "10.0.0.5:20000"
# The account username used by the Administration Server to authenticate with the Service Locator.
username: administration_service
# The password for the Administration Server's Service Locator account.
password: admin_password
entitlements:
# Market-data entitlement definitions.
# Each entitlement specifies pricing, applicable exchanges, and message types.
- name: Demo Entitlements
price: 0.00
currency: USD
group: demo_entitlements
applicability:
# source: the venue disseminating the market data
# messages: market data message types
# BBO - best bid offer quotes
# BOOK - book quotes
# TAS - time and sales
# IMB - order imbalances
- source: CHIC
messages: [BBO, BOOK, TAS, IMB]
- source: XTSE
messages: [BBO, BOOK, TAS, IMB]
- source: XTSX
messages: [BBO, BOOK, TAS, IMB]
...
Installation & Setup
A setup.py script is provided to generate the final config.yml.
The script supports the following arguments:
python setup.py --local 0.0.0.0 # Local interface (default: auto-detected IP) --world 198.51.100.5 # Global/public interface (optional) --address 10.0.0.5:20000 # Service Locator address (default: local_interface:20000) --password [REQUIRED] # Administration password --mysql_address 127.0.0.1:3306 # MySQL server address --mysql_username spireadmin # MySQL username --mysql_password secretpw # MySQL password (default: --password if omitted) --mysql_schema spire # MySQL schema
Risk State Initialization Utility
A reset script (reset_risk_states.py) is provided to initialize or reset the risk state for all accounts and is typically run on a daily basis.
Operations
The Administration Server is controlled using three operational scripts: start.sh, stop.sh, and check.sh.
Log files are generated in the format:
srv_YYYYMMDD_HH_MM_SS.log
Upon startup, older log files are moved into the logs/ directory.
check.sh
The check.sh script verifies whether the server is currently running by inspecting the PID recorded in pid.lock and testing whether the associated process exists.
If the server is not running, it prints:
AdministrationServer is not running.
start.sh
The start.sh script:
Exits immediately if the server is already running
Creates a logs/ directory if necessary
Moves any existing srv_*.log files into logs/
Starts the AdministrationServer process in the background
Writes the PID to pid.lock
Reads network interfaces from config.yml and waits until the server is listening on at least one configured address
This ensures the server is fully initialized before the script exits.
stop.sh
The stop.sh script:
Reads the PID from pid.lock
Sends SIGINT to request a graceful shutdown
Waits for termination using exponential backoff (up to 300 seconds)
Sends SIGKILL if the server fails to stop cleanly
Appends a forced-termination message to the most recent log file (if applicable)
Removes the pid.lock file
This guarantees consistent shutdown behavior across normal and exceptional conditions.
