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