Deploy the puzzle relay alongside the container stack
Adds a puzzle-relay service (docker-compose.yml) running the same image as php but executing app:puzzle-relay instead of php-fpm, kept off the host network - only nginx can reach it. nginx proxies wss://dmtools.fvandenberg.nl/puzzle-ws/ through to it (docker/nginx/default.conf), with the public URL set via a new .env.prod. setup.sh/restart.sh now rebuild, restart, and clean up the new container alongside the existing ones. Still needs "Websockets Support" enabled on the NPM proxy host for this domain, or the upgrade headers never reach the container. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,24 @@ server {
|
||||
return 404;
|
||||
}
|
||||
|
||||
# Proxies the puzzle relay's WebSocket connections (src/Command/
|
||||
# PuzzleRelayCommand.php, a separate long-running container - see
|
||||
# docker-compose.yml) through this same domain, so the browser can use a
|
||||
# plain wss://dmtools.fvandenberg.nl/puzzle-ws/ URL instead of a second
|
||||
# exposed port. NPM must also have "Websockets Support" enabled for this
|
||||
# proxy host, or the Upgrade header never reaches here.
|
||||
location /puzzle-ws/ {
|
||||
resolver 127.0.0.11 valid=10s;
|
||||
set $puzzle_relay dmtools-puzzle-relay:8091;
|
||||
proxy_pass http://$puzzle_relay/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 1h;
|
||||
proxy_send_timeout 1h;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/dmtools_error.log;
|
||||
access_log /var/log/nginx/dmtools_access.log;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user