node-red-install.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y git
  18. msg_ok "Installed Dependencies"
  19. msg_info "Setting up Node.js Repository"
  20. $STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x)
  21. msg_ok "Set up Node.js Repository"
  22. msg_info "Installing Node.js"
  23. $STD apt-get install -y nodejs
  24. msg_ok "Installed Node.js"
  25. msg_info "Installing Node-Red"
  26. $STD npm install -g --unsafe-perm node-red
  27. msg_ok "Installed Node-Red"
  28. msg_info "Creating Service"
  29. service_path="/etc/systemd/system/nodered.service"
  30. echo "[Unit]
  31. Description=Node-RED
  32. After=syslog.target network.target
  33. [Service]
  34. ExecStart=/usr/bin/node-red --max-old-space-size=128 -v
  35. Restart=on-failure
  36. KillSignal=SIGINT
  37. SyslogIdentifier=node-red
  38. StandardOutput=syslog
  39. WorkingDirectory=/root/
  40. User=root
  41. Group=root
  42. [Install]
  43. WantedBy=multi-user.target" >$service_path
  44. $STD systemctl enable --now nodered.service
  45. msg_ok "Created Service"
  46. motd_ssh
  47. customize
  48. msg_info "Cleaning up"
  49. $STD apt-get autoremove
  50. $STD apt-get autoclean
  51. msg_ok "Cleaned"