Giter Club home page Giter Club logo

Comments (7)

axeloz avatar axeloz commented on June 2, 2024 2

OK I found the problem:

my instance of deployer runs in HTTPS with Let's Encrypt on top of Nginx. Because of this, my socket URL into the .env file is https:// too.
But in socket.js, I found these lines:

if (/^https/i.test(process.env.SOCKET_URL)) {
  const sslConfig = { ... }
}

So socket.io tries to create an SSL connection when Nginx is already handling this as a proxy.
The connection between Nginx and Socket.io is not supposed to use SSL, at least in my case because they use localhost, on the same server and because the 6001 port is closed in my firewall from the outside.

To fix it permanently, I guess there should be a new variable into the .env file:
SOCKET_SSL=true|false
and replace the previous source lines by:

if (process.env.SOCKET_SSL == true) {
  const sslConfig = { ... }
}

That would allow users to choose whether Nginx or Socket.io should handle the SSL connection or not.
That is what I did on my side and it works just fine.

Thanks

from deployer.

REBELinBLUE avatar REBELinBLUE commented on June 2, 2024

I think you need to change your nginx config to use the IP, just 127.0.0.1 for the node server, not the hostname

from deployer.

REBELinBLUE avatar REBELinBLUE commented on June 2, 2024

oops, sorry just realised server is just the server name, the upstream is the IP.

Hmm

from deployer.

REBELinBLUE avatar REBELinBLUE commented on June 2, 2024

Can you try starting the node server with DEBUG=* https://socket.io/docs/logging-and-debugging/ and see if there is any additional output in the supervisor log

from deployer.

axeloz avatar axeloz commented on June 2, 2024

Thanks, I did not know that DEBUG=* thing

root@dev:/tank/www/deployer# DEBUG=* node socket.js
  ioredis:redis status[127.0.0.1:6379]: [empty] -> connecting +0ms
  socket.io:server initializing namespace / +0ms
  socket.io-parser encoding packet {"type":0,"nsp":"/"} +0ms
  socket.io-parser encoded {"type":0,"nsp":"/"} as 0 +0ms
  socket.io:server creating engine.io instance with opts {"path":"/socket.io","initialPacket":["0"]} +1ms
  socket.io:server attaching client serving req handler +9ms
  socket.io:namespace removing initial packet +0ms
  ioredis:redis queue command[0] -> psubscribe(*) +32ms
  ioredis:redis status[127.0.0.1:6379]: connecting -> connect +4ms
  ioredis:redis write command[0] -> info() +1ms
  ioredis:redis status[127.0.0.1:6379]: connect -> ready +4ms
  ioredis:connection send 1 commands in offline queue +0ms
  ioredis:redis write command[0] -> psubscribe(*) +0ms

This line seems to be a problem:
ioredis:connection send 1 commands in offline queue +0ms (it's red in the output).
Redis is running
Thanks

from deployer.

axeloz avatar axeloz commented on June 2, 2024

I forgot to mention that deployments ARE working though. I just need to reload the page to check the status.

from deployer.

REBELinBLUE avatar REBELinBLUE commented on June 2, 2024

Hmm, this is really odd. Is there anything in the Redis log?

Yeah, deployments will continue to work, the websocket is only used for broadcasting updates to the client instead of doing AJAX polling.

from deployer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.