Skip to content
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
159 changes: 159 additions & 0 deletions docs/cli/Guides/quick-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
id: "quick-guide"
title: "Quick Deployment Guide"
slug: "/guides/quick-guide"
sidebar_position: 1
---

This quick guide provides instructions on deploying a <a id="solution"><span className="dashed-underline">solution</span></a> and <a id="data"><span className="dashed-underline">data</span></a> on Super Protocol. Its purpose is to introduce you to the logic and sequence of the CLI commands.

## Prerequisites

- Docker
- [SPCTL](/cli)

## 1. Prepare the solution

### 1.1. Create a Dockerfile

When writing a Dockerfile and other scripts, keep in mind the special file structure inside the <a id="tee"><span className="dashed-underline">TEE</span></a>:

| **Location** | **Purpose** | **Access** |
| :- | :- | :- |
| `/sp/inputs/input-0001`<br/>`/sp/inputs/input-0002`<br/>etc. | Possible data locations | Read-only |
| `/sp/output` | Output directory for results | Write; read own files |
| `/sp/certs` | Contains the order certificate | Read-only |

So, your solution must find the data in `/sp/inputs` and write the results to `/sp/output`.

:::important

Always use absolute paths, such as `/sp/...`.

:::

You can find several Dockerfile examples in the [Super-Protocol/solutions](https://github.com/Super-Protocol/solutions) GitHub repository.

### 1.2. Build a Docker image

```shell
docker build -t <YOUR_PROJECT> .
```

For example:

```shell
docker build -t my-solution .
```

### 1.3. Save and archive the image

```shell
docker save <YOUR_PROJECT>:latest | gzip > <YOUR_PROJECT>.tar.gz
```

For example:

```shell
docker save my-solution:latest | gzip > my-solution.tar.gz
```

### 1.4. Upload the archive

From your SPCTL directory, [upload](/cli/commands/files/upload) the archive with your solution:

```shell
./spctl files upload <ARCHIVE_PATH> \
--filename <YOUR_PROJECT>.tar.gz \
--output <YOUR_PROJECT>.resource.json
```

For example:

```shell
./spctl files upload ./my-solution.tar.gz \
--filename my-solution.tar.gz \
--output my-solution.resource.json
```

## 2. Prepare data

If your application requires additional input data, prepare and upload it as well.

### 2.1. Archive the data

Archive the data:

```shell
tar -czvf <DATA_NAME>.tar.gz -C <DATA_PATH> .
```

For example:

```shell
tar -czvf my_data.tar.gz -C ./data .
```

### 2.2. Upload the archive

From your SPCTL directory, [upload](/cli/commands/files/upload) the archive with your data, just like you did with the solution:

```shell
./spctl files upload <ARCHIVE_PATH> \
--filename <YOUR_DATA>.tar.gz \
--output <YOUR_DATA>.resource.json
```

For example:

```shell
./spctl files upload ./my-data.tar.gz \
--filename my-data.tar.gz \
--output my-data.resource.json
```

## 3. Deploy

Place an order using the [`workflows create`](/cli/commands/workflows/create) command. For example:

```shell
./spctl workflows create \
--tee 7 \
--solution ./my-solution.resource.json \
--data ./my-data.resource.json \
--data ./more-data.resource.json
```

:::note

When you provide multiple data inputs, they are placed in separate directories inside the <a id="cvm"><span className="dashed-underline">CVM</span></a>: the first in `/sp/inputs/input-0001`, the second in `/sp/inputs/input-0002`, and so on.

:::

Find the order ID in the output.

## 4. Download the result

Wait a few minutes and [check the order status](/cli/commands/orders/get):

```shell
./spctl orders get <ORDER_ID>
```

For example:

```shell
./spctl orders get 256587
```

If the status is `Done`, the order is ready, and you can [download the order result](/cli/commands/orders/download-result):

```shell
./spctl orders download-result <ORDER_ID>
```

For example:

```shell
./spctl orders download-result 256587
```
7 changes: 7 additions & 0 deletions docs/cli/Guides/smpc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
id: "smpc"
title: "Secure Multiparty Computation"
slug: "/guides/smpc"
sidebar_position: 2
---

36 changes: 36 additions & 0 deletions docs/cli/commands/files/calculate-hash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
id: "cli-files-calculate-hash"
title: "files calculate-hash"
slug: "/commands/files/calculate-hash"
sidebar_label: "calculate-hash"
sidebar_position: 2
---

Calculates the hash of a file or directory taking into account the file names.

## Syntax

```shell
./spctl files calculate-hash <PATH>
[--config <CONFIG_PATH>]
[--help | -h]
```

## Arguments

| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `<PATH>` | Path to a file or directory. |

## Options

| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `--config <CONFIG_PATH>` | Path to the SPCTL configuration file. <br/>Default: `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Example

```shell
./spctl files calculate-hash ./content/
```
29 changes: 15 additions & 14 deletions docs/cli/commands/files/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@ id: "cli-files-delete"
title: "files delete"
slug: "/commands/files/delete"
sidebar_label: "delete"
sidebar_position: 4
---

Deletes a file in remote storage using the information in a resource JSON file.

The resource JSON file is created as a result of the [`files upload`](/cli/commands/files/upload) command.
Deletes files in remote storage using the information in a resource JSON file.

## Syntax

```
./spctl files delete <resourceFilePath>
[--config <path>]
```shell
./spctl files delete <RESOURCE>
[--use-addon]
[--config <CONFIG_PATH>]
[--help | -h]
```

## Arguments

| **Name** | **Description** |
| :- | :- |
| `<resourceFilePath>` | Path to the resource JSON file. |
| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `<RESOURCE>` | Path to a resource JSON file. This file is created as a result of the <br/>[`files upload`](/cli/commands/files/upload) command. |

## Options

| **Name** | **Description** |
| :- | :- |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |
| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `--use-addon` | Option required to delete files that were [uploaded](/cli/commands/files/upload) with this option. |
| `--config <CONFIG_PATH>` | Path to the SPCTL configuration file. <br/>Default: `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Example

```
```shell
./spctl files delete ./resource-old-data.json
```
30 changes: 15 additions & 15 deletions docs/cli/commands/files/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ id: "cli-files-download"
title: "files download"
slug: "/commands/files/download"
sidebar_label: "download"
sidebar_position: 3
---

Downloads a file from remote storage and decrypts it using the information in a resource JSON file.

The resource JSON file is created as a result of the [`files upload`](/cli/commands/files/upload) command.
Downloads files from remote storage and decrypts it using the information in a resource JSON file.

## Syntax

```
./spctl files download <resourceFilePath> <saveToPath>
[--config <path>]
```shell
./spctl files download <RESOURCE> <LOCAL_DIRECTORY>
[--config <CONFIG_PATH>]
[--help | -h]
```

## Arguments

| **Name** | **Description** |
| :- | :- |
| `<resourceFilePath>` | Path to the resource JSON file. |
| `<saveToPath>` | Path to save the downloaded file. |
| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `<RESOURCE>` | Path to a resource JSON file. This file is created as a result of the <br/>[`files upload`](/cli/commands/files/upload) command. |
| `<LOCAL_DIRECTORY>` | Path to save the downloaded files. |

## Options

| **Name** | **Description** |
| :- | :- |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |
| <div style={{width:200}}>**Name**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| `--use-addon` | Option required to download files that were [uploaded](/cli/commands/files/upload) with this option. |
| `--config <CONFIG_PATH>` | Path to the SPCTL configuration file. <br/>Default: `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Example

```
```shell
./spctl files download ./resource-data.json ./
```
15 changes: 7 additions & 8 deletions docs/cli/commands/files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
id: "cli-files"
title: "files"
slug: "/commands/files"
sidebar_position: 3
sidebar_position: 2

---

This group contains commands to manage files in third-party storage such as Storj.

Most of these commands require a Storj account and SPCTL configured to use it. Refer to the [Set up Storj](/cli/#set-up-storj-access-optional) section to create a bucket and access grants and set up SPCTL.

## Commands

| **Command** | **Description** |
| :- | :- |
| [files delete](/cli/commands/files/delete) | Deletes a file in remote storage. |
| [files download](/cli/commands/files/download) | Downloads and decrypt a file from remote storage. |
| [files upload](/cli/commands/files/upload) | Uploads a file to remote storage. |
| <div style={{width:200}}>**Command**</div> | <div style={{width:565}}>**Description**</div> |
| :- | :- |
| [files upload](/cli/commands/files/upload) | Encrypts and uploads a file to remote storage. |
| [files calculate-hash](/cli/commands/files/calculate-hash) | Calculates the hash of a file or directory. |
| [files download](/cli/commands/files/download) | Downloads and decrypts a file from remote storage. |
| [files delete](/cli/commands/files/delete) | Deletes a file in remote storage. |
Loading