Why I can't connect two containers between each other in railway.app?

251 Views Asked by At

I have a microservices architecture with 6 containers. One of them is the back (a server in python with asyncio) that is running in the address 0.0.0.0:1234 -> the host is '0.0.0.0' to be public. And I have another microservice in Node JS, it is a socket connector, it has to connect with the back in python that is running in 0.0.0.0:1234, but I can't connect.

Error: errno: -111, code: 'ECONNREFUSED',

Why I can't connect the two containers between each other if it supposed to have a network in common?

I connect the others microservices between each other with the public domain that provides railway, but in this case I need the host and the port to connect it through sockets.

const connectToPythonServer = () => {
    client.connect({
        port: 1234,
        host: '0.0.0.0'
    }, () => {
    // client.connect(1234, '0.0.0.0', () => {
        console.log('Connected al back de python, es decir al sv asincronico');
        client.write('Hello, server! Love, Client.');
    });
}

This is how connect my Node JS connector to the back. It is working locally, but when I took this to railway, it doesn't work. It doesn't connect. **

This is where the back in python is running

This is the error in the log container that is trying to connect with the back in python through sockets

This are the 6 containers

This is the architecture diagram

0

There are 0 best solutions below