Skip to content

WithinEarth Infrastructure Documentation

Welcome to the centralized technical documentation for WithinEarth infrastructure, architecture, and systems.

🏨 About WithinEarth

WithinEarth is a comprehensive Hotel Aggregation & Real-Time Booking Platform that powers the global travel industry.

What We Do

  • Aggregate 9.3 million hotels from 141 different suppliers worldwide
  • Serve 345 active travel agents with customized hotel access and permissions
  • Manage 33 million hotel-supplier mappings for optimal availability
  • Process ~2,300 requests per second with a target capacity of 6,000+ req/s
  • Handle real-time bookings, modifications, and cancellations across multiple supplier platforms

How It Works

When a travel agent searches for hotels through our platform:

  1. Permission Layer: Identifies which hotels the agent can access based on their profile
  2. Mapping Layer: Finds which suppliers (Expedia, Agoda, Booking.com, etc.) provide those hotels
  3. Configuration Layer: Filters based on agent's supplier restrictions and preferences
  4. Real-Time Pricing: Returns available hotels with live pricing from multiple suppliers
  5. Booking Management: Handles complete booking lifecycle (reserve, modify, cancel)

Platform Scale

Metric Value
Hotels Aggregated 9.3 million worldwide
Supplier Integrations 141 suppliers (Expedia, Agoda, Booking.com, HotelBeds, etc.)
Travel Agents Served 345 active agents
Hotel-Supplier Mappings 33 million mappings
Current Throughput ~2,300 requests/second
Target Capacity 6,000+ requests/second
Historical Bookings 1.5+ million completed
Average Response Time 300ms (P50), optimizing to <100ms

📚 Documentation Sections

Infrastructure

  • System Architecture - Complete end-to-end architecture (Hardware, VM, Services)
  • Server Inventory - All 60+ servers with roles and specifications
  • Network Architecture - Network topology, security, VPN, routing
  • Failover Systems - High availability and disaster recovery

Configuration

  • Database Configuration - SQL Server, MongoDB, Redis setup
  • Load Balancer Setup - HAProxy configuration and management
  • MCP Integration - Model Context Protocol with Claude AI

Deployment

  • API Deployment - XConnect API deployment procedures
  • Database Setup - Database installation and replication

Performance

  • Performance Analysis - Bottleneck identification and optimization
  • Load Testing - Capacity planning and stress testing

Business Intelligence

  • BI Analysis - Data analytics and reporting
  • Supplier Resilience - Supplier performance metrics

🏗️ Infrastructure Overview

Complete Application Architecture

graph LR
    USERS["👥<br/>Users"]

    subgraph LB["🔄 HAProxy HA"]
        HAP1["Master<br/>10.32.8.36"]
        HAP2["Standby<br/>10.32.8.38"]
    end

    subgraph APIS["🖥️ 7 API Servers"]
        API["API-1 to API-7<br/>10.32.8.134, 135, 139<br/>137, 35, 166, 167"]
    end

    subgraph SUPPLIER["🌐 Supplier Integration"]
        direction TB
        SP["7 Proxies<br/>41-48"]
        GW["3 Gateways<br/>3, 4, 10"]
        SP --> GW
    end

    subgraph DB["💾 Databases"]
        direction TB
        SQL_PRI["SQL Primary<br/>130:1988<br/>Writes"]
        SQL_READ["SQL Replicas<br/>VIP: 10.32.8.5<br/>5 Replicas"]
        OTH["OTH DB<br/>VIP: 105<br/>3 Servers"]
        CM["Channel Mgr<br/>142, 34<br/>7 Integrations"]
    end

    subgraph MONGO["🗄️ MongoDB 390M+ docs"]
        direction TB
        M1["Search Keys<br/>51,52,53<br/>5.7M"]
        M2["Room Map<br/>96<br/>8.5M"]
        M3["Logs<br/>75<br/>162M"]
        M4["Performance<br/>74<br/>216M"]
    end

    EXTERNAL["🌍<br/>External<br/>Suppliers"]

    USERS --> LB
    LB --> API
    API --> SUPPLIER
    SUPPLIER --> EXTERNAL
    API --> DB
    API --> MONGO

    style HAP1 fill:#90EE90
    style HAP2 fill:#FFE4B5
    style SQL_PRI fill:#FFB6C1
    style EXTERNAL fill:#FFA500
    style API fill:#87CEEB

Detailed Data Flow

graph LR
    API["7 API Servers"]

    subgraph "SQL Infrastructure"
        SQL_W["SQL Primary<br/>10.32.8.130<br/>WRITES"]
        SQL_R["SQL HAProxy VIP<br/>10.32.8.5<br/>→ 5 Replicas<br/>READS"]
    end

    subgraph "OTH System"
        OTH_VIP["OTH HAProxy<br/>VIP: 10.32.8.105<br/>→ 3 DB Servers"]
    end

    subgraph "Channel Manager"
        CM_SRV["CM Servers<br/>142, 34<br/>7 Integrations"]
    end

    subgraph "Supplier Flow"
        direction LR
        API1["API-1"] --> P1["Proxy-1<br/>.41"] --> G1["Gateway-1<br/>.3"]
        API2["API-2"] --> P2["Proxy-2<br/>.42"] --> G1
        API3["API-3"] --> P3["Proxy-3<br/>.43"] --> G1
        API4["API-4"] --> P4["Proxy-4<br/>.48"] --> G2["Gateway-2<br/>.4"]
        API5["API-5"] --> P5["Proxy-5<br/>.45"] --> G2
        API6["API-6"] --> P6["Proxy-6<br/>.46"] --> G3["Gateway-3<br/>.10"]
        API7["API-7"] --> P7["Proxy-7<br/>.47"] --> G3
        G1 & G2 & G3 --> EXT["External Suppliers<br/>Expedia, Booking<br/>Agoda, etc."]
    end

    subgraph "MongoDB"
        MDB["8 MongoDB Servers<br/>390M+ documents"]
    end

    API --> SQL_W
    API --> SQL_R
    API --> OTH_VIP
    API --> CM_SRV
    API --> MDB

    style SQL_W fill:#FFB6C1
    style EXT fill:#FFA500

XCP-ng Hypervisor Infrastructure

graph TB
    subgraph XCP1["🖥️ XCP-ng Hypervisor 1 (10.32.8.22) - 11 VMs"]
        XCP1_VM1["HAProxy-SQL-Replica-1"]
        XCP1_VM2["MongoDB-RoomMapping (.96)"]
        XCP1_VM3["SupplierProxy-Api-3"]
        XCP1_VM4["OTH-3"]
        XCP1_VM5["Redis-OTH"]
        XCP1_VM6["CM-1 (Channel Manager)"]
        XCP1_VM7["RabbitMQ (.90)"]
        XCP1_VM8["SQL Replica 5 (.37)"]
        XCP1_VM9["Haproxy-RoomMapping1"]
        XCP1_VM10["VPN-Employee"]
        XCP1_VM11["XOA (Xen Orchestra)"]
    end

    subgraph XCP2["🖥️ XCP-ng Hypervisor 2 (10.32.8.23) - 17 VMs"]
        XCP2_VM1["MongoDB-ReCheck-2 (.52)"]
        XCP2_VM2["SupplierProxy-Api-5"]
        XCP2_VM3["PfSense-2 (Firewall)"]
        XCP2_VM4["OTH-HAProxy-Master (.106)"]
        XCP2_VM5["OTH-HAProxy-Standby (.107)"]
        XCP2_VM6["OTH-4"]
        XCP2_VM7["haproxy-SQL-LB-2 (.8)"]
        XCP2_VM8["ELK-SupplierLogs"]
        XCP2_VM9["MariaDB"]
        XCP2_VM10["SupplierProxy-Gateway-2 (.4)"]
        XCP2_VM11["VPN-2"]
        XCP2_VM12["proxmox-maindb-3"]
        XCP2_VM13["Haproxy-Roommapping2"]
        XCP2_VM14["NewHotelMapping"]
        XCP2_VM15["OTH-Cache-Standby"]
        XCP2_VM16["LoadTest-VM-2"]
        XCP2_VM17["OTH-Cache-Master"]
    end

    subgraph XCP3["🖥️ XCP-ng Hypervisor 3 (10.32.8.24) - 14 VMs"]
        XCP3_VM1["MongoDB-APILogs (.75)"]
        XCP3_VM2["MongoDB-Supplier-logs (.18)"]
        XCP3_VM3["UptimeKuma (.102)"]
        XCP3_VM4["API-LogServer-152"]
        XCP3_VM5["Hotel Content API"]
        XCP3_VM6["gitlab"]
        XCP3_VM7["Internal Management"]
        XCP3_VM8["SupplierProxy-Api-6"]
        XCP3_VM9["OTH-2"]
        XCP3_VM10["DataShare-FTP"]
        XCP3_VM11["Loadtest-VM1"]
        XCP3_VM12["Logtracking (.180)"]
        XCP3_VM13["LoadTest-VM-2"]
        XCP3_VM14["SupplierProxy-Gateway-1 (.3)"]
    end

    POOL["<b>XCP-ng HA Pool</b><br/>Shared Storage<br/>Live Migration Enabled<br/>Total: 42 VMs"]
    POOL -.Manages.-> XCP1 & XCP2 & XCP3

    style POOL fill:#90EE90
    style XCP1 fill:#87CEEB
    style XCP2 fill:#87CEEB
    style XCP3 fill:#87CEEB

