Service Locator

From Spire Trading Inc.
Jump to: navigation, search

The Service Locator is a centralized server responsible for authenticating account logins, creating and managing user accounts, organizing accounts into directories, controlling permissions, and registering available services. It acts as a critical component for coordinating access control and service discovery. The Service Locator integrates with a MySQL database to persistently store account details, directory structures, permissions, and service registration data.

Configuration

The Service Locator is configured via a YAML file that defines its network interface and data store settings. Below is the structure of the configuration file with example values:

# The network interface and port the Service Locator binds to.
interface: "0.0.0.0:20000"

data_store:
  # The address of the MySQL server.
  address: "127.0.0.1:3306"
  # The username used to authenticate with MySQL.
  username: spireadmin
  # The password for the MySQL user.
  password: 1234
  # The name of the database schema where data is stored.
  schema: spire

A setup.py script is provided for convenience to configure the Service Locator and generate the config.yml file. The script supports the following arguments:

  --local 0.0.0.0                   # Local interface (default: auto-detected IP)
  --mysql_address 127.0.0.1:3306    # MySQL server address
  --mysql_username admin            # MySQL username (default: spireadmin)
  --mysql_password [REQUIRED]       # MySQL password (no default)
  --mysql_schema service_db         # Database schema (default: spire)

Logging

Log files are generated as srv_[YYYY][MM][DD]_[HH]_[MM]_[SS].log in the runtime directory. Upon termination, non-empty log files are moved into the log/ subfolder, while empty log files are deleted.

Management

The Service Locator is managed through three core scripts:

  • start.sh - Starts the Service Locator server. Does nothing if the server is already running.
  • stop.sh - Stops an existing server instance and waits for the server to terminate.
  • check.sh - Verifies that the server is running and reports its status.