Closed dgoo2308 closed 2 years ago
Why set the user as an environment variable ? would it be simpler to pass in as a command line parameter (as the deb version does for all its options) ?
(but yes the other changes are fine)
@dceejay I found it easier to invoke the script in combination with a bash <(curl ....)
to prepend a it with variable in this first iteration.
But yes maybe we should standardize in line with the deb installer, I just found curl http://foo.com/script.sh | bash -s arg1 arg2
.
Or we do this on next iteration change that I planned to be able to run also without any interaction:
install_node-red [options]
options:
--help display this help and exits
--nodered-user <user> specify the user to run as e.g. --nodered-user=nodered
--confirm-root install as root without asking confirmation
--enable_firewall adding firewall rules for node-red port 1880 (default no Firewall rules added)
--confirm-install confirm the installation without asking a confirmation
please advise.
If you are enhancing further then I'm happy to wait - the options look good.
Hi @dgoo2308 - did you ever "finish" this... were there further updates you wanted to make ?
@dceejay just did added the command line options for rpm based install, please review.
Usage: update-nodejs-and-nodered [options]
options:
--help display this help and exits.
--nodered-user=<user> specify the user to run as e.g. '--nodered-user=nodered'.
--open-firewall adding public firewall rule for node-red port 1880.
--confirm-root install as root without asking confirmation.
--confirm-install confirm the installation without asking a confirmation.
Excellent - many thanks.
install for an alternative systemd user
why
As it is recommended to run web applications as a regular user, one would like to take a dedicated user, without sudo and as a fresh user who is not entangled as the power user who administer the RPM Linux box.
To accomplish this we need to do the install as a user(sudoer) or root and target a different user, this is what this change is about, also when the user does not exist, this user is created.
For Linux RPM installs by default it might not be running on low memory hardware, the script comment this in the systemd service file resulting in e.g.
/etc/systemd/system/nodered.service
All environment options can now be set in the
/etc/node-red/environment
which should not be in the user.node-red
directory, which contains the commented out options:Ussing the EnvironmentFile is recommended as it does not require a
sudo systemctl daemon-reload
and can with done with the single commandsudo systemctl restart nodered
.overview of the changes
NODERED_USER=test
nodered
during install when environment variableNODERED_USER
is not set.examples usage
with NODERED_USER set as regular user or root
as root user
OR => follow the advice to use the
nodered
useras regular user, target user the not existing nodered user for systemd service
OR don't follow the advice to use the
nodered
user and install as the user who started the script