Physical Server Infrastructure

graph TB
    subgraph HYPERVISORS["🏗️ Hypervisor Layer (Physical Servers)"]
        XCP_POOL["<b>XCP-ng Pool</b><br/>3 Physical Servers<br/>10.32.8.22, 23, 24<br/>Hosts 42 VMs"]
        PROX["<b>Proxmox Cluster</b><br/>HAProxy Pair<br/>10.32.8.13, 14<br/>Hosts HAProxy Aloha VMs"]
    end

    subgraph PHYSICAL_SQL["💾 Physical SQL Servers"]
        SQL_MAIN["<b>SQL Primary</b><br/>10.32.8.130<br/>Physical Server<br/>withinearthUpdated DB"]
        SQL_R1["SQL Replica 1<br/>10.32.8.143<br/>Physical"]
        SQL_R2["SQL Replica 2<br/>10.32.8.149<br/>Physical"]
        SQL_R3["SQL Replica 3<br/>10.32.8.85<br/>Physical"]
        SQL_LOG["LogServer<br/>10.32.8.140, 152<br/>Physical"]
    end

    subgraph PHYSICAL_API["🖥️ Physical API Servers"]
        API_P1["API-1, 2, 3, 4<br/>134, 135, 139, 137<br/>Windows Physical"]
        API_P2["API-5, 6, 7<br/>35, 166, 167<br/>Windows Physical"]
    end

    subgraph PHYSICAL_MONGO["🗄️ Physical MongoDB Servers"]
        MONGO_P1["MongoDB 51, 52, 53<br/>Search Keys<br/>Physical Linux"]
        MONGO_P2["MongoDB 74, 75<br/>Logs & Performance<br/>Physical Linux"]
    end

    subgraph MONITORING["📊 Monitoring Infrastructure"]
        ZABBIX["<b>Zabbix</b><br/>10.32.8.148<br/>Physical Server<br/>60+ Hosts Monitored"]
        UPTIME["<b>UptimeKuma</b><br/>10.32.8.102<br/>VM on XCP-3"]
    end

    XCP_POOL --> |"Hosts VMs"| VM_SERVICES["42 VMs:<br/>MongoDB, RabbitMQ<br/>HAProxy, OTH<br/>Proxies, etc."]
    PROX --> |"Hosts VMs"| HAPROXY_VMS["HAProxy Aloha<br/>Master & Standby<br/>10.32.8.36, 38"]

    HAPROXY_VMS --> API_P1 & API_P2
    API_P1 & API_P2 --> SQL_MAIN
    API_P1 & API_P2 --> MONGO_P1

    ZABBIX -.Monitors.-> XCP_POOL & PROX & SQL_MAIN & API_P1 & MONGO_P1

    style XCP_POOL fill:#87CEEB
    style PROX fill:#87CEEB
    style SQL_MAIN fill:#FFB6C1
    style ZABBIX fill:#90EE90

📊 Complete Infrastructure Summary

