Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongo instance doesn't support transactions #1169

Open
holyfive opened this issue Dec 5, 2023 · 8 comments
Open

Mongo instance doesn't support transactions #1169

holyfive opened this issue Dec 5, 2023 · 8 comments

Comments

@holyfive
Copy link

holyfive commented Dec 5, 2023

Using this compose file on a fresh docker installation results in an ongoing restarting Sharelatex container, saying:

Mongo instance doesn't support transactions
sharelatex | MongoServerError: Transaction numbers are only allowed on a replica set member or mongos
sharelatex | at Connection.onMessage (/overleaf/services/web/node_modules/mongodb/lib/cmap/connection.js:231:30)
sharelatex | at MessageStream. (/overleaf/services/web/node_modules/mongodb/lib/cmap/connection.js:61:60)
sharelatex | at MessageStream.emit (node:events:517:28)
sharelatex | at processIncomingData (/overleaf/services/web/node_modules/mongodb/lib/cmap/message_stream.js:125:16)
sharelatex | at MessageStream._write (/overleaf/services/web/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
sharelatex | at writeOrBuffer (node:internal/streams/writable:392:12)
sharelatex | at _write (node:internal/streams/writable:333:10)
sharelatex | at Writable.write (node:internal/streams/writable:337:10)
sharelatex | at Socket.ondata (node:internal/streams/readable:777:22)
sharelatex | at Socket.emit (node:events:517:28) {
sharelatex | ok: 0,
sharelatex | code: 20,
sharelatex | codeName: 'IllegalOperation',
sharelatex | [Symbol(errorLabels)]: Set(0) {}

@jtrevinodev
Copy link

jtrevinodev commented Dec 6, 2023

I have the same error. I added command: --replSet rs0 on the mongo compose config and bypassed this error.

mongo:
        restart: always
        image: mongo:4.4
        command: --replSet rs0

But now I have this new error:
:(

2023-12-06 01:02:05 Cannot connect to mongodb
2023-12-06 01:02:05 MongooseServerSelectionError: Server selection timed out after 60000 ms
2023-12-06 01:02:05 at Connection.openUri (/overleaf/services/web/node_modules/mongoose/lib/connection.js:825:32)
2023-12-06 01:02:05 at /overleaf/services/web/node_modules/mongoose/lib/index.js:414:10
2023-12-06 01:02:05 at /overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
2023-12-06 01:02:05 at new Promise ()
2023-12-06 01:01:01 Nginx: generating config file from template
2023-12-06 01:01:01 Nginx: reloading config
2023-12-06 01:01:01 * Reloading nginx configuration nginx
2023-12-06 01:01:01 ...done.
2023-12-06 01:01:01 Dec 6 07:01:01 267cf627e4a7 syslog-ng[167]: syslog-ng starting up; version='3.25.1'
2023-12-06 01:01:02 Checking can connect to mongo and redis
2023-12-06 01:01:04 Using default settings from /overleaf/services/web/config/settings.defaults.js
2023-12-06 01:01:04 Using settings from /etc/sharelatex/settings.js
2023-12-06 01:01:04 Set UV_THREADPOOL_SIZE=16
2023-12-06 01:02:05 at promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
2023-12-06 01:02:05 at Mongoose._promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/index.js:1288:10)
2023-12-06 01:02:05 at Mongoose.connect (/overleaf/services/web/node_modules/mongoose/lib/index.js:413:20)
2023-12-06 01:02:05 at Object. (/overleaf/services/web/app/src/infrastructure/Mongoose.js:19:36)
2023-12-06 01:02:05 at Module._compile (node:internal/modules/cjs/loader:1256:14)
2023-12-06 01:02:05 at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
2023-12-06 01:02:05 reason: TopologyDescription {
2023-12-06 01:02:05 type: 'Unknown',
2023-12-06 01:02:05 servers: Map(1) { 'mongo:27017' => [ServerDescription] },
2023-12-06 01:02:05 stale: false,
2023-12-06 01:02:05 compatible: true,
2023-12-06 01:02:05 heartbeatFrequencyMS: 10000,
2023-12-06 01:02:05 localThresholdMS: 15,
2023-12-06 01:02:05 setName: null,
2023-12-06 01:02:05 maxElectionId: null,
2023-12-06 01:02:05 maxSetVersion: null,
2023-12-06 01:02:05 commonWireVersion: 0,
2023-12-06 01:02:05 logicalSessionTimeoutMinutes: null
2023-12-06 01:02:05 },
2023-12-06 01:02:05 code: undefined
2023-12-06 01:02:05 }

@KeckigerKeks
Copy link

This worked for me like a charm~

#1120 (comment)

@holyfive
Copy link
Author

Great advise, thanks a lot! Now I got it working too.

@RafaelCenzano
Copy link

I have the same error. I added command: --replSet rs0 on the mongo compose config and bypassed this error.

mongo:
        restart: always
        image: mongo:4.4
        command: --replSet rs0

But now I have this new error: :(

2023-12-06 01:02:05 Cannot connect to mongodb 2023-12-06 01:02:05 MongooseServerSelectionError: Server selection timed out after 60000 ms 2023-12-06 01:02:05 at Connection.openUri (/overleaf/services/web/node_modules/mongoose/lib/connection.js:825:32) 2023-12-06 01:02:05 at /overleaf/services/web/node_modules/mongoose/lib/index.js:414:10 2023-12-06 01:02:05 at /overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5 2023-12-06 01:02:05 at new Promise () 2023-12-06 01:01:01 Nginx: generating config file from template 2023-12-06 01:01:01 Nginx: reloading config 2023-12-06 01:01:01 * Reloading nginx configuration nginx 2023-12-06 01:01:01 ...done. 2023-12-06 01:01:01 Dec 6 07:01:01 267cf627e4a7 syslog-ng[167]: syslog-ng starting up; version='3.25.1' 2023-12-06 01:01:02 Checking can connect to mongo and redis 2023-12-06 01:01:04 Using default settings from /overleaf/services/web/config/settings.defaults.js 2023-12-06 01:01:04 Using settings from /etc/sharelatex/settings.js 2023-12-06 01:01:04 Set UV_THREADPOOL_SIZE=16 2023-12-06 01:02:05 at promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10) 2023-12-06 01:02:05 at Mongoose._promiseOrCallback (/overleaf/services/web/node_modules/mongoose/lib/index.js:1288:10) 2023-12-06 01:02:05 at Mongoose.connect (/overleaf/services/web/node_modules/mongoose/lib/index.js:413:20) 2023-12-06 01:02:05 at Object. (/overleaf/services/web/app/src/infrastructure/Mongoose.js:19:36) 2023-12-06 01:02:05 at Module._compile (node:internal/modules/cjs/loader:1256:14) 2023-12-06 01:02:05 at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) { 2023-12-06 01:02:05 reason: TopologyDescription { 2023-12-06 01:02:05 type: 'Unknown', 2023-12-06 01:02:05 servers: Map(1) { 'mongo:27017' => [ServerDescription] }, 2023-12-06 01:02:05 stale: false, 2023-12-06 01:02:05 compatible: true, 2023-12-06 01:02:05 heartbeatFrequencyMS: 10000, 2023-12-06 01:02:05 localThresholdMS: 15, 2023-12-06 01:02:05 setName: null, 2023-12-06 01:02:05 maxElectionId: null, 2023-12-06 01:02:05 maxSetVersion: null, 2023-12-06 01:02:05 commonWireVersion: 0, 2023-12-06 01:02:05 logicalSessionTimeoutMinutes: null 2023-12-06 01:02:05 }, 2023-12-06 01:02:05 code: undefined 2023-12-06 01:02:05 }

