Jump to content

OpenSimulator Internals/Walkthroughs/Bring Up Grid

From Open Simulator Technical Help

OpenSimulator Internals/Walkthroughs/Bring Up Grid

[edit]

Overview

[edit]

Traces what happens from running the ROBUST executable to the grid being ready to accept simulator registrations and logins.

See OpenSimulator Internals/Code Map/ROBUST for the component reference this walkthrough is built from.


Steps

[edit]

1. Process starts

[edit]
OpenSim/Server/ServerMain.cs -- OpenSimServer.Main()

Culture set, .NET HTTP client defaults configured (connection limit 64, Nagle off, certificate validation callback installed).

2. Config loaded

[edit]
OpenSim/Server/Base/HttpServerBase.cs (constructor)

Robust.ini loaded, Include-* files merged, environment variables merged, command line args applied last. Variable substitution expands ${Section|Key} references. [Network] section read for port and SSL settings -- port is mandatory, startup throws if missing.

No database activity yet.

3. HTTP server starts

[edit]

Main HTTP server bound to the port from [Network] (8002 on osimdev). Optional SSL listener if configured. Server is running but has no handlers registered yet.

4. Connector list assembled

[edit]

[Startup].ServiceConnectors and all keys in [ServiceList] are merged into one list.

5. Connectors loaded one at a time

[edit]

For each entry (format configName@port/dll:class):

  1. Port parsed -- if specified, MainServer.GetHttpServer(port) creates or retrieves a server on that port. T1's GatekeeperServiceInConnector, LLLoginServiceInConnector, GridInfoServerInConnector etc. run on the public port (8002). GridServiceConnector, AssetServiceConnector etc. run on the private port (8003).
  2. ServerUtils.LoadPlugin<IServiceConnector>() instantiates the class via reflection
  3. Each connector's constructor:
    • Reads its own config section (e.g. [GridService], [AssetService])
    • Loads its LocalServiceModule -- the actual service implementation (e.g. GridService.cs)
    • The service implementation's constructor opens a MySQL connection and runs schema migrations (MIGRATIONS log lines -- "GridStore data tables already up to date at revision 10" etc.)
    • Registers its HTTP handlers on the server for that port

This is the step where the database tables are created or verified for every service: regions, UserAccounts, Avatars, GridUser, auth, tokens, inventoryfolders, inventoryitems, assets, Friends, AgentPrefs, Presence, hg_traveling_data.

Special case: LLLoginServiceInConnector gets an IndexPHPHandler added to its server before its own handlers are registered.

6. GridService specifically

[edit]

See OpenSimulator Internals/Code Map/ROBUST service table and OpenSimulator Internals/GridService for full detail.

GridService constructor:

  1. Reads DeleteOnUnregister, AllowDuplicateNames, AllowHypergridMapSearch from [GridService]
  2. Loads AuthenticationService if configured
  3. Registers console commands (show regions, set region flags, etc.) -- only the first instance does this
  4. Calls SetExtraServiceURLs() -- populates m_ExtraFeatures from [LoginService] and Hypergrid config (search URL, map tile URL, grid name, grid nick, gatekeeper URI)
  5. Creates HypergridLinker if HypergridLinker = true -- throws if HyperGrid config section missing

No regions are registered in the database yet at this point -- the regions table is empty (or holds stale entries from a previous run that have not yet timed out).

7. Platform DLL fixup

[edit]

System.Drawing.Common.dll is copied for the current OS (Windows vs Linux) before the rest of startup completes.

8. Startup logo, plugin loader

[edit]

robuststartuplogo.txt printed if present. PluginLoader created for registry-based plugins (not used in a typical setup).

9. Main loop

[edit]

m_Server.Run() enters the console prompt loop. ROBUST is now up and listening on both ports, with every service's database schema verified, but no simulator has registered yet.


Database State After This Walkthrough

[edit]
Table State
regions Empty (fresh grid) or stale entries from previous run
UserAccounts GRID SERVICES system account only (UserLevel 240)
auth Empty
assets ~2600 library assets loaded by AssetService on its own startup path
All other tables Empty

What Happens Next

[edit]

A simulator process starting up and calling RegisterRegion() is the next walkthrough -- see OpenSimulator Internals/Walkthroughs/Bring Up Region.


See Also

[edit]