Skip to content

Cannot connect to mongodb (user error?) #1188

@KK4BitsPerSecond

Description

@KK4BitsPerSecond

Steps to Reproduce

I am attempting to run overleaf from a Portainer stack, as I prefer to manage all my services this way.
When I ran into issues, I attempted to used the default docker compose provided on the github, but that is still giving me the same issue.

Expected Behaviour

Sharelatex should start up and be able to connect to mongodb.

Observed Behaviour

Sharelatex fails to connect to mongo db and therefore won't start.

I keep getting this in the logs:

Using settings from /etc/sharelatex/settings.js
Set UV_THREADPOOL_SIZE=16
Cannot connect to mongodb
MongooseServerSelectionError: Server selection timed out after 60000 ms
    at Connection.openUri (/overleaf/services/web/node_modules/mongoose/lib/connection.js:825:32)
    at /overleaf/services/web/node_modules/mongoose/lib/index.js:414:10
    at /overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/index.js:1288:10)
    at Mongoose.connect (/overleaf/services/web/node_modules/mongoose/lib/index.js:413:20)
    at Object.<anonymous> (/overleaf/services/web/app/src/infrastructure/Mongoose.js:19:36)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'mongo:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}
*** /etc/my_init.d/98_check_db_access.sh failed with status 1
*** Killing all processes...

Context

I suspect user error. I have been beating my head against this for a couple days now.

I have tried my docker compose.
I have also tried an unedited version of the provided compose file (this one). Same issue.
I have tried adding a new docker network for all three services to share, to see if that would fix the communication issue.

Technical Info

Server is running Ubuntu 22.04.3 with Docker and Portainer installed.

Analysis

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions