overleaf
overleaf copied to clipboard
Mongo instance doesn't support transactions
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.
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 (
This worked for me like a charm~
https://github.com/overleaf/overleaf/issues/1120#issuecomment-1623295314
Great advise, thanks a lot! Now I got it working too.
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.
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~
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.
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!
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.ymlPart 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.
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.
It also works for me.
Hello,
The Overleaf Toolkit is our recommended method for deploying Overleaf Community Edition and Server Pro now. It will automatically create the MongoDB replica set for you. We've also prepared a migration guide in the Toolkit docs.
Greetings, Jakob