ORE Studio Geo Component

Geolocation services for IP-to-location lookups in ORE Studio.

Component Architecture

Diagram:

Description

Figure 1: ORE Studio Geo Component Diagram

Provides geolocation capabilities for mapping IP addresses to geographic locations. Used primarily for session tracking to record where logins originate from. Key features:

  • PostgreSQL Storage: Stores MaxMind GeoLite2-City data in PostgreSQL
  • IP to Location: Maps IP addresses to country, city, and coordinates
  • Thread Safe: All lookup operations are thread-safe for concurrent access
  • GiST Indexes: Uses PostgreSQL native inet type with GiST indexes for efficient lookups

The service namespace provides the geolocation_service implementation that queries PostgreSQL geoip tables.

Data Source

MaxMind GeoLite2-City CSV

The data source is the MaxMind GeoLite2-City database in CSV format:

PostgreSQL Schema

Geolocation data is stored in PostgreSQL with the following tables:

  • geoip_locations: Country, city, and timezone data
  • geoip_blocks_ipv4: IPv4 CIDR blocks mapped to locations
  • geoip_blocks_ipv6: IPv6 CIDR blocks mapped to locations
  • geoip_lookup(): Function to lookup IP address and return location data

Setup Instructions

  1. Create the schema:

    psql -d ores -f projects/ores.sql/create/geolocation_create.sql
    
  2. Download and extract GeoLite2-City-CSV.zip from MaxMind
  3. Import the data:

    psql -d ores -v data_dir='/path/to/GeoLite2-City-CSV' \
         -f projects/ores.sql/data/geolocation_import.sql
    
Top: Documentation Previous: System Model