Skip to content

Commit

Permalink
refactor: update
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejVukosav committed Aug 20, 2024
1 parent c9cd322 commit f13a30f
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 31 deletions.
53 changes: 35 additions & 18 deletions docs/03-getting-started/01-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,55 +52,72 @@ Node is now initialized and ready for use.

### SSL/TLS Support

To be able to access the the node from external source on the same network you will need to install the generated self-signed certificate.
To be able to access the the node from external source on the same network you
will need to install the generated self-signed certificate.

> **_NOTE:_** Installing the SSL certificate is only necessary if you plan to access the node from an external source on the same network. If you are running the application locally, you do not need to install the certificate.
> **_NOTE:_** Installing the SSL certificate is only necessary if you plan to
> access the node from an external source on the same network. If you are
> running the application locally, you do not need to install the certificate.
### Steps to Add the Certificate to Your Device

1. **Locate the Certificate**:
- Download the certificate from `http://localhost:<server-port>/admin-api/certificate`.
- The `<server-port>` is the port number used as an argument in the `--server-port` flag in the section [Initialize and start your node (separate terminal)](#initialize-and-start-your-node-separate-terminal).
- For example:
\`\`\`bash
http://localhost:2428/admin-api/certificate
\`\`\`

- Download the certificate from
`http://localhost:<server-port>/admin-api/certificate`.
- The `<server-port>` is the port number used as an argument in the
`--server-port` flag in the section
[Initialize and start your node (separate terminal)](#initialize-and-start-your-node-separate-terminal).
- For example: \`\`\`bash http://localhost:2428/admin-api/certificate \`\`\`

2. **Add the Certificate to Trusted Certificates**:

- **For Windows**:
1. Open the `Run` dialog (Win + R) and type `mmc` to open the Microsoft Management Console.

1. Open the `Run` dialog (Win + R) and type `mmc` to open the Microsoft
Management Console.
2. Go to `File` -> `Add/Remove Snap-in...`.
3. Select `Certificates` and click `Add`.
4. Choose `Computer account`, then `Next` and `Finish`.
5. Expand `Certificates (Local Computer)` -> `Trusted Root Certification Authorities`.
5. Expand `Certificates (Local Computer)` ->
`Trusted Root Certification Authorities`.
6. Right-click `Certificates`, then `All Tasks` -> `Import...`.
7. Follow the prompts to import the certificate file.

- **For macOS**:

1. Double-click the certificate file.
2. This will open the `Keychain Access` application.
3. Choose `System` from the list of keychains.
4. Drag and drop the certificate into the `System` keychain.
5. Authenticate with your administrator password if prompted.
6. Right-click the certificate and select `Get Info`.
7. Expand the `Trust` section and select `Always Trust` from the `When using this certificate` dropdown.
7. Expand the `Trust` section and select `Always Trust` from the
`When using this certificate` dropdown.

- **For Linux**:
1. Copy the certificate to `/usr/local/share/ca-certificates/` (or `/etc/pki/ca-trust/source/anchors/` depending on your distribution).
2. Run `sudo update-ca-certificates` (or `sudo update-ca-trust extract` for Red Hat-based distributions).
1. Copy the certificate to `/usr/local/share/ca-certificates/` (or
`/etc/pki/ca-trust/source/anchors/` depending on your distribution).
2. Run `sudo update-ca-certificates` (or `sudo update-ca-trust extract` for
Red Hat-based distributions).

3. **Restart Your Browser**:
- Close and reopen your web browser to ensure it recognizes the newly added certificate.
- Close and reopen your web browser to ensure it recognizes the newly added
certificate.

### Rules for Generating SSL Certificates

- If a certificate doesn't exist, a new one will be generated based on your current local IP address.
- If a certificate doesn't exist, a new one will be generated based on your
current local IP address.
- If a certificate exists for the current IP address, it will be used.
- If a certificate exists but is not configured for the current IP address, a new certificate will be created.
- If a certificate exists but is not configured for the current IP address, a
new certificate will be created.

> **_NOTE:_** Every time a new certificate is generated (e.g., on the first start of the server or when the IP address changes), you will need to add it to your device's trusted certificates.
> **_NOTE:_** Every time a new certificate is generated (e.g., on the first
> start of the server or when the IP address changes), you will need to add it
> to your device's trusted certificates.
### Congratulations on Setting Up Your Node!

Your next step is to add an authentication mechanism to your node by adding a decentralized identity.
Your next step is to add an authentication mechanism to your node by adding a
decentralized identity.
60 changes: 47 additions & 13 deletions docs/04-build/04-dev-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,57 @@ Dev mode offers several advantages:

## Prerequisites

Before using dev mode, ensure you have a node and a coordinator node running. This should be done in a
separate terminal window.
Before using dev mode, ensure you have a node and a coordinator node running.
This should be done in a separate terminal window. For more information, see the
[Setup guide](/getting-started/setup).

## How to Use Dev Mode

To use dev mode, you'll use the `context create` command with the `--dev` flag.
To list all supported commands, run the following command:

```bash title="Terminal"
cargo run -p meroctl -- --node-name node1 --home data help
```

Supported commands:

- `init` Initialize node configuration
- `config` Configure the node
- `run` Run a node
- `context` Manage contexts
- `app` Manage applications
- `help` Print this message or the help of the given subcommand(s)

Here's the basic syntax:

All commands share the same prefix:

```bash title="Terminal"
cargo run -p meroctl -- --home <path_to_home> --node-name <node_name> context create --dev --path <path_to_wasm_file> --version <version_number>
cargo run -p meroctl -- --home <path_to_home> --node-name <node_name> <command>
```

### Parameters:

- `--home`: Specifies the path to the home directory.
- `--home`: Specifies the path to the home directory. ( In our example we are
using `data` as the home directory)
- `--node-name`: Specifies the name of the node.
- `--dev`: Enables dev mode.
- `--path`: Specifies the path to your WASM file.
- `--version`: Specifies the version of your application (optional).

## Example Usage
- `--path`: Specifies the absolute path to your WASM file.

Create dev context using installed app

```bash title="Terminal"
$ cargo run -p meroctl -- --home data --node-name node1 context create --dev --path ./path/to/binary.wasm --version 1.0.0
Created BTgDJ5FezfFJCMWzRWScXiwkgfMHX3zX4s3Qum7Gf4pb linked to application ./path/to/binary.wasm
cargo run -p meroctl -- --home <path_to_home> --node-name <node_name> context create --watch <path>
```

### Example Usage

```bash title="Terminal"
$ cargo run -p meroctl -- --home data --node-name node1 context create --watch ./path/to/binary.wasm
Application `<appId>` installed!
Context `<contextId>` created!
Context{contextId} -> Application{appId}
(i) Watching for changes to "./path/to/binary.wasm"
```

This command will:
Expand Down Expand Up @@ -81,8 +107,9 @@ $ cargo run -p meroctl -- --home data --node-name node1 context ls
2. Create a context for a published application:

```bash title="Terminal"
$ cargo run -p meroctl -- --home data --node-name node1 context create --application-id APwGT9wuLwjkBoGxRR9thpS89VsbazYd6CpMpyqx4b5J
Created BTgDJ5FezfFJCMWzRWScXiwkgfMHX3zX4s3Qum7Gf4pb with application APwGT9wuLwjkBoGxRR9thpS89VsbazYd6CpMpyqx4b5J
$ cargo run -p meroctl -- --home data --node-name node1 context create --application-id <appId>
Context `contextId` created!
Context{contextId} -> Application{appId}
```

### From development to Publication
Expand All @@ -96,3 +123,10 @@ When you're ready to move from local development to publishing your application:

3. After publication, you can create contexts for your published application
using the --application-id flag instead of dev mode.

Install the local app on node for debugging

```bash title="Terminal"
cargo run -p meroctl -- --home <path_to_home> --node-name <node_name> app install –-path <path>
Application installed successfully. Application ID: <appId>
```

0 comments on commit f13a30f

Please sign in to comment.