From 0dc6b2423bab0e390c23fbabba73ed28738517cd Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Mon, 4 Nov 2024 13:33:52 +0700 Subject: [PATCH 1/4] chore: updater docs --- docs/docs/architecture/updater.mdx | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/docs/architecture/updater.mdx diff --git a/docs/docs/architecture/updater.mdx b/docs/docs/architecture/updater.mdx new file mode 100644 index 000000000..cdf307b8b --- /dev/null +++ b/docs/docs/architecture/updater.mdx @@ -0,0 +1,76 @@ +--- +title: updater +description: updater Overview. +slug: "updater" +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +:::warning +🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase. +::: + +This document outlines the architectural design for a C++ updater responsible for downloading and executing installers for two binaries: CLI and Server. + +## Overview + +The updater is designed to check for available updates, download the necessary installer files, and execute them to update the CLI and Server binaries. The architecture consists of several key components that work together to achieve this functionality. + +## Components + +### 1. **Version Management Module** + +- **Purpose**: Responsible for checking the current version of the installed binaries and determining if updates are available. +- **Responsibilities**: + - Retrieve the current version from local installations. + - Fetch the latest version information from a remote source, latest version information is saved to `.cortexrc`. + - Determine if an update is necessary based on version comparison. + +### 2. **Installer Download Manager** + +- **Purpose**: Handles downloading the installer files from specified URLs. +- **Responsibilities**: + - Manage HTTP requests to fetch installer files. + - Handle errors during download. + - Save downloaded installers in a temporary directory. + +### 3. **Installer Execution Module** + +- **Purpose**: Executes the downloaded installer files to perform updates. +- **Responsibilities**: + - Launch the installer with appropriate command-line arguments. + - Monitor the installation process and capture any output or errors. + - Ensure that installation completes successfully before proceeding. + +### 4. **User Interface (CLI)** + +- **Purpose**: Provides a command-line interface for users to initiate updates and view status messages. +- **Responsibilities**: + - Display current version information for CLI and Server. + - Inform users about available updates and progress during downloading and installation. + - Handle user input for initiating updates. + +## Workflow + +1. **Initialization**: + - The updater starts and initializes all necessary modules. + +2. **Version Check**: + - The Version Management Module retrieves the current versions of both CLI and Server from local installations. + - It fetches the latest version information from a remote source. + +3. **Update Decision**: + - If newer versions are available, the updater proceeds to download the installers; otherwise, it informs the user that no updates are necessary. + +4. **Download Process**: + - The Installer Download Manager downloads the latest installer files using HTTP requests. + - Progress is reported back to the User Interface. + +5. **Installer Execution**: + - Once downloaded, the Installer Execution Module runs the installer with silent mode. + - It monitors the installation process, capturing any output or errors. + +6. **Completion Notification**: + - After successful installation, the User Interface notifies users of completion or any issues encountered during installation. + - Logs are updated with relevant information about the update process. \ No newline at end of file From 479d83c70911aa3ff53cc8059bc3c33504d2adb7 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Mon, 4 Nov 2024 13:36:57 +0700 Subject: [PATCH 2/4] chore: add CLI command --- docs/docs/architecture/updater.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/architecture/updater.mdx b/docs/docs/architecture/updater.mdx index cdf307b8b..5c467236f 100644 --- a/docs/docs/architecture/updater.mdx +++ b/docs/docs/architecture/updater.mdx @@ -47,9 +47,9 @@ The updater is designed to check for available updates, download the necessary i - **Purpose**: Provides a command-line interface for users to initiate updates and view status messages. - **Responsibilities**: - - Display current version information for CLI and Server. + - Display current version information for CLI and Server: `cortex -v` - Inform users about available updates and progress during downloading and installation. - - Handle user input for initiating updates. + - Handle user input for initiating updates: `(sudo) cortex update` ## Workflow From 46fe04ca581725ed5d40eb80b4fa3bca316d5c69 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Mon, 4 Nov 2024 13:52:49 +0700 Subject: [PATCH 3/4] chore: add updater to sidebars --- docs/sidebars.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 36a3e7420..a42e5ea1a 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -75,6 +75,7 @@ const sidebars: SidebarsConfig = { { type: "doc", id: "architecture/data-folder", label: "Cortex Data Folder" }, { type: "doc", id: "architecture/cortex-db", label: "cortex.db" }, { type: "doc", id: "architecture/cortexrc", label: ".cortexrc" }, + { type: "doc", id: "architecture/updater", label: "updater" }, ] }, { From 76634cf85fec492f6822991d3874e6b4440943d7 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Mon, 4 Nov 2024 16:02:24 +0700 Subject: [PATCH 4/4] chore: capitalize the Updater in the sidebar and page title --- docs/docs/architecture/updater.mdx | 4 ++-- docs/sidebars.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/architecture/updater.mdx b/docs/docs/architecture/updater.mdx index 5c467236f..d9dc7d4f8 100644 --- a/docs/docs/architecture/updater.mdx +++ b/docs/docs/architecture/updater.mdx @@ -1,6 +1,6 @@ --- -title: updater -description: updater Overview. +title: Updater +description: Updater Overview. slug: "updater" --- diff --git a/docs/sidebars.ts b/docs/sidebars.ts index a42e5ea1a..09ad3e504 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -75,7 +75,7 @@ const sidebars: SidebarsConfig = { { type: "doc", id: "architecture/data-folder", label: "Cortex Data Folder" }, { type: "doc", id: "architecture/cortex-db", label: "cortex.db" }, { type: "doc", id: "architecture/cortexrc", label: ".cortexrc" }, - { type: "doc", id: "architecture/updater", label: "updater" }, + { type: "doc", id: "architecture/updater", label: "Updater" }, ] }, {