Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add websockets proxy and persistent mosquitto-config #817

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/source/user/public-services-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Please ensure that you follow these best practices to ensure your wis2box-instan

The wis2box development team is not responsible for the security of your wis2box-instance and it is your responsibility to ensure that your wis2box instance is secure.

GitHub issues and discussions provide a resourece and forum to discuss general wis2box features, bugs and updates. For specific security related questions, please write to ``wis2-support at wmo.int``.
GitHub issues and discussions provide a resource and forum to discuss general wis2box features, bugs and updates. For specific security related questions, please write to ``wis2-support at wmo.int``.

web-proxy (nginx)
^^^^^^^^^^^^^^^^^
Expand All @@ -39,6 +39,7 @@ wis2box runs a local nginx container allowing access to the following HTTP based
UI (wis2box-ui),`WIS2BOX_URL/`
Storage (incoming data) (minio:wis2box-incoming),`WIS2BOX_URL/wis2box-incoming`
Storage (public data) (minio:wis2box-public),`WIS2BOX_URL/data`
Websockets (WIS2-notifications),`WIS2BOX_URL/mqtt`

You can edit ``nginx/nginx.conf`` to control which services are exposed through the nginx-container include in your stack.

Expand Down Expand Up @@ -142,6 +143,19 @@ By exposing port 1883 on your host, the Global Broker will be able to subscribe

The ``everyone`` user is defined by default for public readonly access (``origin/#``) as per WIS2 Node requirements.

When you add SSL to your wis2box instance, the internal MQTT broker will be accessible on port 8883 on the host running wis2box using the MQTT over SSL protocol (MQTTS).

The mosquitto-service within wis2box also has websockets enabled and is proxied on '/mqtt' by the nginx container.

The broker-address for the Global Broker to subscribe to WIS2 notifications using the mosquitto-service within wis2box is:

- `mqtt://everyone:everyone@WIS2BOX_HOST:1883` - for MQTT without SSL
- `mqtts://everyone:everyone@WIS2BOX_HOST:8883` - for MQTT with SSL
- `ws://everyone:everyone@WIS2BOX_HOST/mqtt:80` - for MQTT over websockets without SSL
- `wss://everyone:everyone@WIS2BOX_HOST/mqtt:443` - for MQTT over websockets with SSL

Where ``WIS2BOX_HOST`` is the hostname or IP address of the host running wis2box.

External broker
---------------

Expand Down
7 changes: 7 additions & 0 deletions nginx/nginx-ssl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
auth_basic_user_file /etc/nginx/.htpasswd/webapp;
proxy_pass http://wis2box-webapp:4173/wis2box-webapp/;
}
location /mqtt {
proxy_pass http://mosquitto:8884;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location /auth {
internal;
proxy_pass http://wis2box-auth:80/authorize;
Expand Down
7 changes: 7 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
}
location /mqtt {
proxy_pass http://mosquitto:8884;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location / {
proxy_pass http://wis2box-ui:80;
}
Expand Down
Loading