github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/design/orchestration/app-deployment-2.md (about)

     1  ### Application Partition Deployment Process
     2  
     3  - Процесс развертывания раздела приложения
     4  - Upload (Загрузить), Download (Скачать)
     5  
     6  ### Job Drivers
     7  - AppJobDriver (Драйвер заданий для приложений)
     8  - ContainerJobDriver (Драйвер заданий для контейнеров)
     9  
    10  ```mermaid
    11  erDiagram
    12    User ||--|| Deployment: "uploads"
    13    User ||--|| AppImage: "uploads"
    14    User ||--|| ContainerImage: "uploads"
    15    Deployment ||--|| Scheduler : "scheduled by"
    16    Scheduler ||--|{ Job: creates
    17    Job |{..|| Agent: "downloaded to VVM by"
    18    Job ||..|| AppPartition: "one per"
    19    AppImage ||..|| AppJobDriver: "downloaded to VVM and executed by"
    20    ContainerImage ||..|| ContainerJobDriver: "downloaded to VVM and executed by"
    21    Agent ||..|{ JobDriver: "works with several"
    22    AppJobDriver ||..|| JobDriver: "is"
    23    ContainerJobDriver ||..|| JobDriver: "is"
    24  ```
    25  
    26  
    27  
    28  ### Deployment
    29  - https://docs.oracle.com/cd/E19226-01/820-7627/bncbj/index.html
    30  - Deployment Descriptor schema version
    31  - Ref to App Image
    32    - Can be either local (same federation) or remote (other federation)
    33  - Deployment Params
    34    - zones, limitations
    35  
    36  ### AppImage
    37  
    38  ???
    39  - App Image (zip)
    40    - applicaton.json
    41    - package%-folder // arbitrary name
    42      - package.json // contains real package name, folder name is ignored
    43      - package.wasm %| container %| %[%]lua %| %[%]jar
    44      - template1%-folder
    45        - wstemplate.json // // contains real workspace template name, folder name is ignored
    46        - ??? wstemplatedata1.bin
    47        - ??? wstemplatedata2.bin
    48      - template2%-folder
    49        - wstemplate.json // // contains real workspace template name, folder name is ignored
    50        - data2
    51      - adminka%-folder
    52        - static.json // name: adminka
    53        - file1, file2
    54    - package2
    55      - ...
    56  - App Repo (repo, kind of bp3.git)
    57    - Application Schema (json)
    58      - Package Repos List %| Package Images List
    59    - Zero or few folders which are local Package Repos
    60  - Package Repo
    61    - build%-wasm.sh
    62      - Produces package.wasm %+ package.json (data schemas)
    63    - build%-wasm.sh from Heeus (скрипт из шаблона пакета для TypeScript, reference, рекомендованный, boilerplate, etalon, standart, origin)
    64      - Uses TypeScript builder to build package.json
    65      - Builds wasm from AssemblyScript sources
    66  
    67  ### User: Upload App Image2
    68  
    69  - Developer changes something in App Repo
    70  - Github triggers `UploadAppImage` action
    71    - Download all related Package Repos
    72    - For each package
    73      - run build.sh
    74        - ??? Skip validation of imports
    75    - Validate package.json's
    76      - Dependencies
    77      - ??? Imports
    78    - Zip App Image
    79    - Upload
    80  - Optionally: Github triggers DeployAppImage action
    81    - App Deployment Descriptor is uploaded into particular federation
    82    - Profit
    83  
    84  ### User: Validate Package Repo
    85  
    86  - Developer changes something in a Package Repo
    87  - Github triggers ValidatePackage action
    88    - run build.sh
    89  
    90  ### System: Schedule and execute App Partition
    91  
    92  App[cluster]
    93  
    94  - numOfPartitions = 1
    95  
    96  Process
    97  
    98  - Upload AppImage: admin + App[cluster]
    99  - Upload `AppDeployment.json`: admin + App[cluster]
   100  - Create ODoc[AppDeployment]: App[cluster]
   101    - JobKind, JobKey, Scheduled.IsActive, Scheduled.AppDescrVersion, Scheduled.AppImage
   102  - Create Jobs: Projector[A, JobActualizer]
   103  - Schedule Jobs: App[cluster].Controller[Scheduler]
   104    - Update Job.Scheduled.Node
   105  - Execute Jobs: Agent
   106    - Actualize WHERE Job.Scheduled.Node = Agent.Node OR Job.Current.Node = Agent.Node
   107    - Update Job.Current
   108    - Update Job.Status
   109  
   110   WDoc[Job]:
   111  - pk
   112    - JobKind // AppPartition | Container | Executable
   113    - JobKey // owner, app, appPartNo
   114  - Scheduled
   115    - IsActive
   116    - AppDescrVersion // WLogOffset
   117    - AppImage
   118    - Node
   119  - Current
   120    - Node
   121    - IsActive
   122    - AppDescrVersion // WLogOffset
   123    - AppImage
   124    - Error
   125  - Status (string)
   126  
   127  ### Discussion
   128  
   129  - Few possible deployment policies:
   130    - Deploy app images (our choice)
   131    - Deploy package images which are further referenced by app images
   132      - cons: Need intermediate package manager (e.g. one implemented by Heeus)
   133      - cons: Application Deployment Descriptor must track package images, not package sources
   134      - cons: Extra complexity for developers