Skip to content

Running nano_node as a service

Roy Keene edited this page Jan 2, 2019 · 8 revisions

To enable RPC for node edit config.json after first launch

./nano_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 nano_node in test mode

./nano_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 nano_node as a service with systemd

sudo touch /etc/systemd/system/nano_node.service   
sudo chmod 664 /etc/systemd/system/nano_node.service   
sudo nano /etc/systemd/system/nano_node.service   

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

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

[Service]
ExecStart=/path_to_nano_node/nano_node --daemon
Restart=on-failure
User=username
Group=groupname

[Install]
WantedBy=multi-user.target

Start nano_node service

sudo service nano_node start

Enable at startup

sudo systemctl enable nano_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 & nano_node service. Check changes with ulimit -n