noia-network / noia-node-cli

NOIA node headless (terminal) sample for noia-node.
GNU Lesser General Public License v2.1
11 stars 4 forks source link

noia-node.service not works #12

Closed luchmedia closed 6 years ago

luchmedia commented 6 years ago

I installed noia-node-cli globally with npm in /usr/bin/ directory. After that i launched it with command to set master address, i setted wallet address, cache folder, ecc. I setted also noia-node.service placing it in /etc/systemd/system/, maked it executable, update systemctl daemon, enabled service e started it. If i check service status returns me this error:

UnhandledPromiseRejectionWarning: Error: master address null or undefined
noia-node-cli[3258]: at Master.connect (/usr/lib/node_modules/@noia-network/node-cli/node_modules/@noia-network/node/dist/lib/master.js:52:19)
noia-node-cli[3258]: at Node.start (/usr/lib/node_modules/@noia-network/node-cli/node_modules/@noia-network/node/dist/index.js:91:25)
noia-node-cli[3258]: at /usr/lib/node_modules/@noia-network/node-cli/dist/index.js:53:26
noia-node-cli[3258]: at step (/usr/lib/node_modules/@noia-network/node-cli/node_modules/tslib/tslib.js:133:27)
noia-node-cli[3258]: at Object.next (/usr/lib/node_modules/@noia-network/node-cli/node_modules/tslib/tslib.js:114:57)
noia-node-cli[3258]: at fulfilled (/usr/lib/node_modules/@noia-network/node-cli/node_modules/tslib/tslib.js:104:62)

If i run node luanching simply command "noia-node-cli" it works fine and uptime in /home/myuser/.noia-node-cli/statistics.json increases correctly

My noia-node.service file:

[Unit]
Description=NOIA Node

[Service]
# If script is installed locally, set its location.
ExecStart=/usr/bin/noia-node-cli
Restart=always
User=root
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
# Set working directory.
WorkingDirectory=/usr/bin
# Set NOIA data location.
Environment=NOIA_NODE_USER_DATA_PATH=/media/myuser/Data/noia_cache

[Install]
WantedBy=multi-user.target
maaft commented 6 years ago

In noia-node.service set Environment=NOIA_NODE_USER_DATA_PATH= to /home/myuser/.noia-node-cli/

Also, I would suggest to set User and Group to "myuser", because running untested software as root is a security issue.

luchmedia commented 6 years ago

@maaft I understood that the location cache was the cache location. I run noia-node-cli already as "myuser", i only install cli node with npm with sudo permissions

maaft commented 6 years ago

If your run the software with sudo systemctl start noia-node.service and that file contains:

User=root
Group=root

the node will be run as root.

Is your problem solved? If yes, feel free to close the issue.

MartynasZilinskas commented 6 years ago

Thanks for submitting an issue. I am closing this issue, if it's not yet resolved, please re-open.