Skip to content

Running rai_node as a service

Ben Green edited this page Jan 4, 2018 · 11 revisions

To enable RPC for node edit config.json after first launch
./rai_node --daemon
sed -i 's/"rpc_enable": "false"/"rpc_enable": "true"/g' ~/RaiBlocks/config.json
sed -i 's/"enable_control": "false"/"enable_control": "true"/g' ~/RaiBlocks/config.json

Launch rai_node in test mode
./rai_node --daemon

Check if RPC is enabled with curl (use different terminal or session)
curl -g -d '{ "action": "block_count" }' [::1]:7076

To stop node, use
curl -g -d '{ "action": "stop" }' [::1]:7076

Launch rai_node as a service with system.d
sudo touch /etc/systemd/system/rai_node.service
sudo chmod 664 /etc/systemd/system/rai_node.service
sudo nano /etc/systemd/system/rai_node.service

Paste your specific user, group, path settings (example)

[Unit]
Description=RaiBlocks node service
After=network.target

[Service]
ExecStart=/path_to_rai_node/rai_node --daemon
Restart=on-failure
User=username
Group=groupname

[Install]
WantedBy=multi-user.target

Start rai_node service

sudo service rai_node start

Enable at startup

sudo systemctl enable rai_node

To manage node, use RPC commands or CLI


Known issues

Error initiating bootstrap ... Too many open files

Increase max open files limit. Edit /etc/security/limits.conf & add

    *               soft    nofile          65535    
    *               hard    nofile          65535    
    root            soft    nofile          65535    
    root            hard    nofile          65535    

Then restart session & rai_node service. Check changes with ulimit -n