zodern / meteor-up

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

Docs improvement suggestion: PORT not respected, when docker args has --network=host set #1301

Open arggh opened 2 years ago

arggh commented 2 years ago

When --network=host is set as an argument for Docker, the given env.PORT is not respected - instead, Meteor always listens on port 3000.

The reason for using --network=host can be, for example, making hosts declared in the host machine's /etc/hosts file available for the Docker instance (such as MongoDB servers in local subnet etc.).

However, If --network=host is set, the setting docker.imagePort now serves the same purpose that env.PORT used to.

Neither of these "findings" were immediately clear to me from reading the docs, so it might be a worthwhile addition (together with the --network=host setting).

Mup version: 1.5.5

Mup config ```js { "servers": { "web1": { "host": "1.2.3.4", "username": "root" }, "web2": { "host": "1.2.3.4", "username": "root" }, "web3": { "host": "1.2.3.4", "username": "root" } }, "app": { "name": "my-app", "path": "../", "servers": { "web1": {}, "web2": {}, "web3": {} }, "buildOptions": { "buildLocation": "/var/folders/rg/p7c34b1x5zzd_5ng_1trjb580000gn/T/mup-meteor-42f1cdcc-acd8-413a-a658-44bc6026b1d3", "cleanBuildLocation": true }, "env": { "PORT": 3100, "HTTP_FORWARDED_COUNT": 1, "ROOT_URL": "https://subdomain.host.com", "MONGO_URL": "mongodb://user:pass@subdomain.subdomain.host.com:27017/:27017,10.0.1.3:27017,10.0.1.4/dev?authSource=admin&replicaSet=rs1", "MONGO_OPLOG_URL": "mongodb://user:pass@10.0.1.2:27017,10.0.1.3:27017,10.0.1.4:27017/local?authSource=admin&replicaSet=rs1", "NODE_ENV": "production" }, "docker": { "image": "zodern/meteor", "args": [ "--network=host" ], "stopAppDuringPrepareBundle": true, "imagePort": 3000 }, "deployCheckWaitTime": 60, "type": "meteor" } } ✓ Config is valid ```
Output of command ```bash [xx.xx.xx.xx]=> Setting node version [xx.xx.xx.xx]NODE_VERSION=14.18.3 [xx.xx.xx.xx]v14.18.3 is already installed. [xx.xx.xx.xx]Now using node v14.18.3 (npm v6.14.15) [xx.xx.xx.xx]default -> 14.18.3 (-> v14.18.3 *) [xx.xx.xx.xx]=> Starting meteor app on port 3000 [xx.xx.xx.xx]Not serving logger, path /logger. [xx.xx.xx.xx]events.js:377 [xx.xx.xx.xx] throw er; // Unhandled 'error' event [xx.xx.xx.xx] ^ [xx.xx.xx.xx] [xx.xx.xx.xx]Error: listen EADDRINUSE: address already in use 0.0.0.0:3000 [xx.xx.xx.xx] at Server.setupListenHandle [as _listen2] (net.js:1331:16) [xx.xx.xx.xx] at listenInCluster (net.js:1379:12) [xx.xx.xx.xx] at doListen (net.js:1516:7) [xx.xx.xx.xx] at processTicksAndRejections (internal/process/task_queues.js:83:21) [xx.xx.xx.xx]Emitted 'error' event on Server instance at: [xx.xx.xx.xx] at emitErrorNT (net.js:1358:8) [xx.xx.xx.xx] at processTicksAndRejections (internal/process/task_queues.js:82:21) { [xx.xx.xx.xx] code: 'EADDRINUSE', [xx.xx.xx.xx] errno: -98, [xx.xx.xx.xx] syscall: 'listen', [xx.xx.xx.xx] address: '0.0.0.0', [xx.xx.xx.xx] port: 3000 [xx.xx.xx.xx]} ```