documentation: improves lotus seal worker copy

This commit is contained in:
@wwwjim 2019-12-18 11:25:57 -08:00
parent eb73a4f116
commit 7b5728985d

View File

@ -1,8 +1,8 @@
# Lotus Seal Worker # Lotus Seal Worker
The `lotus-seal-worker` is an extra process that can offload heavy processing The **Lotus Seal Worker** is an extra process that can offload heavy processing
tasks from your `lotus-storage-miner`. It can be run on the same machine as your tasks from your **Lotus Storage Miner**. It can be run on the same machine as
`lotus-storage-miner`, or on a different machine communicating over a fast your `lotus-storage-miner`, or on another machine communicating over a fast
network. network.
## Get Started ## Get Started
@ -15,16 +15,18 @@ make lotus-seal-worker
## Running Alongside Storage Miner ## Running Alongside Storage Miner
You may wish to run the lotus seal worker on the same computer as the storage You may wish to run the **Lotus Seal Worker** on the same computer as the
miner. This allows you to easily set the process priority of the sealing tasks **Lotus Storage Miner**. This allows you to easily set the process priority of
to be lower than the priority of your more important storage miner process. the sealing tasks to be lower than the priority of your more important storage
miner process.
To do this, simply run `lotus-seal-worker run`, and the seal worker will To do this, simply run `lotus-seal-worker run`, and the seal worker will
automatically pick up the correct authentication tokens from the automatically pick up the correct authentication tokens from the
`LOTUS_STORAGE_PATH` miner repository. `LOTUS_STORAGE_PATH` miner repository.
To check that the seal worker is properly connected to your storage miner, run To check that the **Lotus Seal Worker** is properly connected to your storage
`lotus-storage-miner info` and check that the remote worker count has increased. miner, run `lotus-storage-miner info` and check that the remote worker count has
increased.
```sh ```sh
why@computer ~/lotus> lotus-storage-miner info why@computer ~/lotus> lotus-storage-miner info
@ -40,11 +42,11 @@ Sectors: map[Committing:0 Proving:0 Total:0]
## Running Over the Network ## Running Over the Network
To use an entirely separate computer for sealing tasks, you will want to run the Warning: This setup is a little more complex than running it locally.
`lotus-seal-worker` on a separate machine, connected to your storage miner via
the local area network.
This setup is a little more complex than running it locally. To use an entirely separate computer for sealing tasks, you will want to run the
`lotus-seal-worker` on a separate machine, connected to your **Lotus Storage
Miner** via the local area network.
First, you will need to ensure your `lotus-storage-miner`'s API is accessible First, you will need to ensure your `lotus-storage-miner`'s API is accessible
over the network. over the network.
@ -52,7 +54,7 @@ over the network.
To do this, open up `~/.lotusstorage/config.toml` (Or if you manually set To do this, open up `~/.lotusstorage/config.toml` (Or if you manually set
`LOTUS_STORAGE_PATH`, look under that directory) and look for the API field. `LOTUS_STORAGE_PATH`, look under that directory) and look for the API field.
By default it should look something like: Default config:
```toml ```toml
[API] [API]
@ -61,39 +63,33 @@ ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
To make your node accessible over the local area network, you will need to To make your node accessible over the local area network, you will need to
determine your machines IP on the LAN, and change the `127.0.0.1` in the file to determine your machines IP on the LAN, and change the `127.0.0.1` in the file to
that address. A less secure, but more permissive option is to change it to that address.
`0.0.0.0`. This will allow anyone who can connect to your computer on that port
to access the API (though they will still need an auth token, as we will discuss
next).
Next, you will need to get an authentication token for the seal worker. All A more permissive and less secure option is to change it to `0.0.0.0`. This will
lotus APIs require authentication tokens to ensure your processes are as secure allow anyone who can connect to your computer on that port to access the
against attackers attempting to make unauthenticated requests to them. To create [API](https://docs.lotu.sh/en+api). They will still need an auth token.
a token, run `lotus-storage-miner auth create-token --perm admin`. This will
create a token with `admin` permissions. Note: This is an admin token, it can
access any of the api endpoints of your node, take care not to leak it. See the
[scripting support doc](api-scripting-support.md) for more details.
This token will look something like this: Next, you will need to
[create an authentication token](https://docs.lotu.sh/en+api-scripting-support#generate-a-jwt-46).
All Lotus APIs require authentication tokens to ensure your processes are as
secure against attackers attempting to make unauthenticated requests to them.
### Connect the Lotus Seal Worker
On the machine that will run `lotus-seal-worker`, set the `STORAGE_API_INFO`
environment variable to `TOKEN:STORAGE_NODE_MULTIADDR`. Where `TOKEN` is the
token we created above, and `STORAGE_NODE_MULTIADDR` is the `multiaddr` of the
**Lotus Storage Miner** API that was set in `config.toml`.
Once this is set, run:
```sh ```sh
why@computer ~> lotus-storage-miner auth create-token --perm admin lotus-seal-worker run
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.KWWdh1jOVP_5YMAp8x5wNomFGgKS75ucOtj1ah5iP7k
``` ```
Now that you have allowed the storage miner to be connected to, and have created To check that the **Lotus Seal Worker** is connected to your **Lotus Storage
an auth token, its time to connect up the seal worker. Miner**, run `lotus-storage-miner info` and check that the remote worker count
has increased.
On the machine that you will be running the `lotus-seal-worker` on, you will
need to set the `STORAGE_API_INFO` environment variable to
`TOKEN:STORAGE_NODE_MULTIADDR`. Where `TOKEN` is the token we created above, and
`STORAGE_NODE_MULTIADDR` is the multiaddr of the storage miners api that we set
in the config file.
Once this is set, you should be able to just run `lotus-seal-worker run`.
To check that the seal worker is properly connected to your storage miner, run
`lotus-storage-miner info` and check that the remote worker count has increased.
```sh ```sh
why@computer ~/lotus> lotus-storage-miner info why@computer ~/lotus> lotus-storage-miner info