APITable Docs
Infrastructure

System Architecture Deployment Overview

1. ASSUMPTIONS & CLARIFICATIONS

The general knowledge that the system architecture should be designed based on:

ComponentNotesPrerequisitesComments
SSODeveloper Keycloak (OpenID are supported)AITable should provide the supported protocols (OpenID preferred)AITable support OpenID.
Load BalancerF5 will be used to load balance the application servicesAITable must provide the details of the exposed services by the cluster and the type of load balancingF5 proxy to Openresty Service deployed in Kubernates by AITable, externally exposed ports: 80 and 443
SSL CertificateIt's not possible to share, Developer team will configure it at the time of installationAITable must provide the SSL certificate formatDeveloperuld provide a valid certificate issued by a CA, usually a digital certificate that complies with the X.509 standard.
K8S ClusterDeveloper will provide "kubeconfig" file after the installationAITable should provide any specific requirements for the K8S cluster (Installation guide for CentOS 7.6+)k8s cluster version v1.22.0+
K8S Stroage classKubernetes Cluster Storage Class for redis,minio and rabbitmqDeveloper will provide Kubernetes Cluster Storage Class before the installation. Examples include: CBS, NFS...Developer should create available Kubernetes cluster storage class and provide storage class name
S3 Storage/Minio OSSDeveloper will provide S3 Bucket at the time of installation (But it's limited - Only App -> S3) OR S3 be part of the application but we need to define the backup strategyAITable should prepare the application configuration to read the variables in this format: AWS_REGION='TBD', AWS_BUCKET='assets', AWS_ACCESS_KEY='TBD', AWS_ENDPOINT='TBD', AWS_ACCESS_KEY='TBD', AWS_ACCESS_SECRET='TBD'Developer should create a bucket named [assets], with permission policy: public read and private write
Docker Registryhttps://ghcr.io(Basic Authentication)Developer should create the repository account and password that has permission to push & read the image
MySQL DatabaseDeveloper provide MySQL databasesAITable should provide the required databases detailsDeveloper should create a mysql account, initial database apitable with chartset utf8mb4 and configure the following parameters: max_allowed_packet = 1024M, sql_mode = NO_ENGINE_SUBSTITUTION, sort_buffer_size = 2M, max_connections=1000
Terminal Operation ServerUsed for AITable Application Installation and OperationDeveloper will provide the information at the time of installationTerminal Operation Server needs to be able to connect to the k8s cluster
AITable Web ServerBuild supercharged, SEO-friendly, and extremely user-facing static website and web application by using NextJSK8S Cluster & Docker Registry & S3 Storage & SSL Certificate & MySQL Database & Terminal Operation Server
AITable Backend ServerHandles HTTP requests about nodes, users, organizations, etc. Code under Java Spring Boot FrameworkK8S Cluster & Docker Registry & S3 Storage & SSL Certificate & MySQL Database & Terminal Operation Server
AITable Room ServerUsed for operations of datasheets, communicates with Socket Server through gRPC. nest-server: handles HTTP GET requests about datasheets, records, views, etc. socket-server: establishes a long connection with clients through the WebSocket protocol, allowing for two-way communication and real-time collaboration, notifications, and other featuresK8S Cluster & Docker Registry & S3 Storage & SSL Certificate & MySQL Database & Terminal Operation Server
RedisStores cache, such as log-in session, hot data, etc.K8S Cluster & Docker Registry & S3 Storage & SSL Certificate & MySQL Database & Terminal Operation ServerRedis uses master-slave mode and needs to enable password authentication
RabbitMQMessage broker software that acts as an intermediary for messaging between different applications or components.K8S Cluster & Docker Registry & S3 Storage & SSL Certificate & MySQL Database & Terminal Operation ServerRabbitMQ uses master-slave mode and needs to enable password authentication

2. APPLICATION COMPONENTS

List of the project's different application components and each of these component's role in the system architecture:

#ComponentPurposeFrameworkVersionInteractions
1Web ServerServing the frontend app to users and as a reverse proxyNextJS[Version 1.10.0]Forwards requests to appropriate backend services
2Frontend ServerHandling user interface and interactionsNextJS[Version 1.10.0]Communicates with Backend Server and Room Server
3Backend ServerManaging business logic and data processingSpring Boot[Version 1.10.0]Interacts with Database, Redis, and S3 Storage
4Room Server (nest-server)Handling HTTP GET requests for datasheets, records, views, etc.NestJS[Version 1.10.0]Communicates with Database and Redis
5Room Server (socket-server)Establishing WebSocket connections for real-time featuresNextJS[Version 1.10.0]Maintains real-time connections with clients, interacts with Redis
6Imageproxy ServerImage cropping serviceGolang[Version v0.13.4]Interacts with S3 Storage
7DatabaseStoring application dataMySQL[Version 8.0.32+]Accessed by Backend Server and Room Server
8CacheStoring session and hot dataRedis[Version 6.0+]Used by Backend Server and Room Server for quick data access
9Object StorageStoring files and objectsS3-compatible[Version latest]Accessed by Backend Server for file operations
10RabbitMQMessage queue processing middlewareS3-compatible[Version 3.13.0+]Accessed by Backend Server for file operations

3. SYSTEM ARCHITECTURE

4. SYSTEM RESOURCE ALLOCATION

4.1 Staging

SystemQuantityResourcesOSFunctionalityRequirements
Kubernetes Control Plane (Master)1[4] cores vCPU, [8]GB RAM, [100]GB Storage SpaceCentOS 7.6+Responsible for managing the clusterKubernetes API
Kubernetes Node (Worker)2[8] cores vCPU, [16]GB RAM, [100]GB Storage SpaceCentOS 7.6+A node is a VM that serves as a worker machine in a Kubernetes cluster, that will host the application components1. Kubelet, a process responsible for communication between the Kubernetes control plane and the Node; it manages the Pods and the containers running on a machine. 2. A container runtime (like Docker) responsible for pulling the container image from a registry, unpacking the container, and running the application.
Terminal Operation Server12 cores vCPU, 4GB RAM, 100GB Storage SpaceCentOS 7.6+Used for Application Installation and Operationkubectl
Database Server1[8] cores vCPU, [16]GB RAM, [200]GB Storage SpaceCentOS 7.6+The Main Database for the ApplicationMySQL [Version 8.0.32+]

4.2 Production

SystemQuantityResourcesOSFunctionalityRequirements
Kubernetes Control Plane (Master)*2[4] cores vCPU, [8]GB RAM, [100]GB Storage SpaceCentOS 7.6+Responsible for managing the clusterKubernetes API
Kubernetes Node (Worker)*3[16] cores vCPU, [64]GB RAM, [200]GB Storage SpaceCentOS 7.6+A node is a VM that serves as a worker machine in a Kubernetes cluster, that will host the application componentsKubelet, Docker
Terminal Operation Server12 cores vCPU, 4GB RAM, 500GB Storage SpaceCentOS 7.6+Used for Application Installation and Operationkubectl
.....

* Production traffic should have a minimum of three nodes because if one node goes down, both an etcd member and a control plane instance are lost, and redundancy is compromised. You can mitigate this risk by adding more control plane nodes.

Scalability Considerations

  • Kubernetes Nodes: Start with the recommended configuration. Monitor resource utilization and adding more nodes as needed.
  • Database: Read replicas for scaling read operations.
  • S3 Storage: Chosen solution can scale to handle increasing storage needs.

5. CONFIGURATION PATH

ComponentPathDescription
Terminal Operation Server/data/apitable/app/stateStores the installation information
Terminal Operation Server/data/apitable/app/config-k8sStores kubeconfig (Add our k8s cluster config file by the name "kubeconfig" inside the folder config-k8s)
Terminal Operation Server/data/apitable/app/custom-configStores configuration files

6. SYSTEM BACKUP AND DISASTER RECOVERY

ComponentBackup DescriptionFrequencyRetentionRestore Procedure
DatabaseFull backup + Incremental backupsFull: Weekly, Incremental: Daily30 daysUse MySQL backup tools to restore from the latest backup
Configuration FilesVersion-controlled repositoryOn every changeIndefiniteClone repository and apply configurations
Kubernetes Stateetcd backupDaily7 daysRestore etcd data from backup

7. FIREWALL POLICY

ServiceSourceDestinationPortProtocol
Load Balancer to ApplicationLoad Balancer IPK8S80/443TCP
Download the AITableTerminal Operation Server IPhttps://ghcr.io/443TCP
Database AccessK8S NodesDatabase Server3306TCP
Redis AccessK8S NodesRedis Server6379TCP
S3 AccessK8S NodesS3 Storage/Minio OSS443TCP
Kubernetes APIK8S NodesK8S Control Plane6443TCP

8. MONITORING AND LOGGING

Monitoring

ComponentMetrics to Monitor
Kubernetes ClusterCPU, Memory, Disk Usage, Pod Status
Web ServerRequest Rate, Error Rate, Latency
DatabaseConnections, Query Performance
RedisMemory Usage, Evictions, Connections
S3 Storage/Minio OSSBucket Size, Request Count, Error Rate

Logging

  • Retain application logs for 30 days
  • Retain system logs for 90 days
  • Implement log rotation to manage disk space

On this page