Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Add Linter #33

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Linter

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: latest

- name: Install markdownlint-cli
run: npm install -g markdownlint-cli

- name: run markdownlint
run: markdownlint --disable MD013 -- docs
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_DOMAIN: docs.prism.ultraviolet.rs
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ mkdocs serve

Then just point the browser to [http://127.0.0.1:8000](http://127.0.0.1:8000).


[docs]: https://docs.prism.ultraviolet.rs
16 changes: 9 additions & 7 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Architecture
Prism provides a computation management service for [CoCos AI](https://docs.cocos.ultraviolet.rs/).

Prism provides a computation management service for [CoCos AI](https://docs.cocos.ultraviolet.rs/).

## Components

Expand All @@ -14,23 +15,24 @@ Prism provides a computation management service for [CoCos AI](https://docs.coco
| Invitations | Manages user inivations to access projects. |
| User Interface | Provides an web interface to provide platform access over a visual interface. |




![Architecture](img/arch.drawio.png)

### Users
The users service provides users access to the plaform and the user identities are used to provide authorization for the platform. Prism uses [magistrala users](https://docs.magistrala.abstractmachines.fr/architecture/#domain-model) service to achieve this.

The users service provides users access to the plaform and the user identities are used to provide authorization for the platform. Prism uses [magistrala users](https://docs.magistrala.abstractmachines.fr/architecture/#domain-model) service to achieve this.

### Computations

The computations service give users with the appropriate authorization, the ability to create, update, delete and run computations.

### Backends

The backends service connects to the computations service and receives run requests from computations service which it forwards to manager service. Backends are identified by their ip addresses and have certificates assigned to them for mutual TLS connections with manager.

### Certs
This a certificate authority service that offers the ability to issue, revoke, renew certificates. It also offers an online certificate status protocal `OCSP` endpoint which is used to verify certificates used in backends service.

This a certificate authority service that offers the ability to issue, revoke, renew certificates. It also offers an online certificate status protocal `OCSP` endpoint which is used to verify certificates used in backends service.

### User Interface
This provides users with a web interface to visually access the platform. It connects to the other services using the sdk.

This provides users with a web interface to visually access the platform. It connects to the other services using the sdk.
16 changes: 15 additions & 1 deletion docs/backends.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Backends Service

The backends service provides a means to manage backends which is where computations run. The service allows the creation, update, viewing and deletion of a backend. The service also manages connections to different backends and monitors them as well as securing the connection with mutual TLS. The service also enables the termination of the manager service running on the backend.

A backend can be described as consisting on manager running on the host, along with agent in a virtual machine in a Trusted Execution Environment.

![Backend](img/backend.drawio.png)

## Creating a Backend

This can be done on the user interface as below:

![New backend](img/ui/new%20backend.png)

or by running:

```bash
curl -sSiX POST https://prism.ultraviolet.rs/backends -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
{
Expand All @@ -32,11 +35,13 @@ Content-Length: 0
```

## Updating backend

This can be done on the user interface:

![Update Backend](img/ui/update%20backend.png)

or on curl:

```bash
curl -sSiX PUT https://prism.ultraviolet.rs/backends/<backend_id> -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
{
Expand All @@ -48,6 +53,7 @@ EOF
```

response:

```bash
HTTP/1.1 200 OK
Content-Type: application/json
Expand All @@ -56,6 +62,7 @@ Content-Length: 0
```

## Listing Backends

List of backends is viewable on the ui:

![list_backends](img/backends_page.png)
Expand All @@ -78,6 +85,7 @@ Content-Length: 165
```

## View Backend

An individual backend can be viewed on ui where it's details such as address, status, ID, certs and information can be acquired. Certs management is also carried out on this page.

![backend](img/backend.png)
Expand All @@ -100,6 +108,7 @@ Content-Length: 129
```

## View Backend Information

For a SEV enabled backend, the backend information can be viewed using prism. This information is measured by a Rust script found [here](https://github.com/ultravioletrs/cocos/blob/main/scripts/backend_info/src/main.rs). Once compiled and the binary is stored in `/build`, the backend information can be measured by Prism as shown below.

On the backend page, click the Backend Information button:
Expand Down Expand Up @@ -142,10 +151,10 @@ The backend_info.json file is useful in cocos for [attested TLS](https://docs.co
"disallow_network": false
}
}

```

## Terminate Backend

This is used to disconnect and close the associated backend connection. This is usually triggered when a certificate is revoked while the backend is connected using this certificate or user initiated for any reason.
Please note that this action will stop all ongoing computations and stop manager and any running agent.

Expand All @@ -156,23 +165,27 @@ curl -sSiX GET https://prism.ultraviolet.rs/backends/terminate/<backend_id>/<ter
```

Termination trype is an integer:

- 0 - Certificate revokation
- 1 - User initiated termination

response:

```bash
HTTP/1.1 204 No Content
Content-Type: application/json
Date: Fri, 03 May 2024 20:41:29 GMT
```

On manager the logs will be as follows:

```bash
{"time":"2024-05-03T23:41:29.664410497+03:00","level":"ERROR","msg":"manager service terminated: server requested client termination\nBackend Closed"}
{"time":"2024-05-03T23:41:29.671347637+03:00","level":"ERROR","msg":"Error shutting down tracer provider: context canceled"}
```

## Delete Backend

This removes the backend from the database. This can be done by clicking the delete button on the backend's page as shown:

![delete_backend](img/delete_backend_1.png)
Expand All @@ -187,6 +200,7 @@ curl -sSiX DELETE https://prism.ultraviolet.rs/backends/<backend_id> -H "Authori
```

Response:

```bash
HTTP/1.1 204 No Content
Content-Type: application/json
Expand Down
2 changes: 1 addition & 1 deletion docs/billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ If the payment is successful, you will be redirected to the projects page to pro

The payment details of the current session are stored, and these can be changed by clicking the update payment details button as shown below:

![Update Payment Details](img/update_payment_details.png)
![Update Payment Details](img/update_payment_details.png)
17 changes: 14 additions & 3 deletions docs/certs.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Certs Service

The certs service is a certificate authority used to issue certs related to backends service for mutual TLS purposes. The certs service provides the ability to issue, renew, revoke and download certificates.

## Issue a Certificate

This is the creation of a certificate associated with a specific backend.

This can be done on the UI on the specific backend page, by clicking on issue cert button.
![Issue Certificate](img/ui/issue%20cert.png)

This can be done on curl using:

```bash
curl -sSiX POST https://prism.ultraviolet.rs/certs/issue/backend/<backend_id> -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
{
Expand All @@ -17,6 +20,7 @@ EOF
```

example:

```bash
curl -sSiX POST https://prism.ultraviolet.rs/certs/issue/backend/fde3263e-70b8-4ce9-9f3c-4a203a0dcdf5 -H "Content-Type: application/json" -H "Authorization: Bearer <user_token>" -d @- << EOF
{
Expand All @@ -26,6 +30,7 @@ EOF
```

response:

```bash
HTTP/1.1 201 Created
Content-Type: application/json
Expand All @@ -36,6 +41,7 @@ Content-Length: 59
```

## Download a Certificate

This is a two step process. First we'll obtain a short lived token. Then using this token we'll be able to download the zip file containing the associated cert.

First we'll request a download token:
Expand All @@ -62,11 +68,12 @@ curl -L -X GET https://prism.ultraviolet.rs/certs/<serial_number>/download -G -d
```

example:

```bash
curl -L -X GET https://prism.ultraviolet.rs/certs/75709155906162784911683514578929321876/download -G -d "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTQ2NTIzMTYsImlzcyI6IlVsdHJhdmlvbGV0Iiwic3ViIjoiY2VydHMifQ.lvFgVSKAyn2UNeJg1OA4fGxDDZ6pylZTn9UZhrfWR9I" --output certs.zip
```

On the UI we'll click on request download button, followed by download certs to obtain the certs.
On the UI we'll click on request download button, followed by download certs to obtain the certs.

![Request Download](img/ui/request%20download.png)

Expand All @@ -75,6 +82,7 @@ On the UI we'll click on request download button, followed by download certs to
This results in three files `ca.pem`, `cert.pem` and `key.pem` which we'll use with CoCo's manager to bring the backend online.

## Renew Certificate

Certificates can be renewed before they expire. This will move their expiry date to a future one.

![Renew Certificate](img/ui/renew.png)
Expand All @@ -84,6 +92,7 @@ curl -sSiX PATCH https://prism.ultraviolet.rs/certs/<serial_number>/renew -H "Au
```

response:

```bash
HTTP/1.1 200 OK
Content-Type: application/json
Expand All @@ -92,6 +101,7 @@ Content-Length: 0
```

## Revoke Certificate

Certificates can be revoked, which means they can no longer be used for connecting to backends service. Revoked certificates cannot be renewed.

![Renew Certificate](img/ui/revoke.png)
Expand All @@ -101,6 +111,7 @@ curl -sSiX PATCH https://prism.ultraviolet.rs/certs/<serial_number>/revoke -H "A
```

response:

```bash
HTTP/1.1 200 OK
Content-Type: application/json
Expand All @@ -115,6 +126,7 @@ curl -sSiX GET https://prism.ultraviolet.rs/certs -H "Authorization: Bearer <use
```

response:

```bash
HTTP/1.1 200 OK
Content-Type: application/json
Expand All @@ -125,6 +137,5 @@ Content-Length: 269
```

## Online Certificate Status Protocal
The certs service also provides an endpoint on `prism.ultraviolet.rs/certs/ocsp` which allows verification of certificates issued by this service.


The certs service also provides an endpoint on `prism.ultraviolet.rs/certs/ocsp` which allows verification of certificates issued by this service.
6 changes: 3 additions & 3 deletions docs/computations.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ curl -sSiX GET https://prism.ultraviolet.rs/computations -H "Authorization: Bear
Response:

```bash
HTTP/2 200
HTTP/2 200
content-type: application/json
date: Mon, 27 May 2024 11:37:50 GMT
x-frame-options: DENY
Expand Down Expand Up @@ -92,7 +92,7 @@ curl -sSiX GET https://prism.ultraviolet.rs/computations/f025d311-193a-469b-b504
Response:

```bash
HTTP/2 200
HTTP/2 200
content-type: application/json
date: Mon, 27 May 2024 11:39:22 GMT
x-frame-options: DENY
Expand Down Expand Up @@ -138,7 +138,7 @@ EOF
Response:

```bash
HTTP/2 200
HTTP/2 200
content-type: application/json
date: Mon, 27 May 2024 11:51:25 GMT
x-frame-options: DENY
Expand Down
Loading