00checkStartup.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const fs = require('fs');
  2. const os = require('os');
  3. // Configure SyncedCron to suppress console logging
  4. // This must be done before any SyncedCron operations
  5. if (Meteor.isServer) {
  6. const { SyncedCron } = require('meteor/percolate:synced-cron');
  7. SyncedCron.config({
  8. log: false, // Disable console logging
  9. collectionName: 'cronJobs', // Use custom collection name
  10. utc: false, // Use local time
  11. collectionTTL: 172800 // 2 days TTL
  12. });
  13. }
  14. let errors = [];
  15. if (!process.env.WRITABLE_PATH) {
  16. errors.push("WRITABLE_PATH environment variable missing and/or unset, please configure !");
  17. } else {
  18. try {
  19. fs.accessSync(process.env.WRITABLE_PATH, fs.constants.W_OK);
  20. } catch (err) {
  21. const userInfo = os.userInfo();
  22. errors.push("can't write to " + process.env.WRITABLE_PATH, err);
  23. errors.push("the path of WRITABLE_PATH (" + process.env.WRITABLE_PATH + ") must be writable !!!");
  24. errors.push("username: " + userInfo["username"] + " - uid: " + userInfo["uid"] + " - gid: " + userInfo["gid"]);
  25. }
  26. }
  27. if (errors.length > 0) {
  28. console.error("\n\n");
  29. console.error(errors.join("\n"));
  30. console.error("\n");
  31. console.error("Stopping Wekan");
  32. console.error("Wekan isn't runnable. Please resolve the error's above and restart Wekan !");
  33. console.error("\n\n");
  34. process.exit(1);
  35. }
  36. // Import cron job storage for persistent job tracking
  37. import './cronJobStorage';
  38. // Import board migration detector for automatic board migrations
  39. import './boardMigrationDetector';
  40. // Import cron migration manager for cron-based migrations
  41. import './cronMigrationManager';