Skip to content

Commit 199a1d4

Browse files
author
Dave Conway-Jones
committed
try to make systemd autostart recommendation more obvious
1 parent eac23af commit 199a1d4

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

docs/getting-started/running.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ The following two commands show these two approaches:
107107
There are many methods of starting, stopping and monitoring applications at boot time.
108108
Raspberry Pi users are *strongly* recommended to follow [these instructions](../hardware/raspberrypi).
109109

110-
Linux users that have a Debian flavour (e.g. Ubuntu, Mint, Debian, etc) may wish to use the
110+
Linux users that have a Debian flavour (e.g. Ubuntu, Mint, Debian, etc) are recommended to use the
111111
[Adding Autostart capability using SystemD](../hardware/raspberrypi#adding-autostart-capability-using-systemd)
112-
instructions from the Raspberry Pi docs though you will need to edit the downloaded `/lib/systemd/system/nodered.service` file to suit your user and environment.
112+
instructions from the Raspberry Pi docs though you will need to edit the downloaded `/lib/systemd/system/nodered.service` file to suit your *user id* and environment.
113113

114114
The guide below sets out what we believe to be the most straight-forward for
115115
the majority of users. For Windows, PM2 does not autorun as a service -

docs/hardware/raspberrypi.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ If you want Node-RED to run when the Pi boots up you can use
106106
sudo systemctl enable nodered.service
107107

108108

109-
#### Adding nodes to preloaded version (Jessie only)
109+
#### Adding nodes to preloaded version
110110

111111
To add additional nodes you must first install the `npm` tool, as it is not included
112-
in the default Jessie installation. This is not necessary if you have upgraded to Node.js 6.x.
112+
in the default Raspbian installation. This is not necessary if you have upgraded to Node.js 6.x.
113113

114114
The following commands install `npm` and then upgrade
115-
it to the latest `3.x` version.
115+
it to the latest version.
116116

117117
sudo apt-get install npm
118-
sudo npm install -g npm@3.x
118+
sudo npm install -g npm
119119
hash -r
120120
cd ~/.node-red
121121
npm install node-red-{example node name}
@@ -217,14 +217,34 @@ Systemd uses the `/var/log/system.log` for logging. To filter the log use
217217

218218
sudo journalctl -f -u nodered -o cat
219219

220+
#### Changing the systemd environment - non-Pi user
221+
222+
To run as a user other than Pi, you need to edit the nodered.service file. To edit this use sudo to edit the file `/lib/systemd/system/nodered.service` and change the lines 4, 5 and 6 as indicated by {your_user} below
223+
224+
[Service]
225+
Type=simple
226+
# Run as normal pi user - feel free to change...
227+
User={your_user}
228+
Group={your_user}
229+
WorkingDirectory=/home/{your_user}
230+
Nice=5
231+
Environment="PI_NODE_OPTIONS=--max_old_space_size=256"
232+
...
233+
234+
Save the file, and then run:
235+
236+
sudo systemctl daemon-reload
237+
220238
#### Changing the systemd environment - using a proxy
221239

222240
If you need to use a proxy for http requests - you need to set the *HTTP_PROXY* environment variable.
223241
When using *systemd* this must be done within the service configuration. To edit this use sudo to edit the file `/lib/systemd/system/nodered.service` and add another `Environment=` line, for example:
224242

243+
...
225244
Nice=5
226245
Environment="NODE_OPTIONS=--max-old-space-size=128"
227246
Environment="HTTP_PROXY=my-proxy-server-address"
247+
...
228248

229249
Save the file, and then run:
230250

0 commit comments

Comments
 (0)