Skip to content

Commit

Permalink
Add IOTA-Core docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-tortora committed May 15, 2024
1 parent 18307ee commit 613a0a3
Show file tree
Hide file tree
Showing 11 changed files with 1,560 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/build/apis/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const categories = [
collapsed: true,
items: './docs/core/v2/sidebar',
},
{
type: 'category',
label: 'V3',
collapsed: true,
items: './docs/core/v3/sidebar',
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
description: Getting started with the recommended requirements and installation links.
image: /img/icons/iota/iota_core.png
tags:
- IOTA Node
- IOTA-Core Node
- Linux
- macOS
- Windows
- Docker
- reference
- Requirements
---

# Getting Started

Running a node is an efficient way to use IOTA. By doing so, you have direct access to the Tangle instead of connecting
to and trusting someone else's node. Additionally, you help the network to become more distributed and resilient.

## Recommended Requirements

To handle a potentially high rate of blocks per second, nodes need enough computational power to run reliably and
should have the following minimum specs:

- 4 cores or 4 vCPU.
- 8 GB RAM.
- SSD storage.
- A public IP address.

The amount of storage you will need will depend on whether and how often you plan on _pruning_ old data from your local
database.

IOTA-Core exposes different functionality on different ports:

- `15600 TCP` - Gossip protocol port.
- `14626 UDP` - Autopeering port (optional).
- `14265 TCP` - REST HTTP API port (optional).

These ports are essential for flawless node operation. The REST HTTP API port is optional and is only needed if
you want to offer access to your node's API. You can customize all ports using
the [`config.json`](../how_tos/post_installation.md) file.

## Operating System

The IOTA-Core software is written in Go and can be deployed on all major platforms.
The [recommended setup](../how_tos/using_docker.md) uses Docker to run IOTA-Core together with some INX extensions
secured behind a [Traefik](https://traefik.io) SSL reverse proxy.

## Configuration

IOTA-Core uses two JSON configuration files that you can tweak based on your deployment requirements:

- `config.json` - Includes all core configuration parameters.
- `peering.json` - Includes connection details to node neighbors (peers).

You can read more about the configuration in the [post installation](../how_tos/post_installation.md) article.
81 changes: 81 additions & 0 deletions docs/maintain/iota-core/2.0/docs/how_tos/post_installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
description: Introducing the IOTA-Core node configuration files and their settings.
image: /img/icons/iota/iota_core.png
tags:
- IOTA Node
- IOTA-Core Node
- Configuration
- REST API
- Dashboard
- how to
---

# Post-installation

Once you have deployed IOTA-core, you can set all the parameters using configuration files.

## Configuration Files

The most important configuration files are:

- `config.json` - Includes all configuration flags and their values.
- `peering.json` - Includes all connection details to your static peers (neighbors).

## Default Configuration

There are default configuration files available that you can use:

- `config_testnet.json` - Includes the default values required to join the Testnet.
- `config_defaults.json` - Includes all default parameters used by IOTA-core. You can use this file as a reference when customizing your `config.json`

You can pick one of these files and use it as your `config.json` to join the configured network.

Please see the [`config.json`](../references/configuration.md) and `peering.json` articles for more information about the contents of the configuration files.

## Configuring HTTP REST API

One of the tasks the node is responsible for is exposing [API](../references/api_reference.md) to clients that would like to interact with the IOTA network, such as crypto wallets, exchanges, IoT devices, etc.

By default, IOTA-Core will expose the [Core REST API v3](../references/api_reference.md) on port `14265`.
If you use the [recommended setup](using_docker.md) the API will be exposed on the default HTTPS port (`443`) and secured using an SSL certificate.

Since offering the HTTP REST API to the public can consume your node's resources, there are options to restrict which routes can be called and other request limitations:

### Routes

- `restAPI.publicRoutes` defines which routes can be called without JWT authorization.
- `restAPI.protectedRoutes` defines which routes require JWT authorization.
- All other routes will not be exposed.

### JWT Auth

To generate a JWT-token to be used with the protected routes you can run:

```sh
./iota-core tool jwt-api --databasePath <path to your p2pstore> --salt <restAPI.jwtAuth.salt value from your config.json>
```

If you are running our [recommended setup](using_docker.md) then see [here](using_docker.md#tools).

### Proof-of-Work

If you are concerned with resource consumption, consider turning off `restAPI.pow.enabled`.
This way, the clients must perform proof of work locally before submitting a block for broadcast.
If you would like to offer proof of work to clients, consider increasing the `restAPI.pow.workerCount` to provide a faster block submission experience.

### Reverse Proxy

We recommend that you provide your HTTP REST API behind a reverse proxy, such as [HAProxy](http://www.haproxy.org/), [Traefik](https://traefik.io/), [Nginx](https://www.nginx.com/), or [Apache](https://www.apache.org/) configured with TLS.
When using our [recommended setup](using_docker.md) this is done for you automatically.

### Other

You can find all the HTTP REST API related options in the [`config.json` reference](../references/configuration.md#restapi)

## Update

You can update IOTA-Core to the latest stable version with no breaking updates by running the following command:

```sh
docker compose down && docker compose pull && docker compose up -d
```
215 changes: 215 additions & 0 deletions docs/maintain/iota-core/2.0/docs/how_tos/using_docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---
description: Learn how to install and run a iota-CORE node using Docker.
image: /img/icons/iota/iota_core.png
tags:
- IOTA Node
- IOTA-Core Node
- Docker
- Install
- Run
- macOS
- Windows
- Linux
- how to
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import LinuxCommands from '@site/docs/_admonitions/_linux-commands.md';

# Install IOTA-Core using Docker

This article guides the recommended setup to run an IOTA-Core node.
It includes everything required to set up a public node accessible by wallets and applications:

- [IOTA-core](https://github.com/iotaledger/iota-core)
- [Traefik](https://traefik.io) - Reverse proxy using SSL certificates to secure access to the node API and dashboard.
- [Prometheus](https://prometheus.io) - Metrics scraper configured to collect all metrics from IOTA-Core and INX extensions.
- [Grafana](https://grafana.com) - Data visualizer that can be used to display the metrics collected by Prometheus.
- [inx-dashboard](https://github.com/iotaledger/inx-dashboard) - Node dashboard.
- [inx-indexer](https://github.com/iotaledger/inx-indexer) - Indexer extension for wallets and applications.
- [inx-mqtt](https://github.com/iotaledger/inx-mqtt) - MQTT extension providing the Event API.

## Requirements

1. A recent release of Docker enterprise or community edition. Avoid using the Docker version shipped with your OS since these are mostly out of date. You can find installation instructions in the [official Docker documentation](https://docs.docker.com/engine/install/).
2. [Docker Compose CLI plugin](https://docs.docker.com/compose/install/linux/).
3. A registered domain name pointing to the public IP address of your server. _(optional if not using HTTPS)_
4. Opening up the following ports in your server's firewall:

- `15600 TCP` - Used for IOTA-Core gossip.
- `80 TCP` - Used for HTTP. _(can be changed, see below)_
- `443 TCP` - Used for HTTPS. _(optional if not using HTTPS)_

5. [curl](https://curl.se/).

## Download the latest release

<LinuxCommands/>

Once you have completed all the installation [requirements](#requirements), you can download one of the latest releases, depending on the network you want to join, by running the following command:

```sh
mkdir node-docker-setup && cd node-docker-setup && curl -L https://node-docker-setup.iota.org/iota2-testnet | tar -zx
```

## Prepare

<LinuxCommands/>

### 1. Generate dashboard credentials

To access your IOTA-Core dashboard, you need to configure credentials.
Run the following command to generate a password hash and salt for the dashboard:

```sh
docker compose run iota-core tools pwd-hash
```

Copy the output of the command for the next step.

### 2. Setup your Environment

Copy the `env_template` file to `.env` using the following command:

```sh
cp env_template .env
```

Modify the `.env` file to fit your needs with the editor of your choice.
We are using `nano` in the following example:

```sh
nano .env
```

Follow the instructions provided in the file.
With `nano`, you can save your changes and exit the editor using `CTRL+O` and `CTRL+X`.

:::note

You can configure your node to either use HTTP or HTTPS. For publicly exposed nodes, we heavily recommend using HTTPS.

:::

```sh reference
https://github.com/iotaledger/node-docker-setup/blob/feat/iota-core/testnet_iota-2.0/env_template
```

### 3. Setup neighbors

Add your IOTA-Core neighbor addresses to the `peering.json` file.

:::note

This step is recommended but optional if you are using autopeering.

:::

### 4. Create the `data` folder

All files used by IOTA-Core, the INX extensions, Traefik & co will be stored in a directory called `data`.
Docker image runs under user with user id `65532` and group id `65532`, so this directory needs to have the correct permissions to be accessed by the containers.
To create this directory with correct permissions, run the contained script:

```sh
./prepare_docker.sh
```

## Run

### Starting the node

You can start IOTA-Core node and INX extensions by running:

```sh
docker compose up -d
```

- `-d` Instructs Docker to start the containers in the background.

#### HTTPS

After starting the node, you will be able to access your services at the following endpoints:

- API: `https://node.your-domain.com/api/routes`
- IOTA-Core Dashboard: `https://node.your-domain.com/dashboard`
- Grafana: `https://node.your-domain.com/grafana` _(optional if using "monitoring" profile)_

:::warning

After starting your node for the first time, please change the default grafana credentials.
**User**: `admin`
**Password**: `admin`

:::

You can configure your wallet software to use `https://node.your-domain.com`.

#### HTTP

After starting the node, you will be able to access your services at the following endpoints:

- API: `http://localhost/api/routes`
- IOTA-Core Dashboard: `http://localhost/dashboard`
- Grafana: `http://localhost/grafana` _(optional if using "monitoring" profile)_

:::note

If you changed the default `HTTP_PORT` value, you must add the port to the URLs.

:::

You can configure your wallet software to use `http://localhost`.

### Displaying Log Output

You can display IOTA-Core logs by running:

```sh
docker compose logs -f iota-core
```

- `-f`
Instructs Docker to continue displaying the log to `stdout` until CTRL+C is pressed.

### Stopping the node

You can stop the IOTA-Core node and INX extensions by running:

```sh
docker compose down
```

### Tools

To access IOTA-Core tools, you can use the following command:

```sh
docker compose run iota-core tool <tool-name>
```

To see the list of tools included run the following:

```sh
docker compose run iota-core tool -h
```

## JWT Auth

To generate a JWT token to be used to access protected routes, you can run the following:

```sh
docker compose run iota-core tool jwt-api --databasePath data/p2pstore
```

- If you changed the `restAPI.jwtAuth.salt` value in the `config.json`, then you need to pass that value as a parameter as `--salt <restAPI.jwtAuth.salt value from your config.json>`.

## INX

This setup includes the INX extensions listed at the beginning of this guide.
If you want to disable certain extensions, you can comment out the different services in the `docker-compose.yml` file and restart the node.

# More Information

You can find more information in the [GitHub repository](https://github.com/iotaledger/node-docker-setup)

0 comments on commit 613a0a3

Please sign in to comment.