zodern / meteor-up

Production Quality Meteor Deployment to Anywhere
http://meteor-up.com/
MIT License
1.28k stars 279 forks source link

Failed to connect to 172.17.0.4 port 3000: Connection refused #1299

Open ayalpani opened 2 years ago

ayalpani commented 2 years ago

On an Ubuntu 20.04 system, the docker container is having problems connecting to the mongodb instance i have installed on the host.

Running mup deploy --verbose this is what I get during the verification phase:

Failed to connect to 172.17.0.4 port 3000: Connection refused

That is my config:

    env: {
      ROOT_URL: "https://xxx",
      MONGO_URL: "mongodb://host.docker.internal:27017/mydb",
      MONGO_OPLOG_URL: "mongodb://mongodb/local",
    },

    docker: {
      image: "zodern/meteor:root",
      args: ["--add-host host.docker.internal:host-gateway"],
      prepareBundle: true,
    },

On the host, I have configured mongodb as such:

net:
  port: 27017
  bindIpAll: true

Still, I can not get a working connection. I have spent hours and hours and basically tried all solutions I have found in all the threads here. Please help!

mikkelking commented 2 years ago

That error message is a failure to connect to the meteor server, although that may be a secondary failure, if meteor can't connect to the db, it won't run. Does host.docker.internal resolve to the correct IP address? I would lean towards using an ip address for that - you could at least try it to eliminate that as a possible cause

emenoh commented 2 years ago

Not sure if this is it but I was getting this in my proxy logs: "upstream sent too big header while reading response header from upstream"

So I looked into that and found that upping the proxy buffer size should work (and it did).

proxy_buffer_size          128k;
proxy_buffers              4 256k;
proxy_busy_buffers_size    256k;

I added this to a file (just those three lines) and then used the mup config param 'nginxLocationConfig' like below to include it for my location configuration.

proxy: {
    domains: ...,
    nginxLocationConfig: './nginx-custom.conf',
    ssl: {
      // Enable Let's Encrypt
      letsEncryptEmail: ...
    }
  }

No more proxy errors and no more refused to connect errors.

emenoh commented 2 years ago

I found the proxy errors by using mup proxy logs