diff --git a/HA_ARCHITECTURE.md b/HA_ARCHITECTURE.md new file mode 100644 index 0000000..18b092f --- /dev/null +++ b/HA_ARCHITECTURE.md @@ -0,0 +1,274 @@ +# High Availability System Architecture + +## Overview + +This document describes the architecture for the **high availability deployment of the application system**. + +The system is designed to maintain service availability during infrastructure or network failures by using **cloud infrastructure as the primary environment** and **on-premises infrastructure as a failover system**. + +The design prioritizes: + +* minimal downtime +* automatic failover during internet outages +* data replication between cloud and local systems +* disaster recovery backups through CBM Technology + +The architecture combines **cloud reliability with local failover capability** to maintain service continuity. + +--- + +# Architecture Overview + +```mermaid +flowchart TB + +USER[Users] + +INT[Internet] + +CLOUD[Cloud Application Server] + +CLOUDDB[(Primary Database)] + +ONPREM[On Prem Application Server] + +ONDB[(Replica Database)] + +BACKUP[CBM Backup System] + +USER --> INT +INT --> CLOUD +CLOUD --> CLOUDDB + +CLOUDDB --> ONDB +ONDB --> ONPREM + +CLOUD --> BACKUP +CLOUDDB --> BACKUP +``` + +--- + +# System Access + +Users normally access the system through the internet using the **primary cloud deployment**. + +Example: + +``` +https://app.companydomain.com +``` + +Traffic flow during normal operation: + +```mermaid +flowchart LR + +USER[User Device] + +INT[Internet] + +APP[Cloud Application Server] + +DB[(Primary Database)] + +USER --> INT +INT --> APP +APP --> DB +``` + +--- + +# Failover Operation + +If the office internet connection fails, internal users are redirected to the **local on-premises server**. + +```mermaid +flowchart LR + +USER[User Device] + +LAN[Company Network] + +ONAPP[On Prem Application Server] + +ONDB[(Local Database)] + +USER --> LAN +LAN --> ONAPP +ONAPP --> ONDB +``` + +This allows employees to continue using the system locally until internet connectivity is restored. + +--- + +# Infrastructure Components + +## Cloud Application Server + +The primary system runs in the **cloud environment**. + +Responsibilities include: + +* hosting the web application +* processing user requests +* managing application services +* connecting to the primary database + +The cloud server is the **default production environment**. + +--- + +## On-Prem Application Server + +The on-prem server provides **local failover capability**. + +Responsibilities include: + +* maintaining a replica of the application +* providing access during internet outages +* hosting the replicated database + +This server remains **standby during normal operations**. + +--- + +## Primary Database + +The primary database resides in the cloud environment and stores all operational data. + +Examples include: + +* inventory records +* user data +* configuration settings +* system transactions + +The cloud database acts as the **authoritative source of data**. + +--- + +## Replica Database + +A replica database runs on the on-prem server. + +The replica receives continuous updates from the cloud database to ensure the local system stays synchronized. + +--- + +# Database Replication + +Database replication ensures the on-prem system has an up-to-date copy of the cloud database. + +```mermaid +flowchart LR + +CLOUDDB[(Cloud Primary Database)] + +ONDB[(On Prem Replica Database)] + +CLOUDDB --> ONDB +``` + +Normal operation: + +``` +Cloud → On Prem replication +``` + +Failover mode: + +``` +On Prem database promoted to primary +Replication temporarily paused +``` + +Recovery mode: + +``` +On Prem → Cloud resynchronization +Cloud resumes primary role +``` + +--- + +# Backup System + +Backups are managed by CBM Technology. + +```mermaid +flowchart LR + +APP[Cloud Application Server] + +DB[(Primary Database)] + +CBM[CBM Backup Storage] + +APP --> CBM +DB --> CBM +``` + +Backups typically include: + +* database backups +* server snapshots +* file storage backups + +--- + +# Backup Schedule + +Typical configuration: + +| Backup Type | Frequency | +| ------------------- | --------------------- | +| Database Backup | Daily | +| Server Snapshot | Daily | +| File Storage Backup | Daily | +| Retention Period | Defined by CBM policy | + +Backups are stored **offsite** to protect against data loss. + +--- + +# Disaster Recovery + +If the primary cloud system fails: + +1. The on-prem server can be promoted to the primary system. +2. Internal users connect to the local server. +3. Operations continue locally until the cloud environment is restored. + +If both environments fail or data corruption occurs: + +1. CBM Technology restores the most recent backup. +2. The system infrastructure is rebuilt if required. +3. Services are returned to normal operation. + +--- + +# Expected System Behavior + +| Event | Result | +| ---------------------- | ---------------------------------------- | +| Cloud server failure | Failover to on-prem server | +| Office internet outage | Internal users connect to on-prem server | +| Local server failure | Cloud system remains available | +| Database corruption | Restore from CBM backup | +| Company power outage | System temporarily unavailable | + +--- + +# Potential Future Improvements + +Additional improvements may include: + +* cloud load balancing +* multiple application servers +* automated failover monitoring +* geographic redundancy +* network redundancy inside the office + +These improvements would further increase system reliability and reduce recovery times. \ No newline at end of file