mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
A new install with nothing changed but the port and ROOT_URL could not reach the
database at all:
MongoServerSelectionError: connect ECONNREFUSED 0.0.0.0:27017
reason: TopologyDescription { type: 'ReplicaSetNoPrimary',
servers: Map(1) { '0.0.0.0:27017' => [ServerDescription] },
setName: 'rs0', ... }
0.0.0.0 is in no compose file. It is FerretDB's own listen address, and the
driver was handed it by the server.
The ferretdb service runs with --repl-set-name=rs0, added in #6480/#6481 so
Meteor can tail an OpLog instead of poll-and-diff. FerretDB therefore answers the
hello handshake as a one-member replica set, and fills hosts, me and primary with
its --listen-addr, which is the wildcard 0.0.0.0:27017. A driver that is not in
direct-connection mode reads that reply as an invitation to do replica-set
DISCOVERY: it adopts the advertised member list and drops the seed it was given,
because the server reports a name other than the one that was dialled. So
mongodb://ferretdb:27017 became 0.0.0.0:27017, which inside the wekan container is
the wekan container itself, where nothing listens.
Measured against FerretDB v1.49.0 - the version reported - with the mongodb
driver the bundle ships:
mongodb://localhost:27017/wekan
-> ReplicaSetWithPrimary, servers: 0.0.0.0:27017 (the seed discarded)
mongodb://localhost:27017/wekan?directConnection=true
-> Single, servers: localhost:27017
directConnection=true keeps the driver on exactly the host it was given. It costs
nothing else: the handshake still reports setName rs0, which is the only thing
Meteor checks before it will tail an OpLog (accounts for the check in the mongo
package's oplog_replica_set_error.js), so #6480/#6481 are unaffected and the
commented MONGO_OPLOG_URL examples keep replicaSet=rs0 beside it.
All five FerretDB v1 compose files are fixed, being the ones that start FerretDB
with --repl-set-name. The MongoDB compose files are deliberately left alone: those
are real replica sets whose members are reachable under the names they advertise,
and directConnection would pin Meteor to a single node of one.
tests/ferretdbDirectConnection.test.cjs pins both halves - that a compose file
running FerretDB as a replica set carries directConnection=true on every URL
pointing at it, and that the MongoDB ones do not.
Thanks to Dandrass and xet7 !
Fixes #6582,
28 lines
1.4 KiB
Markdown
28 lines
1.4 KiB
Markdown
# FerretDB
|
|
|
|
FerretDB speaks the MongoDB wire protocol and stores the data in something else,
|
|
so WeKan runs unchanged on top of it — WeKan only ever connects to
|
|
`mongodb://ferretdb:27017/wekan?directConnection=true` and knows nothing about
|
|
what is behind it. The `directConnection=true` is required, not decoration:
|
|
without it the driver follows FerretDB's replica-set handshake to the wildcard
|
|
address FerretDB listens on and the stack cannot start
|
|
([#6582](https://github.com/wekan/wekan/issues/6582), explained in
|
|
[1/README.md](1/README.md#why-the-url-says-directconnectiontrue)).
|
|
|
|
There are two versions, and they are different products:
|
|
|
|
| Directory | Version | Stores into |
|
|
| --- | --- | --- |
|
|
| [1](1) | FerretDB v1, the [wekan/FerretDB](https://github.com/wekan/FerretDB) fork — **WeKan's default database** | SQLite (embedded), PostgreSQL, MySQL, MariaDB, SAP HANA |
|
|
| [2](2) | FerretDB 2, upstream | PostgreSQL with the DocumentDB extension, only |
|
|
|
|
Upstream dropped every backend except PostgreSQL in v2. The fork keeps v1 alive
|
|
because the embedded SQLite backend is what makes a WeKan install self-contained —
|
|
no database server at all — and because it is the database WeKan ships for the
|
|
platforms MongoDB has no server build for: ppc64le, s390x and riscv64.
|
|
|
|
## See also
|
|
|
|
- [../MongoDB](../MongoDB) — the classic database, if you prefer MongoDB itself
|
|
- [wekan/FerretDB](https://github.com/wekan/FerretDB) — the fork, its releases and its CHANGELOG
|