diff --git a/docker-compose.yml b/docker-compose.yml index c28ce0c..3d5ed6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,7 +52,22 @@ services: container_name: rnotes-yws restart: unless-stopped working_dir: /app - command: ["sh", "-c", "npm install y-websocket && node node_modules/y-websocket/bin/server.cjs"] + command: + - sh + - -c + - | + npm init -y > /dev/null 2>&1 + npm install y-websocket@1 ws > /dev/null 2>&1 + node -e " + const ws = require('ws'); + const Y = require('yjs'); + const {setupWSConnection, docs} = require('y-websocket/bin/utils'); + const host = process.env.HOST || '0.0.0.0'; + const port = parseInt(process.env.PORT || '1234'); + const wss = new ws.Server({ host, port }); + wss.on('connection', setupWSConnection); + console.log('y-websocket server running on ' + host + ':' + port); + " environment: - HOST=0.0.0.0 - PORT=1234