Open jrgriffiniii opened 2 weeks ago
https://github.com/pulibrary/tiger-data-app/tree/jrgriffiniii-fix-mflux and https://github.com/pulibrary/princeton_ansible/tree/jrgriffiniii-nginx-websockets-tigerdata effectively addressed this for the staging
environment.
The following is being logged following a redeployment to staging
:
I, [2024-07-22T14:05:02.571000 #3047744] INFO -- : [95eef1d8-b6a7-4333-8ca3-663721f5f41d] [dd.env=staging dd.service=tigerdata dd.version=1.0.0 dd.trace_id=1125728829946400298 dd.span_id=869445013784936239 ddsource=ruby] Started GET "/cable"[non-WebSocket] for 172.20.80.14 at 2024-07-22 14:05:02 +0000
E, [2024-07-22T14:05:02.571291 #3047744] ERROR -- : [95eef1d8-b6a7-4333-8ca3-663721f5f41d] [dd.env=staging dd.service=tigerdata dd.version=1.0.0 dd.trace_id=1125728829946400298 dd.span_id=869445013784936239 ddsource=ruby] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: , HTTP_UPGRADE: )
I, [2024-07-22T14:05:02.571529 #3047744] INFO -- : [95eef1d8-b6a7-4333-8ca3-663721f5f41d] [dd.env=staging dd.service=tigerdata dd.version=1.0.0 dd.trace_id=1125728829946400298 dd.span_id=869445013784936239 ddsource=ruby] Finished "/cable"[non-WebSocket] for 172.20.80.14 at 2024-07-22 14:05:02 +0000
Using cURL, the following does properly resolve for the passenger-managed deployment of the Rails app:
curl -v -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: localhost" -H "X-Passenger-Connect-Password: [...]" http://0.0.0.0:44873/cable/
I can now verify that only the NGINX configuration on the load balancer must be adjusted:
$ curl -v -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: tigerdata-staging.lib.princeton.edu" -H "Origin: https://tigerdata-staging.lib.princeton.edu" http://0.0.0.0/cable/
> GET /cable/ HTTP/1.1
> Host: tigerdata-staging.lib.princeton.edu
> User-Agent: curl/7.81.0
> Accept: */*
> Connection: Upgrade
> Upgrade: websocket
> Origin: https://tigerdata-staging.lib.princeton.edu
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 101 Switching Protocols
HTTP/1.1 101 Switching Protocols
< Connection: upgrade
Connection: upgrade
< Status: 101 Switching Protocols
Status: 101 Switching Protocols
< Upgrade: WebSocket
Upgrade: WebSocket
< WebSocket-Origin: https://tigerdata-staging.lib.princeton.edu
WebSocket-Origin: https://tigerdata-staging.lib.princeton.edu
< WebSocket-Location: wss://tigerdata-staging.lib.princeton.edu/cable/
WebSocket-Location: wss://tigerdata-staging.lib.princeton.edu/cable/
< Date: Tue, 23 Jul 2024 14:45:13 GMT
Date: Tue, 23 Jul 2024 14:45:13 GMT
< X-Powered-By: Phusion Passenger(R) 6.0.22
X-Powered-By: Phusion Passenger(R) 6.0.22
< Server: nginx/1.18.0 + Phusion Passenger(R) 6.0.22
Server: nginx/1.18.0 + Phusion Passenger(R) 6.0.22
The following is behaving as expected:
wscat --origin=https://tigerdata-staging.lib.princeton.edu -L -c ws://tigerdata-staging2.lib.princeton.edu/cable/
Connected (press CTRL+C to quit)
< {"type":"welcome"}
< {"type":"ping","message":1721756269}
[...]
wscat --origin=https://tigerdata-staging.lib.princeton.edu -L -c ws://tigerdata-staging1.lib.princeton.edu/cable/
Connected (press CTRL+C to quit)
< {"type":"welcome"}
> %
Currently, the WebSockets/ActionCable feature providing the Mediaflux API connectivity status does not work for non-local deployments of the application (i. e. staging, qa, and production). This is going to remain blocked until modifications are provided for the NGINX+ proxy permitting WebSockets traffic for the host server nodes within each deployment environment.
Acceptance Criteria:
staging
environment and ensure that the status indicator is behaving as expectedqa
environment and ensure that the status indicator is behaving as expectedproduction
environment and ensure that the status indicator is behaving as expected