Layer Component Count Details
Load Balancers Main HAProxy HA 2 10.32.8.36 (Master), 38 (Standby)
Load Balancers SQL HAProxy HA 2 VIP: 10.32.8.5, Hosts: 7, 8
Load Balancers OTH HAProxy HA 2 VIP: 10.32.8.105, Hosts: 106, 107
Application API Servers (Physical) 7 134, 135, 139, 137, 35, 166, 167
Integration Supplier Proxies (VMs) 7 41, 42, 43, 48, 45, 46, 47
Integration Supplier Gateways 3 10.32.8.3, 4, 10
Database SQL Primary (Physical) 1 10.32.8.130:1988
Database SQL Read Replicas 5 143, 149, 85, 37, 39
Database OTH Databases 3 11 (Master), 86, 40
Database Channel Manager 2 142, 34 (7 integrations each)
NoSQL MongoDB Servers 8 390M+ total documents
Queue RabbitMQ (VM) 1 10.32.8.90 on XCP-1
Hypervisors XCP-ng Pool 3 22, 23, 24 (42 VMs total)
Hypervisors Proxmox Cluster 2 13, 14 (HAProxy Aloha hosts)
Monitoring Zabbix (Physical) 1 10.32.8.148 (60+ hosts)
Monitoring UptimeKuma (VM) 1 10.32.8.102 on XCP-3

🔄 How Failover Works

HAProxy Failover

  • Normal Operation: HAProxy Master (10.32.8.36) distributes traffic to all 7 API servers
  • On Failure: HAProxy Standby (10.32.8.38) automatically takes over and connects to ALL 7 API servers
  • VIP Takeover: Floating IP switches from Master to Standby seamlessly
  • No Downtime: Connection pooling ensures zero interruption

🔗 Tools & Monitoring Dashboards

Infrastructure Monitoring

Tool URL Purpose Access
Zabbix http://10.32.8.148 Infrastructure monitoring (60+ hosts) Internal only
UptimeKuma https://status.withinearth.com/dashboard Public uptime monitoring dashboard Public
Netdata Multiple servers Real-time bandwidth & performance Internal only
Centralized Monitoring https://central.withinearth.com Central monitoring solution Internal only

Application Performance Monitoring (APM)

Tool URL Purpose Access
Datadog APM [Datadog URL 1] Application performance monitoring Team access
Datadog Metrics [Datadog URL 2] Infrastructure & application metrics Team access
API Health Dashboard http://10.32.8.102:8080/ API health monitoring Internal only

Load Balancer Management

Tool URL Purpose Access
HAProxy Admin Panel http://10.32.8.36:4444 Primary master control panel Admin only
HAProxy UI https://haproxy-ui.withinearth.com/home Add/remove clients to HAProxy Aloha Admin only
HAProxy Stats http://10.32.8.36:45001/stats Real-time statistics Internal only

Database Management

Tool URL Purpose Access
SQL Replica Jobs http://10.32.8.102:3012/#Home SQL replica jobs admin panel Admin only
SQL Primary 10.32.8.130:1988 Primary database server SQL Management Studio
MongoDB 10.32.8.51-53 Search keys MongoDB servers MongoDB Compass

Source Control & Development

Tool URL Purpose Access
GitLab Internal GitLab instance Source code repository Developer access
ELK Stack Internal Centralized log aggregation Internal only

Most Common Tasks

Recent Updates

  • 2025-11-16: Complete System Architecture documentation added (Hardware, VM, Service levels)
  • 2025-11-16: Network Architecture documentation with security zones and VPN
  • 2025-11-15: Hybrid DNS + IP Failover System implemented
  • 2025-11-12: Dynamic Database Configuration solution created
  • 2025-11-10: SQL to NoSQL migration analysis completed

📊 System Statistics

Component Count Status
API Servers 7 ✅ Active
SQL Server Databases 16+ ✅ Active
MongoDB Instances 8 ✅ Active (390M+ docs)
SQL Read Replicas 5 ✅ Active (via HAProxy VIP)
HAProxy Load Balancers 6 pairs ✅ HA Configured
RabbitMQ 1 ✅ Active
Total Agents 2,925 ✅ Active
Hotel Bookings 1.5M+ ✅ Historical

Last Updated: 2025-11-15 Complete Infrastructure Documentation - 60+ Servers