rpcpool.solana_rpc
Solana RPC Role
=========
This is an Ansible role to set up a Solana RPC node. It configures the validator software to run in RPC mode under the user solana
. The RPC service is installed as a user-specific service for this user.
Updates
- From Solana versions 1.8.15 (mainnet) and 1.9.6 (testnet) onward, you'll need to set
solana_full_rpc_api: true
for the role to create a fully functional RPC API node.
Hardware Requirements
An RPC server needs at least the same specifications as a Solana validator, usually with even higher demands. For best performance, we recommend using 256 GB of RAM to handle indexes. For complete hardware specs, check Solana Validator Requirements. We highly suggest using a bare metal provider (avoiding Hetzner) unless you're experienced.
Prepare your host by correctly setting up the directories for your Accounts database and Ledger. You can set up a tmpfs
folder for accounts and a separate filesystem (preferably on an NVMe drive) for the ledger, such as:
/solana/tmpfs - a 100 GB tmpfs partition for account state
/solana/ledger - a 2 TB NVME drive for ledger storage
Why Bare Metal?
Cloud servers (like AWS, GCP) are mostly unsuitable for Solana due to:
- High egress costs, as Solana consumes lots of data.
- Poor single-core performance compared to bare metal.
- Many cloud providers limit such workloads on cheaper instances, making you opt for expensive bare metal options.
Why Not Hetzner?
Hetzner does not allow Solana RPC services on its network, actively blocking connections to Solana and throttling traffic. Your node will struggle to sync with the network, especially on mainnet, and your account could be shut down.
Software Requirements
- Ansible >= 2.7 (mostly tested on Ansible 2.8)
- Ubuntu 18.04 or higher on the target machine
This role assumes some familiarity with deploying the Solana validator software.
Role Variables
The setup ensures that the checksum for the Solana installer version you’re downloading matches one specified in vars/main.yml
. If you want to install a different version, check the sha256 checksum of the installer script first.
There are many configurable parameters for Solana. You can deploy a Solana RPC node with defaults and have a decent experience. If no parameters are specified, it configures a standard mainnet
RPC node.
Basic Variables
These are key variables that configure the validator setup. They have default values but can be customized:
Name | Default Value | Description |
---|---|---|
solana_version |
stable | Solana version to install. |
solana_full_rpc_api |
true |
Enables the full RPC API (typically required). |
solana_root |
/solana | Main directory for ledger and accounts. |
solana_ledger_location |
/solana/ledger | Storage for Solana ledger (use NVMe). |
solana_accounts_location |
/solana/ledger/accounts | Storage for accounts info (if using tmpfs). |
solana_snapshots_location |
Storage for Solana snapshots. | |
solana_keypairs |
[] |
List of keypairs to copy to the validator node. |
solana_generate_keypair |
true | Whether to generate a new keypair. |
solana_public_key |
/home/solana/identity.json |
Validator node identity location. |
solana_network |
mainnet | The Solana network this node connects to. |
solana_enabled_services |
[ solana-rpc ] |
List of services to start on boot. |
solana_disabled_services |
[ ] |
List of services to disable. |
Ports
The following ports must be configured for your RPC server:
Name | Default Value | Description |
---|---|---|
solana_gossip_port |
8001 | Gossip traffic (must be publicly accessible). |
solana_rpc_port |
8899 (+8900) | Ports for incoming RPC and websocket (ideally not publicly open). |
solana_rpc_bind_address |
127.0.0.1 | Address for RPC binding (typically localhost). |
solana_dynamic_port_range |
8002-8020 | Ports for incoming Solana traffic (may need to be public for UDP). |
You need at least ports 8001-8020 open for default traffic.
Network Specific Variables
Default values are listed in vars/{{ solana_network }}-default.yml
. You'll need to specify various variables unless using defaults.
- Various network-specific parameters manage connection and performance for your RPC node.
Testing and Starting the RPC Node
After deploying, log in and switch to the solana
user. To check the status or see logs, use the following commands:
- Check starting status:
systemctl --user status solana-rpc
. - View logs:
journalctl --user -u solana-rpc -f
.
If it's your first time, consider adjusting the startup script for any necessary first-time downloads, and monitor catchup progress with solana catchup --our-localhost
.
Security Concerns
Ensure your RPC server does not expose ports 8899 and 8900 directly. Use proxies like nginx or HAproxy with SSL for added security.
Other Resources
There are numerous guides and playbooks available to assist you with your Solana RPC setup, including reverse proxy configurations and other performance nuances.
For licensing, this role is under MIT License, with contributions welcomed from users.
This simplified overview provides an accessible understanding of setting up a Solana RPC node, emphasizing key requirements, configurations, and safety measures.
ansible-galaxy install rpcpool.solana_rpc