Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HowTo] Install this plugin with standalone node-red and without iobroker #174

Open
Catfriend1 opened this issue Aug 15, 2021 · 0 comments

Comments

@Catfriend1
Copy link

Catfriend1 commented Aug 15, 2021

Hi,

I've managed to install the current release standalone to save a bit of RAM resources on my HA server. As I've google'd this for a longer time and found no advice/tutorial on how to do it WITHOUT iobroker, I now feel it might help other people to share the solution. Please feel free @datech to add this to the wiki if it's good for you.

  • HOWTO : Install node-red-contrib-amazon-echo as a standalone nodered systemd service on Debian 10.10 "buster" amd64.

First, you maybe would like to uninstall iobroker. If not, skip this section.

systemctl stop iobroker
systemctl disable iobroker
#
rm -rf /etc/systemd/system/iobroker.service.d/
rm /lib/systemd/system/iobroker.service
systemctl daemon-reload
#
rm -rf /opt/iobroker/
#
userdel iobroker

Second, we do a fresh standalone installation of node-red.

#!/bin/sh
#
# Install nodejs
apt-get -y install curl
curl -sl "https://deb.nodesource.com/setup_14.x" | sudo -E bash -
apt-get install -y nodejs
node -v
#
# Install node-red
## Source
### https://nodered.org/docs/getting-started/local
npm install -g --unsafe-perm node-red
#
# Install alexa local device emulator
( mkdir -p /root/.node-red/; cd /root/.node-red; npm install node-red-contrib-amazon-echo )
#
# Start node-red
node-red
# Browser: http://192.168.x.y:1880/
# lsof -i -P
## tcp 80, udp 1900 LISTEN
#
# You may want to customize settings in "/root/.node-red/settings.js" to set up admin web UI authentication by username and password or bind the admin web UI of node-red to a specific network interface.
## Generate the admin password hash like this
### node-red admin hash-pw
#
exit 0

Third part: You may want to run node-red (with this plugin) automatically by systemd on system startup.

I've therefore created a systemd unit for Debian, based on this source: https://raw.githubusercontent.com/node-red/linux-installers/master/resources/nodered.service

Create the file: nano "/etc/systemd/system/nodered.service"

[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=https://raw.githubusercontent.com/node-red/linux-installers/master/resources/nodered.service

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root
Environment="NODE_OPTIONS=--max_old_space_size=128"
ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'
# ExecStartPre=+/sbin/setcap 'cap_net_bind_service=+ep' /usr/bin/node
ExecStart=/usr/bin/env node-red $NODE_OPTIONS $NODE_RED_OPTIONS
KillSignal=SIGINT
Restart=on-failure
RestartSec=20
SyslogIdentifier=Node-RED

[Install]
WantedBy=multi-user.target

Then do: systemctl reload; systemctl enable nodered.service; systemctl start nodered.service

Kind regards,
Catfriend1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant