mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
CLAUDE.md gains the 'Fix open issues' process (research newest maintained dependencies via Meteor 3 docs/issues/forums, atmosphere/packosphere/npm, add tests+negative+UI tests, commit format). docs/Security/Sandboxes/vscode/README.md documents a version-matched from-scratch toolchain in .tools/ (Node v24.18.0, npm, Meteor 3.5, newest Go for FerretDB) to build the WeKan bundle + FerretDB and run all tests, and notes Docker/podman is unavailable in the Flatpak sandbox. server/00waitForMongo.js keeps the Meteor.startup wait but documents the #6500 finding: accounts-base creates the users index before app hooks, so a top-level await here deadlocks — the reliable fix is the docker-compose healthcheck. Thanks to xet7.
30 lines
1.7 KiB
JavaScript
30 lines
1.7 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { waitForMongoReady } from '/server/lib/mongoStartup';
|
|
|
|
// ============================================================================
|
|
// MUST be the first server import (see server/imports.js) so this Meteor.startup
|
|
// hook is registered first and therefore runs before any other startup hook
|
|
// that creates indexes (server/models/users.js, collectionBootstrap.js, ...).
|
|
//
|
|
// It blocks startup until MongoDB is reachable with an elected replica-set
|
|
// primary, preventing the "An error occurred when creating an index ...
|
|
// Topology is closed" crash when WeKan starts before MongoDB is ready (common
|
|
// right after an upgrade while MongoDB replays its journal).
|
|
//
|
|
// NOTE (#6500): this cannot cover EVERY index creation. Meteor runs package
|
|
// startup hooks before app startup hooks, so `accounts-base` creates the
|
|
// Meteor.users indexes before this hook runs; if the database is not ready at
|
|
// that moment WeKan still crashes there ("...creating an index for collection
|
|
// users: Topology is closed") before binding its HTTP port — which on a fresh
|
|
// `docker compose up` shows as "Connection reset by peer". Moving this wait to a
|
|
// module-level top-level `await` does NOT work: Meteor 3's Mongo connection is not
|
|
// usable at module-load time, so it deadlocks and the server never starts. The
|
|
// reliable fix is therefore to not start WeKan until the database is accepting
|
|
// connections — see the ferretdb healthcheck + `depends_on: condition:
|
|
// service_healthy` in docker-compose.yml (and the DB-first ordering the snap /
|
|
// start-wekan.sh already use).
|
|
// ============================================================================
|
|
Meteor.startup(async () => {
|
|
await waitForMongoReady();
|
|
});
|