[Unit]
Description=Node-RED
After=syslog.target network.target

[Service]
# Ansible template HAD: if is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17
# Ansible template HAD: if is_debuntu
{% if is_rpi %}
ExecStart=/usr/bin/node-red-pi --max-old-space-size=128 -v
{% else %}
# ExecStart=/usr/local/bin/node-red-pi --max-old-space-size=128 -v
ExecStart=/usr/bin/node-red-pi -v
{% endif %}
Restart=on-failure
KillSignal=SIGINT

# log output to syslog as 'node-red'
SyslogIdentifier=node-red
StandardOutput=syslog

# non-root user to run as
{% if is_rpi %}
WorkingDirectory=/home/pi/
User=pi
Group=pi
{% else %}
WorkingDirectory=/home/nodered/
User=nodered
Group=nodered
{% endif %}

[Install]
WantedBy=multi-user.target
