-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHMIBSC_INSTALL_NODERED_DOCKER.sh
52 lines (42 loc) · 2.28 KB
/
HMIBSC_INSTALL_NODERED_DOCKER.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/bash
<<INFO_COMMENTS
This script will install on HMIBSBC NodeRed Docker Headless and use SE current settings and flow.
It will install docker if not installed. Nothing is required to be preinstalled on the native HMIBSC image.
It will install the latest version of NodeRed Docker which will restart at boot. This also disables the native OS NodeRed
More information can be found with the link and the basic command are summarized below:
https://nodered.org/docs/getting-started/docker
##### Reattach to the terminal (to see logging) run:
docker attach mynodered
##### Stop and sart the container
docker start mynodered
docker stop mynodered
##### Container Shell to run additional commands or NPM inside the docker. To exit type exit
docker exec -it mynodered /bin/bash
####################################################################
##### Everything Past this point can be copied and pasted to SSH#####
curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_INSTALL_NODERED_DOCKER.sh | sh -x
#####
###After Install of the Docker active NodeRed can be switch with the following:
##### Use Native OS NodeRed
curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_USE_NODERED.sh | sh -s -- -u OS
##### Use Docker NodeRed
curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_USE_NODERED.sh | sh -s -- -u DOCKER
####################################################################
INFO_COMMENTS
if [[ $(which docker) && $(docker --version) ]]; then
echo "Docker is installed"
# command
else
echo "Installing Docker"
curl -L https://raw.githubusercontent.com/jzhvymetal/HMIBSC_UPDATE/main/HMIBSC_INSTALL_DOCKER.sh | sh -x
fi
##stop OS nodered service
systemctl stop nodered
##disable OS nodred service
systemctl disable nodered
##Change rights or folder so docker can read them
chown -R 1000:1000 /home/root/.node-red
chown -R 1000:1000 /cer
##Install NodeRed Docker Headless and use SE current settings and flow
##User will have to install any nodes that where additionally OS installed nodered
docker run --hostname hmibsc --restart=always -d -p 1880:1880 -v /home/root/.node-red:/data -e FLOWS=/data/flows_$HOSTNAME.json -e NODE_OPTIONS="--max_old_space_size=256" -v /cer:/cer --name mynodered nodered/node-red:latest