<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.spiretrading.com/index.php?action=history&amp;feed=atom&amp;title=Administration_Server</id>
	<title>Administration Server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.spiretrading.com/index.php?action=history&amp;feed=atom&amp;title=Administration_Server"/>
	<link rel="alternate" type="text/html" href="https://wiki.spiretrading.com/index.php?title=Administration_Server&amp;action=history"/>
	<updated>2026-05-29T21:32:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.spiretrading.com/index.php?title=Administration_Server&amp;diff=133&amp;oldid=prev</id>
		<title>Kamal: Created page with &quot;The Administration Server manages account-level authorization and operational metadata for Spire. It maintains each account's role (trader, manager, administrator, or service)...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.spiretrading.com/index.php?title=Administration_Server&amp;diff=133&amp;oldid=prev"/>
		<updated>2026-05-27T19:47:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The Administration Server manages account-level authorization and operational metadata for Spire. It maintains each account&amp;#039;s role (trader, manager, administrator, or service)...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
The server integrates with the [[Service Locator]] to enumerate accounts and with a MySQL database to persist administrative data.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The Administration Server is configured via a YAML file with four top-level sections: &amp;lt;code&amp;gt;data_store&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;server&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;service_locator&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;entitlements&amp;lt;/code&amp;gt;. A &amp;lt;code&amp;gt;grant_interval&amp;lt;/code&amp;gt; setting may also be specified. Below is the structure of the configuration file with example values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
data_store:&lt;br /&gt;
  # The address of the MySQL server.&lt;br /&gt;
  address: &amp;quot;127.0.0.1:3306&amp;quot;&lt;br /&gt;
  # The username used to authenticate with MySQL.&lt;br /&gt;
  username: spireadmin&lt;br /&gt;
  # The password for the MySQL user.&lt;br /&gt;
  password: [REQUIRED]&lt;br /&gt;
  # The name of the database schema where data is stored.&lt;br /&gt;
  schema: spire&lt;br /&gt;
&lt;br /&gt;
server:&lt;br /&gt;
  # Primary network interface and port the Administration Server binds to.&lt;br /&gt;
  interface: &amp;quot;0.0.0.0:20100&amp;quot;&lt;br /&gt;
  # List of addresses the server is reachable at (for registration with Service Locator).&lt;br /&gt;
  # Typically includes both public-facing and local addresses.&lt;br /&gt;
  addresses: [&amp;quot;198.51.100.5:20100&amp;quot;, &amp;quot;10.0.0.5:20100&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
service_locator:&lt;br /&gt;
  # The address of the Service Locator (host:port).&lt;br /&gt;
  address: &amp;quot;10.0.0.5:20000&amp;quot;&lt;br /&gt;
  # The account username used to authenticate with the Service Locator.&lt;br /&gt;
  username: administration_server&lt;br /&gt;
  # The password for the Service Locator account.&lt;br /&gt;
  password: [REQUIRED]&lt;br /&gt;
&lt;br /&gt;
# Each entitlement specifies pricing, applicable exchanges, and message types.&lt;br /&gt;
entitlements:&lt;br /&gt;
  - name: &amp;quot;NYSE Basic&amp;quot;&lt;br /&gt;
    price: &amp;quot;10.00&amp;quot;&lt;br /&gt;
    currency: USD&lt;br /&gt;
    group: nyse_basic&lt;br /&gt;
    applicability:&lt;br /&gt;
      - venue: XNYS&lt;br /&gt;
        # source: the venue disseminating the market data&lt;br /&gt;
        source: XNYS&lt;br /&gt;
        messages: [BBO, TAS]&lt;br /&gt;
&lt;br /&gt;
# Interval at which entitlement grants are reapplied (default: 1 hour).&lt;br /&gt;
grant_interval: 1h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;setup.py&amp;lt;/code&amp;gt; script is provided to generate the final &amp;lt;code&amp;gt;config.yml&amp;lt;/code&amp;gt;. Usage:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  --local 0.0.0.0                   # Local interface (default: auto-detected IP)&lt;br /&gt;
  --world 198.51.100.5              # Global/public interface (optional)&lt;br /&gt;
  --address 10.0.0.5:20000          # Service Locator address (default: local_interface:20000)&lt;br /&gt;
  --password [REQUIRED]             # Admin password for Service Locator&lt;br /&gt;
  --mysql_address 127.0.0.1:3306    # MySQL server address&lt;br /&gt;
  --mysql_password secretpw         # MySQL password (default: --password if omitted)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reset script (&amp;lt;code&amp;gt;reset_risk_states.py&amp;lt;/code&amp;gt;) is provided to initialize or reset the risk state for all accounts and is typically run on a daily basis.&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
&lt;br /&gt;
The Administration Server is controlled using three operational scripts: &amp;lt;code&amp;gt;start.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stop.sh&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;check.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== start.sh ===&lt;br /&gt;
&lt;br /&gt;
* Exits immediately if the server is already running.&lt;br /&gt;
* Creates a &amp;lt;code&amp;gt;logs/&amp;lt;/code&amp;gt; directory if necessary.&lt;br /&gt;
* Moves any existing &amp;lt;code&amp;gt;srv_*.log&amp;lt;/code&amp;gt; files into &amp;lt;code&amp;gt;logs/&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Starts the &amp;lt;code&amp;gt;AdministrationServer&amp;lt;/code&amp;gt; process in the background.&lt;br /&gt;
* Reads network interfaces from &amp;lt;code&amp;gt;config.yml&amp;lt;/code&amp;gt; and waits until the server is listening on at least one configured address.&lt;br /&gt;
&lt;br /&gt;
This ensures the server is fully initialized before the script exits.&lt;br /&gt;
&lt;br /&gt;
=== stop.sh ===&lt;br /&gt;
&lt;br /&gt;
* Sends &amp;lt;code&amp;gt;SIGINT&amp;lt;/code&amp;gt; to request a graceful shutdown.&lt;br /&gt;
* Waits for termination using exponential backoff (up to 300 seconds).&lt;br /&gt;
* Sends &amp;lt;code&amp;gt;SIGKILL&amp;lt;/code&amp;gt; if the server fails to stop cleanly.&lt;br /&gt;
* Appends a forced-termination message to the most recent log file (if applicable).&lt;br /&gt;
&lt;br /&gt;
This guarantees consistent shutdown behavior across normal and exceptional conditions.&lt;br /&gt;
&lt;br /&gt;
=== check.sh ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;check.sh&amp;lt;/code&amp;gt; script verifies whether the server is currently running by inspecting the PID recorded in &amp;lt;code&amp;gt;pid.lock&amp;lt;/code&amp;gt; and testing whether the associated process exists.&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
&lt;br /&gt;
Upon startup, older log files are moved into the &amp;lt;code&amp;gt;logs/&amp;lt;/code&amp;gt; directory.&lt;/div&gt;</summary>
		<author><name>Kamal</name></author>
		
	</entry>
</feed>