diff --git a/roles/nginx/README.md b/roles/nginx/README.md index 61177ba63..785d8eba0 100644 --- a/roles/nginx/README.md +++ b/roles/nginx/README.md @@ -1,27 +1,31 @@ ### Transition to NGINX -1. Initial testing strategy (December 2019 - February 2020) is to move NGINX to [port 80](https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services), and proxy everything to Apache on [port 8090](https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services) — creating "Shims" for each IIAB App/Service in *Section iii.* below. +1. Initial testing strategy (December 2019 - February 2020) was to move NGINX to [port 80](https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services), and proxy everything to Apache on [port 8090](https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services) — creating "Shims" for each IIAB App/Service in *Section iii.* below. - Until "Native" NGINX is later implemented for that IIAB App/Service — allowing it to move up to *Section ii.* below. + Until "Native" NGINX is later implemented for each such IIAB App/Service — allowing each to move up to *Section ii.* below. + + And potentially later moving each up to *Section i.* if its Apache support is dropped! - And potentially later moving it up to *Section i.* if its Apache support is dropped! - (Background: IIAB Apps/Services are generally [Ansible roles](https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible) that live in [/opt/iiab/iiab/roles](https://github.com/iiab/iiab/tree/master/roles)) 2. Without PHP available via FastCGI, any function at all for PHP-based applications validates NGINX. -3. Current state of IIAB App/Service migrations as of 2021-05-21: *(SEE ALSO [#2762](https://github.com/iiab/iiab/issues/2762))* +3. Current state of IIAB App/Service migrations as of 2021-07-06: *(SEE ALSO [#2762](https://github.com/iiab/iiab/issues/2762))* 1. These support "Native" NGINX but ***NOT*** Apache + * Admin Console * captiveportal * IIAB documentation (http://box/info) * jupyterhub + * moodle + * nodered * osm-vector-maps * OER2Go/RACHEL modules * usb_lib 2. These support "Native" NGINX ***AND*** Apache, a.k.a. "dual support" for legacy testing (if suitable "Shims" from *Section iii.* below are preserved!) Both "Native" NGINX and "Shim" proxying from NGINX to Apache port 8090 *cannot be enabled simultaneously* for these IIAB Apps/Service: + * awstats * calibre-web * gitea @@ -35,11 +39,11 @@ * wordpress 3. These support Apache but ***NOT*** "Native" NGINX. They use a "Shim" to [proxy_pass](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) from NGINX to Apache on port 8090. See [roles/3-base-server/tasks/main.yml#L11](../3-base-server/tasks/main.yml#L11) for a list of ~6 IIAB Apps/Services that auto-enable Apache. + * elgg - * moodle [*, PLEASE HELP IF YOU CAN: [#2785](https://github.com/iiab/iiab/issues/2785)] - * nodered 4. These each run their own web server or non-web / backend services, e.g. off of their own [unique port(s)](https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services) (IIAB home pages link directly to these destinations). In future we'd like mnemonic URL's for all of these: (e.g. http://box/calibre, http://box/archive, http://box/kalite) + * bluetooth * calibre (menu goes directly to port 8080) * cups (menu goes directly to port 631) [*, shim not yet in place, [PR #2775](https://github.com/iiab/iiab/pull/2775)] @@ -55,4 +59,4 @@ * transmission * vnstat -[*] The 5 above starred roles could use improvement, as of 2021-05-21. +[*] The 4 above starred roles could use improvement, as of 2021-07-06. diff --git a/roles/nodered/tasks/install.yml b/roles/nodered/tasks/install.yml index 2b40ff5d6..8d75cb6e9 100644 --- a/roles/nodered/tasks/install.yml +++ b/roles/nodered/tasks/install.yml @@ -1,15 +1,5 @@ -- name: "Set 'apache_install: True' and 'apache_enabled: True'" - set_fact: - apache_install: True - apache_enabled: True - -- name: APACHE - run 'httpd' role - include_role: - name: httpd - - -# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) & -# npm to roles/nodejs/tasks/main.yml +# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js [8.x at the time] +# and npm to roles/nodejs/tasks/main.yml - name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'" set_fact: @@ -48,7 +38,7 @@ state: absent when: nodered_install -# 2012-02-13: the 6 RPi stanzas below recreate Raspbian Desktop's Node-RED +# 2019-02-13: the 6 RPi stanzas below recreate Raspbian Desktop's Node-RED # environment, inspired by: # https://nodered.org/docs/hardware/raspberrypi # https://github.com/node-red/raspbian-deb-package/blob/master/resources/update-nodejs-and-nodered @@ -112,18 +102,11 @@ dest: /etc/systemd/system/nodered.service # mode: '0666' -- name: Install /etc/{{ apache_conf_dir }}/nodered.conf from template - template: - backup: yes - src: nodered.conf.j2 - dest: "/etc/{{ apache_conf_dir }}/nodered.conf" - # mode: '0666' - # SEE ALSO THE apache2_module SECTION IN roles/httpd/tasks/main.yml -- name: Enable proxy_wstunnel apache2 module - apache2_module: - state: present - name: proxy_wstunnel +#- name: Enable proxy_wstunnel apache2 module +# apache2_module: +# state: present +# name: proxy_wstunnel # RECORD Node-RED AS INSTALLED diff --git a/roles/nodered/tasks/main.yml b/roles/nodered/tasks/main.yml index 1edf2f34b..2add807b2 100644 --- a/roles/nodered/tasks/main.yml +++ b/roles/nodered/tasks/main.yml @@ -39,14 +39,8 @@ state: stopped when: not nodered_enabled -#- name: Enable/Disable/Restart Apache if primary -- name: SHIM FOR NOW SO ALWAYS DO THE...Enable/Disable/Restart Apache - include_tasks: apache.yml - #when: not nginx_enabled - -- name: Enable/Disable/Restart NGINX if primary +- name: Enable/Disable/Restart NGINX include_tasks: nginx.yml - when: nginx_enabled - name: Add 'nodered' variable values to {{ iiab_ini_file }} diff --git a/roles/nodered/templates/nodered-nginx.conf.j2 b/roles/nodered/templates/nodered-nginx.conf.j2 index 7d4728b16..c9271959b 100644 --- a/roles/nodered/templates/nodered-nginx.conf.j2 +++ b/roles/nodered/templates/nodered-nginx.conf.j2 @@ -1,3 +1,26 @@ +# 'nodered_port: 1880' is set in /opt/iiab/iiab/vars/default_vars.yml +# https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services + location /nodered/ { - proxy_pass http://127.0.0.1:{{ apache_port }}/nodered/; + proxy_pass http://127.0.0.1:{{ nodered_port }}/nodered/; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; } + +#location /nodered/debug/ws/ { +# proxy_pass http://127.0.0.1:{{ nodered_port }}/nodered/debug/ws; +# +# proxy_http_version 1.1; +# proxy_set_header Upgrade $http_upgrade; +# proxy_set_header Connection "upgrade"; +#} + +#location /nodered/comms/ { +# proxy_pass http://127.0.0.1:{{ nodered_port }}/nodered/comms; +# +# proxy_http_version 1.1; +# proxy_set_header Upgrade $http_upgrade; +# proxy_set_header Connection "upgrade"; +#} diff --git a/roles/nodered/templates/nodered.conf.j2 b/roles/nodered/templates/nodered.conf.j2.unused similarity index 100% rename from roles/nodered/templates/nodered.conf.j2 rename to roles/nodered/templates/nodered.conf.j2.unused