-
Notifications
You must be signed in to change notification settings - Fork 8
Tethys worker installation
To run a single worker you need:
- 4 vCPU
- 16GB RAM
- 1TB SSD
- Stable 24/7 Internet connection, at least 1Gbit
- public IP and two ports open for incoming traffic:
- one UDP port for p2p communication (default 12345),
- one TCP port for Prometheus metrics (default 9090).
-
100_000
tSQD
tokens (funded to a special vesting contract owned by the Primary Address). - Some Arbitrum Sepolia ETH (for gas)
The same Primary Address can be used to register multiple workers (if the vesting contract has sufficient funds).
Worker itself is available in two forms:
- as a Docker image,
- as source code.
Please refer to the appropriate section for further instructions.
- Docker engine (tested with version 25.0.4)
- Docker compose (tested with version 2.24.7)
-
Create a new directory and save this
run_worker.sh
script in it. -
Generate your
key
file by running the command below in the newly created directory. It will display your peer ID — please copy this ID, as it will be needed for on-chain worker registration.$ docker run --rm subsquid/rpc-node:0.2.5 keygen >key Your peer ID: <THIS IS WHAT YOU NEED TO COPY>
⚠️ Note: Please make sure that the generated file is safe and secure (i.e., it will not be deleted accidentally and cannot be accessed by unauthorized parties). -
Register your worker by logging into the testnet Web APP with the Primary Wallet you provided in the onboarding form. You will need the Peer ID from the previous step. See the detailed instructions here.
-
Make the
run_worker.sh
script executable and run./run_worker.sh <DATA_DIR> up -d
to start the node.<DATA_DIR>
is a directory where the downloaded data will be stored — please make sure it exists and can accommodate up to 1 TB of data. If you want to use a different port than the default 12345, set theLISTEN_PORT
environment variable. -
Check the status of the containers with
docker container ls
. Check the worker logs usingdocker logs -f worker-1
. After some time the worker should output some info on the downloaded data chunks. See Docker docs for a reference of Docker commands.
-
Install prerequisites (Rust, Git, Protobuf, etc).
apt install curl git build-essential pkg-config protobuf-compiler libssl-dev libsqlite3-dev curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone the worker repo.
git clone --depth 1 --branch v1.0.0-rc3 https://github.com/subsquid/worker-rs.git
-
Build the worker.
cd worker-rs mv .env.testnet .env cargo build --release
-
(optional) Edit parameters in the
.env
file. The libp2p address and port, specified in theP2P_LISTEN_ADDRS
var, should be available for external connections (in the sample config the worker listens on12345
). -
Run the worker using the command below. It uses
nohup
, but you may also consider daemonizing it withsystemd
to tolerate server restarts. A key file will be created at the provided path if you don't have one.nohup cargo run --release -- \ --data-dir <path where you want to store downloaded data> \ p2p \ --key <file path where your key is stored>
It will display your local peer ID in the logs — please copy this ID, as it will be needed for on-chain worker registration.
You can also add the
--port <port>
to specify the Prometheus metrics port instead of the default8000
.
Important
Be careful when supplying the path to the existing key. If you supply the wrong path, a new random key will be automatically created there and your node will attempt to operate with a new (unregistered) peer ID — unsuccessfully.
-
Register your worker by logging into the testnet Web APP with the Primary Wallet you provided in the onboarding form. You will need the Peer ID from the previous step. See the detailed instructions here.
-
When the worker gets recognized by the scheduler, it should start downloading data and serving queries.
It is printed when you run keygen
(see the steps for running worker using Docker).
It is also in the first line of the worker log output. For the docker setup, list the containers with docker container ls
and inspect the
worker
container logs with docker compose logs | head
The log line you are looking for should look like this
INFO worker_rust::transport::p2p: Local peer ID: <THIS IS WHAT YOU NEED TO COPY>
See the Tethys annoucement page for details.
Depending on your connection quality, you might want to tune the S3_TIMEOUT
and CONCURRENT_DOWNLOADS
environment variables. In case you're using our Docker image, edit the run_worker.sh
script and add lines setting these vars to the services.worker.environment
section. If you encounter this error frequently, try to set S3_TIMEOUT
to 180
. If it still doesn't help, set CONCURRENT_DOWNLOADS
to 1
and S3_READ_TIMEOUT
to 30
.
Something is wrong with your local data. Stop the worker, remove the entire data directory and start it again.
Just ignore it
Yes, copy the key file (located in the key
file located at KEY_PATH
) to the new working directory before starting. You don't need to re-register your worker.
Docker makes for an easier setup. Building from sources is suitable only for experienced Linux/Unix users.
Check the pings endpoint and locate the version by your PeerID.
We recommend Ubuntu 22.04 LTS
This is a docker issue, not a problem with the worker. Look at this GitHub issue and this StackOverflow thread for more context.
Copy your peer ID and look for an entry on this page. If the last ping timestamp is <1 minute ago, and the listed version is the most recent one, you should be good. Alternatively, you can use this Python script.