Skip to content

Running nano_node as a service

Wesley Shillingford edited this page Apr 21, 2019 · 8 revisions

There are 3 different ways to enable RPC for the node:

In process

  • rpc_enable = true
  • rpc_in_process = true (default)

Child process

  • rpc_enable = true
  • rpc_path = path to nano_rpc
  • rpc_in_process = false
  • ipc -> tcp -> enable = true
  • ipc -> tcp -> port == ipc_port of rpc_config.json

Out of process

  • rpc_enable = false
  • rpc_path = path to nano_rpc
  • rpc_in_process = false
  • ipc -> tcp -> enable = true
  • ipc -> tcp -> port == ipc_port of rpc_config.json

The choice depends on the setup and security that you want. The easiest way is to use in_process: edit config.json & rpc_config.json after first launch

./nano_node --daemon
sed -i 's/"rpc_enable": "false"/"rpc_enable": "true"/g' ~/Nano/config.json   
sed -i 's/"enable_control": "false"/"enable_control": "true"/g' ~/Nano/rpc_config.json  

Launch nano_node in test mode

./nano_node --daemon --network=test

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=Nano 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