Skip to content

Commit

Permalink
NOISSUE - Switch to Docusaurus (#45)
Browse files Browse the repository at this point in the history
* init docasarus

Signed-off-by: Sammy Oina <[email protected]>

* quick refactor

Signed-off-by: Sammy Oina <[email protected]>

* update getting started

Signed-off-by: Sammy Oina <[email protected]>

* delete copy

Signed-off-by: Sammy Oina <[email protected]>

* remove landing page

Signed-off-by: Sammy Oina <[email protected]>

* remove blog link

Signed-off-by: Sammy Oina <[email protected]>

---------

Signed-off-by: Sammy Oina <[email protected]>
  • Loading branch information
SammyOina authored Dec 20, 2024
1 parent b57e8c2 commit d020594
Show file tree
Hide file tree
Showing 31 changed files with 18,648 additions and 90 deletions.
54 changes: 44 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,55 @@ on:
branches:
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: Deploy docs
name: Build Docusaurus
runs-on: ubuntu-latest

steps:
- name: Checkout master
uses: actions/checkout@v2
- name: Checkout main
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build the website
run: yarn build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build


deploy:
name: Deploy to GitHub Pages
needs: build

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
permissions:
pages: write
id-token: write

environment:
name: github-pages

runs-on: ubuntu-latest

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_DOMAIN: docs.cocos.ultraviolet.rs
github_token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 20 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
46 changes: 13 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,30 @@ This repo collects the collaborative work on Cocos AI documentation. Official do

Documentation is auto-generated from Markdown files in this repo.

[MkDocs](https://www.mkdocs.org/) is used to serve the docs locally with different theming.

## Install
### Installation

Doc repo can be fetched from GitHub:

```bash
git clone https://github.com/ultravioletrs/cocos-docs.git
```

## Prerequisites

[Python](https://www.python.org/downloads/) is required to run MkDocs.

1. Create a virtual environment:

```bash
python -m venv venv
```

2. Activate the virtual environment:

```bash
source venv/bin/activate
```

3. Install [MkDocs](https://www.mkdocs.org/#installation)

```bash
pip install mkdocs
```
```
$ yarn
```

4. Additionally, install [Material theme](https://squidfunk.github.io/mkdocs-material/):
### Local Development

```bash
pip install mkdocs-material
```
```
$ yarn start
```

## Usage
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Use MkDocs to serve documentation:
### Build

```bash
mkdocs serve
```
$ yarn build
```

Then just point the browser to [http://127.0.0.1:8000](http://127.0.0.1:8000).
This command generates static content into the `build` directory and can be served using any static contents hosting service.
2 changes: 1 addition & 1 deletion docs/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The agent is responsible for the life cycle of the computation, i.e., running th

The picture below shows where the agent runs in the Cocos system, helping us better understand its role.

![Agent](./img/agent.png){ align=center }
![Agent](/img/agent.png)

## StateMachine

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ These features are implemented by several independent components of CocosAI syst
3. EOS (Enclave Operating System)
4. CLI

![Cocos Arch](./img/arch.png){ align=center }
![Cocos Arch](/img/arch.png)

> **N.B.** CocosAI open-source project does not provide Computation Management service. It is a cloud component, used to define a Computation (i.e. define computation metadata, like participants list, algorithm and data providers, result recipients, etc...). Ultraviolet provides commercial product [Prism](https://ultraviolet.rs/prism.html), a multi-party computation platform, that implements multi-tenant and scalable Computation Management service, running in the cloud or on premise, and capable to connect and control CocosAI system running on the TEE host.
Expand Down
2 changes: 1 addition & 1 deletion docs/attestation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ The Agent is responsible for fetching the attestation report from the SVM. This

For the relying party to send confidential data or code to the Agent, a secure channel must be established between them. This is done using attested TLS, which is a TLS connection where the server's certificate is extended with the attestation report. The SVM is the server in Cocos. The Agent generates a self-signed x.509 certificate extended with the attestation report. When fetching the attestation report, the Agent inserts the hash of the public key into it using the field report data. The whole process can be seen in the below picture. The green color represents the trusted part of the system, while the red is untrusted.

![Attested TLS](./img/atls.png){ align=center }
![Attested TLS](/img/atls.png)

The relying party uses the Cocos CLI to verify the self-signed certificate and the attestation report that is part of it. Successful verification proves to the relying party that the certificate is generated inside the SVM because the certificate's public key is part of the attestation report.
2 changes: 1 addition & 1 deletion docs/hal.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ HAL is combined with AMD SEV-SNP to provide a fully encrypted VM that can be ver

Cocos uses QEMU and Open Virtual Machine Firmware (OVMF) to boot the confidential VM. During boot with SEV-SNP, the AMD Secure Processor (AMD SP) measures (calculates the hash) of the contents of the VM to insert that hash into the attestation report. This measurement is proof of what is currently running inside the VM. The problem with SEV is that it only measures the Open Virtual Machine Firmware (OVMF). To solve this, we have built OVMF so that OVMF contains hashes of the vmlinuz and initrams. Once the OVMF is loaded, it will load the vmlinuz and initramfs into memory, but it will continue the boot process only if the hashes of the vmlinuz and initramfs match the hashes stored in OVMF. This way, the attestation report will contain the measurement of OVMF, with the hashes, and OVMF will guarantee that the correct kernel and file system are booted. The whole process can be seen in the following diagram. The green color represents the trusted part of the system, while the red is untrusted:

![hal](./img/hal.png){ align=center }
![hal](/img/hal.png)

This process guarantees that the whole VM is secure and can be verified.

Expand Down
4 changes: 4 additions & 0 deletions docs/index.md → docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
slug: /
---

# What is CocosAI

CocosAI (Confidential Computing System for AI) is a SW system for enabling confidential and privacy-preserving AI/ML, i.e. execution of model training and algorithm inference on confidential data sets. Privacy-preservation is considered a “holy grail” of AI. It opens many possibilities, among which is a collaborative, trustworthy AI.
Expand Down
6 changes: 3 additions & 3 deletions docs/manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Communication between Computation Management cloud and the Manager is done via g

The picture below shows where the Manager runs in the Cocos system, helping us better understand its role.

![Manager](./img/manager.png){ align=center }
![Manager](/img/manager.png)

## Manager <> Agent
## Manager - Agent

When TEE is booted, an Agent is automatically deployed and is used for outside communication with the enclave (via the API) and for computation orchestration (data and algorithm upload, start of the computation and retrieval of the result).

Agent is a gRPC server, and CLI is a gRPC client of the Agent. The Manager sends the Computation Manifest to the Agent via vsock and the Agent runs the computation, according to the Computation Manifest, while sending events back to manager on the status. The Manager then sends the events it receives from agent via vsock to Computation Mangement cloud through gRPC.

## Setup and Test Manager <> Agent
## Setup and Test Manager Agent

```sh
git clone https://github.com/ultravioletrs/cocos
Expand Down
117 changes: 117 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

const config: Config = {
title: 'COCOS AI',
tagline: '',
favicon: 'img/logo.png',

// Set the production url of your site here
url: 'https://docs.cocos.ultraviolet.rs',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'ultravioletrs', // Usually your GitHub org/user name.
projectName: 'cocos-docs', // Usually your repo name.

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},

presets: [
[
'@docusaurus/preset-classic',
{
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],

themeConfig: {
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
navbar: {
title: 'Cocos AI',
logo: {
alt: 'My Site Logo',
src: 'img/logo.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
href: 'https://github.com/ultravioletrs/cocos',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Docs',
to: '/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'X',
href: 'https://x.com/ultravioletrs',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/ultravioletrs/cocos',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Cocos ai, Inc. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};

export default config;
32 changes: 0 additions & 32 deletions mkdocs.yml

This file was deleted.

Loading

0 comments on commit d020594

Please sign in to comment.