想要把流程控制交給 Node Red 處理,接下來有幾個步驟要進行
- 啟動 centos 環境
- 建立 NodeRed 環境
- 建立帳號密碼的資料庫
- 透過登入頁面進入 NodeRed 環境
- 建立系統
docker run --name base --rm -itd -p 8080:80 -p 1234:443 --network=bridge centos:8 bash
docker attach
dnf update
# https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-centos-8
dnf module enable nodejs:14 -y
dnf install nodejs -y
docker export base > base.tar
cat base.tar | docker import - base
docker run --name base --rm -itd -p 8080:80 -p 1234:443 -p 1880:1880 --network=bridge -v ${PWD}:/app --privileged base bash
dnf install vim -y
應該是沒用,因為沒有辦法啟用systemctl 提供服務,跳過
https://www.footmark.info/linux/centos/centos8-yum-nginx-stable-mainline/
yum install yum-utils -y
# 增加 nginx-repo
vim /etc/yum.repos.d/nginx.repo
dnf update
dnf install -y nginx nginx-module-njs
systemctl enable --now nginx
docker run --name pg --rm -itd -p 5432:5432 -v ${PWD}/psql/data:/var/lib/postgresql/data/pgdata \
-v ${PWD}/app:/app \
-e POSTGRES_USER=<user> \
-e POSTGRES_DB=cai \
-e POSTGRES_PASSWORD=<pwd> \
-e PGDATA=/var/lib/postgresql/data/pgdata \
--network=bridge \
--hostname=pg \
postgres:latest
docker-compose -f docker-compose.yml up -d --remove-orphans
- 建立 container
docker run --name base --rm -itd -p 8080:80 -p 1234:443 --network=bridge -v ${PWD}:/app base bash
docker attach base
- 建立 nodejs 環境
docker run --name base --rm -itd -p 8080:80 -p 1234:443 --network=bridge -v ${PWD}:/app base bash
- 安裝nodered
# https://github.com/node-red/linux-installers
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
dnf groupinstall "Development Tools"
cd /app
npm install --unsafe-perm node-red
node /app/node_modules/node-red/red.js
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
export NODE_PATH=<PRROJECT>/node-modules
adminAuth: require('node-red-contrib-ldap-auth').setup({
uri:'ldap://<dns>',
base: '<base>',
filterTemplate: '(sAMAccountName={{username}})',
bind_dn: '<ap_dn>',
bind_pw: '<pw>',
no_verify_ssl: true,
anon_read: false,
}),