Server Overview

From Spire Trading Inc.
Jump to: navigation, search

Server Overview

Spire is a distributed trading platform composed of multiple specialized servers that work together to provide a complete trading infrastructure. Each server is independently deployable, communicates through well-defined service interfaces, and authenticates through a central Service Locator.

Architecture Principles

Service-Oriented Design - Each server provides a focused set of functionality

Distributed Deployment - Services can be deployed across multiple machines for scalability

Centralized Authentication - All services authenticate through the Service Locator

Persistent Storage - Critical data persisted to MySQL for durability

Real-time Updates - Services publish updates to subscribed clients

Service Categories

Infrastructure Services

Service Locator - Centralized authentication, account management, and service discovery

Uid Server - Generates unique identifiers for orders and other entities

Account & Administration

Administration Server - Manages account roles, entitlements, risk parameters, and trading permissions

Web Portal - Web-based interface for account management and administrative tasks

Market Data

Definitions Server - Provides reference data (countries, currencies, venues, trading schedules)

Market Data Server - Receives, sequences, and persists market data from feed clients

Market Data Relay Server - Load-balanced distribution of market data to end users

Charting Server - Processes time series queries for candlestick and technical analysis data

Trading Controls

Compliance Server - Manages compliance rules and monitors violations

Risk Server - Monitors profit/loss, enforces risk limits, manages account state transitions

Order Execution Server - Routes orders to venues, tracks execution, enforces controls

Common Operational Patterns

All servers follow consistent operational patterns:

Configuration via YAML files

Setup scripts for generating configurations

Standard start/stop/check scripts

Timestamped log files in logs/ directory

PID-based process management

System-Wide Management

In addition to individual server management scripts, the platform provides aggregate scripts for managing all servers collectively.

install.sh

The install.sh script is designed for the latest Ubuntu Server LTS and performs a complete system installation including:

  • Installing system dependencies (build tools, MySQL, Node.js, Python packages)
  • Building all server applications
  • Configuring MySQL database and creating the spire schema
  • Creating service accounts in the Service Locator
  • Setting up initial permissions and directory structure
  • Configuring all servers with appropriate network settings

Usage:

./install.sh -p [password] [options]

Required:
  -p    Password for Spire services

Optional:
  -u    MySQL username (default: spireadmin)
  -m    MySQL password (default: same as -p)
  -i    Global network interface (default: auto-detected)

The installation script automatically creates service accounts for all servers and assigns them to the appropriate permission groups.

setup.py

The setup.py script configures all servers by propagating common settings across individual server configurations:

python setup.py [options]

Optional:
  --local            Local network interface
  --world            Global/public network interface
  --address          Service Locator address
  --password         Service account password
  --mysql_address    MySQL server address
  --mysql_username   MySQL username
  --mysql_password   MySQL password
  --mysql_schema     MySQL schema name

This script calls each server's individual setup script with appropriate parameters, ensuring consistent configuration across the platform.

start.sh

The start.sh script starts all servers in dependency order:

  1. Service Locator
  2. Uid Server
  3. Definitions Server
  4. Administration Server
  5. Market Data Server
  6. Market Data Relay Server
  7. Charting Server
  8. Compliance Server
  9. Order Execution Server
  10. Risk Server
  11. Web Portal
  12. Market Data Feed Client

After starting all servers, the script automatically runs reset_risk_states.py to initialize risk state for the trading session.

stop.sh

The stop.sh script gracefully stops all servers in reverse dependency order, ensuring that dependent services shut down before the services they depend on.

check.sh

The check.sh script verifies that all servers are running and reports the status of each service. It exits with a non-zero status if any server is not running, making it suitable for monitoring and health check automation.