How to Become a Node Operator
How to Become a Node Operator
Introduction
Welcome to this guide on how to become a Node Operator.
Node Operators can run either data indexing projects or RPC endpoints for the network (or both). At a high level, a Node Operator will run Node Operator Service, and then the various services for the projects they index or endpoints they serve.
Let's take an overview of the basic steps involved in the process:
Steps | Process Flow |
---|---|
Step 1 | Setup & Start your Node Operator services locally in Docker or on an external VM |
Step 2 | Setup Proxy Endpoint to public |
Step 3 | Register yourself as a Node Operator to the Network |
Step 4 | Index a project or sync an RPC endpoint |
Step 5 | Create a Plan from a Plan Template |
Step 6 | Set a Node Operator Commission Rate |
Step 7 | Allocate your SQT to start receiving rewards |
Step 8 | Troubleshooting and FAQs |
Step 9 | Optional: Setting up a Grafana Dashboard |
Step 10 | Ongoing: Update Node Operator Services |
1. Deploy Node Operator Services
For those who are new to SubQuery, it is recommended to try running the Node Operator Service on your local machine first. For intermediate to advanced users, it is recommended to set up a VM on AWS (or similar) to host your Node Operator service. It does not need to be on the same VM as your data indexer or RPC endpoint (in fact we suggest that you run it seperately).
Recommend resources for the machine
Category | vCPU | RAM | Storage |
---|---|---|---|
indexer_db | 2 | 2G | -- |
subql_node (per project) | 2 | 2G | 400G |
indexer_proxy | 2 | 1G | -- |
Select the appropriate link to follow the guide to setup a Node Operator:
Please return here after following these guides.
Port configurations
Here are the recommended port configurations for running a Node Operator service:
- Port
8000 / TCP
: This port should be configured to only allow access from your own IP address, used byindexer_coordinator
. - Port
7370 / UDP
: This port can be opened to the public and used for broadcasting data to multiple clients or nodes in a peer-to-peer network, used byindexer_proxy
. - Port
80 / HTTP
: This port can be opened to the public and used byindexer_proxy
.
It's important to ensure that these ports are properly configured and secured to prevent any unauthorised access or security breaches.
Docker
Note that you will need to install Docker and some command tools, and then obtain the docker-compose.yml file.
Running Node Operator Services
Important:
Login to your VM and create a folder, such as subquery-indexer
- Run
cd subquery-indexer
- Run the follow cmd to download the latest
docker-compose.yml
:
curl https://raw.githubusercontent.com/subquery/network-indexer-services/main/deploy/docker-compose.yml -o docker-compose.yml
This will overwrite the existing docker-compose.yml file. Always use the latest versions (use pre-release versions at your own risk).
Service | Version Tag |
---|---|
subquerynetwork/indexer-coordinator | v2.7.0 |
subquerynetwork/indexer-proxy | v2.7.1 |
Important
Please go through the docker-compose file carefully, and change the following parameters to your own values:
- Your
POSTGRES_PASSWORD
under your postgres container, as well as--postgres-password
under coordinator container. - Your
--secret-key
under both coordinator and proxy containers. - Your
--jwt-secret
and--metrics-token
under proxy container.
Pay attention to the versions of indexer-coordinator
and indexer-proxy
, you should use the latest version. Older versions may experience errors or not generate rewards!
2. Setup Proxy Endpoint to public
After running the docker-compose, you can access proxy endpoint via http://localhost/healthy
. You need to make this endpoint publicaly accessible, we will use Nginx to do this.
- Download Nginx:
sudo apt-get install nginx
- Create a Nginx config:
mkdir nginx && touch $_/nginx.conf
- Update
nginx/nginx.conf
to add a reverse proxy to our proxy endpoint.
server {
listen 80;
location / {
proxy_pass http://localhost/; # The proxy endpoint.
}
}
- Copy to
conf.d
:sudo cp nginx/nginx.conf /etc/nginx/conf.d/
- Start Nginx:
sudo systemctl start nginx
orsudo systemctl reload nginx
- Test via
curl http://your_ip_or_domain
.
We highly recommend setting up SSL on your new server and consulting our security guide carefully. You may be penalised for not setting up SSL, firewalls, or following our security guidelines.
3. Register in the Node Operator Admin App
Once your Indexing Service is all set and running successfully, you should open the Node Operator Admin App and follow the steps to register yourself (usually this is http://localhost:8000/
depending on your installation). This includes:
- Connect your wallet
- Register and stake your minimum required stake (see the current value)
- Add metadata information for your Node Operator account
We suggest you also setup your Social Profile so Delegators can get to know you, and so you can show social credibility. To setup social credibility, create an ENS domain name and profile linked to your wallet. You can setup an ENS domain here.
4. Index or Sync a Project
Node Operators can run either data indexing projects or RPC endpoints for the network (or both).
- To index a data indexing project, please follow the instructions here.
- To connect an RPC endpoint, please follow the instructions here.
5. Create a Plan from a Plan Template
For the initial stages of Mainnet, the SubQuery Council will set some default plan templates to make plan management and creation easier. As a result, plan creation is very easy and just requires to you enter a price. See the guide here.
6. Configure a Node Operator Commission Rate (NOCR)
Please update your Node Operator Commission Rate (NOCR) in order to attract more Delegators. You can read more about this here. You can do this by viewing your Node Operator Delegators page, and you can change it by clicking Change commission rate
Enter a new value (in a percent) and submit via your wallet.
Changes will come into effect at the start of the next Era.
7. Allocate your SQT stake to start receiving rewards
You must actively allocate or assign your staked and delegated SQT to certain projects you run in order to receive rewards. Unallocated SQT is essentially wasted.
We suggest you check this page at the start of each Era, and make sure you are keeping on top to maximise allocated SQT, and also allocate SQT to more profitable projects (e.g. ones with a higer APY). Find out how here.
We also highly recommend that you enable Auto Reduce Over Allocation to prevent being over allocated.
8. Troubleshooting and FAQs
Visit Troubleshooting or FAQs if you run into technical issues.
9. Setting up a Grafana Dashboard (Optional)
This guide will walk you through setting up a preconfigured Grafana Dashboard to view metrics from the indexer-coordinator
and indexer-proxy
.
Backup your Docker Compose
Make a backup of your existing docker-compose.yaml
file (in the Node Operator services folder) before proceeding with Grafana setup.
We will automatically pull and overwrite your version with the latest
Navigate to the directory where your docker-compose.yml
file is located (this will be referred to as indexer-services-folder
) and run the command
cd indexer-services-folder
# Note the next step will overwrite your existing docker-compose.yml, make sure you have a backup
mkdir network-indexer-services-temp && curl -L https://api.github.com/repos/subquery/network-indexer-services/tarball/main | tar -xzf - --strip-components=1 -C ./network-indexer-services-temp && rm -rf ./ipfs ./metrics && mv ./network-indexer-services-temp/deploy/* . && rm -rf ./network-indexer-services-temp
This will generate a folder named metrics
containing all the necessary setup files for your Dashboard.
Before using the docker-compose file in the metrics
directory, you should port over your previous changes from your backup that you created earlier, and make several additional modifications:
- Open the
docker-compose-metrics.yml
file and update theGF_SECURITY_ADMIN_PASSWORD
variable. This is the password you'll use to log in to the Grafana dashboard. - Navigate to
metrics/datasources/datasource.yml
and update the Authorization token. It should match the--metrics-token
specified in the proxy container section of yourdocker-compose.yml
file. - In the
metrics/prometheus.yml
file, update thebearer_token
. It should also match the--metrics-token
value, but in the format ofBearer <metrics-token-here>
. - If your
indexer-proxy
runs on a non-default port, update the target underquery_count -> static_configs -> targets
in themetrics/prometheus.yml
file.
For Linux Users
If you are running your Node Operator services on linux you need specify the exact ip instead of host.docker.internal
inside metrics/prometheus.yml
file.
You can get this for indexer-proxy
and indexer-coordinator
by running:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>
After doing this configuration you can start up the compose file:
docker-compose -f ./metrics/docker-compose-metrics.yml up -d
Head to http://<indexer-endpoint>:3000
, your username will be admin
and password will be whatever you set for GF_SECURITY_ADMIN_PASSWORD
Once you have successfully logged in, look for 'dashboards' on the left-hand side of the screen. Under the 'general' section, you will find a dashboard that looks like this:
10. Upgrade Node Operator services (Ongoing)
To upgrade a Node Operator service, you will need to update the version of the image used in the docker-compose file. This can be done by updating the image field in the service definition to the new version you want to use.
Once the image version has been updated in the docker-compose file, you can restart the specific container that needs to be upgraded. This can be done by running the following command in the terminal:
docker-compose up -d --no-deps container-service-name
The up
command starts the container in the background, while the --no-deps
flag prevents Docker Compose from starting any linked services. Finally, the container-service-name
argument specifies the name of the container that needs to be restarted.
By following these simple steps, you can upgrade your Node Operator services in Docker Compose and ensure that they are running the latest version of the image.