I'm also receiving this issue and tried to follow the comment on 1120 but I still had a time out error. Is there another fix out there?

For context I'm trying to set this up on unraid so I'm not 100% familiar with the docker compose file in the comment but I believe I did the same thing on the unraid docker management to the best that I could.

@KeckigerKeks
Copy link

is it the same error that you cited?

from my perspective, he didn't add the one-time container to start up mongodb:

mongoinit:
    image: mongo:4.4
    # this container will exit after executing the command
    restart: "no"
    depends_on:
      mongo:
        condition: service_healthy
    entrypoint:
      [
        "mongo",
        "--host",
        "mongo:27017",
        "--eval",
        'rs.initiate({ _id: "overleaf", members: [ { _id: 0, host: "mongo:27017" } ] })',
      ]

please provide us at least a logfile next time~

@RafaelCenzano
Copy link

Yes, same error. You are correct I didn't realize that was a separate container. I'm not sure how to run a separate container like this on Unraid since it operates using templates and single docker containers instead of docker-compose files. Is there a way I can do it manually one time via the console, if not that is no problem and not an issue to be discussed here.

@leonamtv
Copy link

Hello everyone.

I managed to get it running in my Ubuntu Server 22.04.3.

I used a different image for my mongodb though.

Here's my docker-compose.yml: leonamtv/overleaf-leo-config/docker-compose.yml

Part that fixed the issue:

    mongo:
        image: bitnami/mongodb:5.0
        container_name: mongo
        restart: always
        ports:
            - "27017:27017"
        volumes:
            - ~/mongo_data:/data/db
        healthcheck:
            test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
            interval: 10s
            timeout: 10s
            retries: 5
        environment:
            MONGODB_REPLICA_SET_MODE: primary
            ALLOW_EMPTY_PASSWORD: 'yes'

I hope that helps!

Regards!

@enriquewph
Copy link

Hello everyone.

I managed to get it running in my Ubuntu Server 22.04.3.

I used a different image for my mongodb though.

Here's my docker-compose.yml: leonamtv/overleaf-leo-config/docker-compose.yml

Part that fixed the issue:

    mongo:
        image: bitnami/mongodb:5.0
        container_name: mongo
        restart: always
        ports:
            - "27017:27017"
        volumes:
            - ~/mongo_data:/data/db
        healthcheck:
            test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
            interval: 10s
            timeout: 10s
            retries: 5
        environment:
            MONGODB_REPLICA_SET_MODE: primary
            ALLOW_EMPTY_PASSWORD: 'yes'

I hope that helps!

Regards!

works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants