Resolved, nginx configuration's falut, while in docker compose, do not add proxy_redirect off;
E
evan2077
@evan2077
Posts
-
NodeBB CANNOT connect to database with docker compose setup -
NodeBB CANNOT connect to database with docker compose setupI were trying to install NodeBB using docker compose, these errors occured while I finnished fiiling the forms in the initial install webpage:
nodebb-1 | 2024-07-25T07:16:03.000Z [45] - warn: NodeBB Setup Aborted. nodebb-1 | MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 nodebb-1 | at Topology.selectServer (/usr/src/app/node_modules/mongodb/lib/sdam/topology.js:303:38) nodebb-1 | at async Topology._connect (/usr/src/app/node_modules/mongodb/lib/sdam/topology.js:196:28) nodebb-1 | at async Topology.connect (/usr/src/app/node_modules/mongodb/lib/sdam/topology.js:158:13) nodebb-1 | at async topologyConnect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:204:17) nodebb-1 | at async MongoClient._connect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:217:13) nodebb-1 | at async MongoClient.connect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:142:13) nodebb-1 | at async MongoClient.connect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:295:16) nodebb-1 | at async connection.connect (/usr/src/app/src/database/mongo/connection.js:61:9) nodebb-1 | at async mongoModule.init (/usr/src/app/src/database/mongo.js:63:11) nodebb-1 | at async completeConfigSetup (/usr/src/app/src/install.js:204:2) nodebb-1 | nodebb-1 | Starting NodeBB nodebb-1 | "./nodebb stop" to stop the NodeBB server nodebb-1 | "./nodebb log" to view server output nodebb-1 | "./nodebb restart" to restart NodeBB nodebb-1 exited with code 0
Here is my compose file
version: '3.8' services: nodebb: # build: . image: ghcr.io/nodebb/nodebb:latest restart: unless-stopped user: root volumes: - nodebb-build:/usr/src/app/build - nodebb-uploads:/usr/src/app/public/uploads - nodebb-config:/opt/config - ./install/docker/setup.json:/usr/src/app/setup.json mongo: image: 'mongo:7-jammy' restart: unless-stopped ports: - '27017:27017' environment: MONGO_INITDB_ROOT_USERNAME: nodebb MONGO_INITDB_ROOT_PASSWORD: nodebb MONGO_INITDB_DATABASE: nodebb volumes: - mongo-data:/data/db - ./install/docker/mongodb-user-init.js:/docker-entrypoint-initdb.d/user-init.js nginx: image: nginx:stable-alpine volumes: - /etc/nginx/sites-available/default:/etc/nginx/conf.d/default.conf - ./nginx.conf:/etc/nginx/nginx.conf ports: - "80:80"
config.json file was not added in this case, which means it used the basic config that all dbs name is set according to their name in the compose file, it should be fine, cause there are in the same docker network.
How can I resolve this?
Thanks