From 2acc81a7fa54e00e2b612309676f93fcce254bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E5=BB=BA=E5=9B=BD?= <9340100@qq.com> Date: Thu, 19 Sep 2024 08:34:39 +0000 Subject: [PATCH] =?UTF-8?q?[Feature]:=20=E4=BC=81=E4=B8=9A=E7=89=88=20dock?= =?UTF-8?q?er=20=E9=A2=84=E8=A3=85node-red=20#7002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/.gitignore | 3 ++- deploy/enterprise/app/nodered/settings.js | 5 ++++- .../fs/opt/steedos/templates/nginx-app.conf.sh | 14 ++++++++++++++ .../steedos/templates/supervisord/nodered.conf | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 deploy/enterprise/fs/opt/steedos/templates/supervisord/nodered.conf diff --git a/deploy/.gitignore b/deploy/.gitignore index 7b40af20ba..7506bdb01d 100644 --- a/deploy/.gitignore +++ b/deploy/.gitignore @@ -1,4 +1,5 @@ storage .env mongo-data -info.json \ No newline at end of file +info.json +yarn.lock \ No newline at end of file diff --git a/deploy/enterprise/app/nodered/settings.js b/deploy/enterprise/app/nodered/settings.js index 37f6c310ce..5d498aeaf8 100644 --- a/deploy/enterprise/app/nodered/settings.js +++ b/deploy/enterprise/app/nodered/settings.js @@ -5,7 +5,8 @@ const lodash = require('lodash'); // Node-Red Configuration // https://nodered.org/docs/user-guide/runtime/configuration -process.env.PORT = 3200; +const uiPort = process.env.NODERED_PORT || "1880"; + const storageDir = path.join(process.env.STEEDOS_STORAGE_DIR, "data", "node-red"); @@ -17,5 +18,7 @@ module.exports = { functionGlobalContext: { lodash }, + uiPort, httpStatic: path.join(__dirname, 'public'), + httpRoot: "/nodered/" }; diff --git a/deploy/enterprise/fs/opt/steedos/templates/nginx-app.conf.sh b/deploy/enterprise/fs/opt/steedos/templates/nginx-app.conf.sh index 187e994a42..75b88b1a32 100755 --- a/deploy/enterprise/fs/opt/steedos/templates/nginx-app.conf.sh +++ b/deploy/enterprise/fs/opt/steedos/templates/nginx-app.conf.sh @@ -146,6 +146,20 @@ fi proxy_pass http://localhost:3100/unpkg/; } + + location /nodered/ { + proxy_http_version 1.1; + proxy_buffering off; + proxy_max_temp_file_size 0; + proxy_redirect off; + proxy_set_header Host \$http_host/nodered/; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto \$origin_scheme; + proxy_set_header X-Forwarded-Host \$origin_host; + proxy_set_header Connection ""; + proxy_pass http://localhost:1880/nodered/; + } + location /nginx/ { root ${NGINX_WWW_PATH}; try_files \$uri \$uri/ /index.html =404; diff --git a/deploy/enterprise/fs/opt/steedos/templates/supervisord/nodered.conf b/deploy/enterprise/fs/opt/steedos/templates/supervisord/nodered.conf new file mode 100644 index 0000000000..d0b78273b8 --- /dev/null +++ b/deploy/enterprise/fs/opt/steedos/templates/supervisord/nodered.conf @@ -0,0 +1,16 @@ +[program:nodered] +directory=/opt/steedos/nodered/ +command=/opt/steedos/run-with-env.sh ./node_modules/.bin/node-red --settings settings.js +priority=15 +autostart=true +autorestart=true +startsecs=0 +startretries=3 +stdout_logfile=/steedos-storage/logs/%(program_name)s/%(program_name)s-%(ENV_HOSTNAME)s.log +redirect_stderr=true +stdout_logfile_maxbytes=10MB +stderr_logfile_maxbytes=10MB +stdout_logfile_backups=2 +stderr_logfile_backups=2 +stdout_events_enabled=true +stderr_events_enabled=true \ No newline at end of file