2021-02-19 14:51:01 +03:00
|
|
|
// The Ghost Boot Sequence
|
|
|
|
// -----------------------
|
|
|
|
// - This is intentionally one big file at the moment, so that we don't have to follow boot logic all over the place
|
|
|
|
// - This file is FULL of debug statements so we can see timings for the various steps because the boot needs to be as fast as possible
|
|
|
|
// - As we manage to break the codebase down into distinct components for e.g. the frontend, their boot logic can be offloaded to them
|
|
|
|
// - app.js is separate as the first example of each component having it's own app.js file colocated with it, instead of inside of server/web
|
|
|
|
|
|
|
|
// IMPORTANT: The only global requires here should be overrides + debug so we can monitor timings with DEBUG=ghost:boot* node ghost
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
require('./server/overrides');
|
2021-06-15 19:01:22 +03:00
|
|
|
const debug = require('@tryghost/debug')('boot');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
// END OF GLOBAL REQUIRES
|
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
/**
|
|
|
|
* Helper class to create consistent log messages
|
|
|
|
*/class BootLogger {
|
2021-02-16 14:54:19 +03:00
|
|
|
constructor(logging, startTime) {
|
|
|
|
this.logging = logging;
|
|
|
|
this.startTime = startTime;
|
|
|
|
}
|
|
|
|
log(message) {
|
|
|
|
let {logging, startTime} = this;
|
|
|
|
logging.info(`Ghost ${message} in ${(Date.now() - startTime) / 1000}s`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
/**
|
|
|
|
* Helper function to handle sending server ready notifications
|
|
|
|
*/
|
|
|
|
function notifyServerReady(error) {
|
|
|
|
const notify = require('./server/notify');
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
debug('Notifying server ready (error)');
|
|
|
|
notify.notifyServerReady(error);
|
|
|
|
} else {
|
|
|
|
debug('Notifying server ready (success)');
|
|
|
|
notify.notifyServerReady();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
/**
|
|
|
|
* Get the Database into a ready state
|
|
|
|
* - DatabaseStateManager handles doing all this for us
|
|
|
|
* - Passing logging makes it output state messages
|
|
|
|
*/
|
|
|
|
async function initDatabase({config, logging}) {
|
|
|
|
const DatabaseStateManager = require('./server/data/db/state-manager');
|
|
|
|
const dbStateManager = new DatabaseStateManager({knexMigratorFilePath: config.get('paths:appRoot')});
|
|
|
|
await dbStateManager.makeReady({logging});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-02-23 14:49:59 +03:00
|
|
|
* Core is intended to be all the bits of Ghost that are fundamental and we can't do anything without them!
|
2021-02-19 14:51:01 +03:00
|
|
|
* (There's more to do to make this true)
|
|
|
|
*/
|
|
|
|
async function initCore({ghostServer}) {
|
|
|
|
debug('Begin: initCore');
|
2021-02-23 14:49:59 +03:00
|
|
|
// Models are the heart of Ghost - this is a syncronous operation
|
|
|
|
debug('Begin: models');
|
|
|
|
const models = require('./server/models');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
models.init();
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: models');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
// Settings are a core concept we use settings to store key-value pairs used in critical pathways as well as public data like the site title
|
|
|
|
debug('Begin: settings');
|
|
|
|
const settings = require('./server/services/settings');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await settings.init();
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: settings');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
// The URLService is a core part of Ghost, which depends on models. It needs moving from the frontend to make this clear.
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('Begin: Url Service');
|
2021-02-22 17:09:39 +03:00
|
|
|
const urlService = require('./frontend/services/url');
|
|
|
|
// Note: there is no await here, we do not wait for the url service to finish
|
|
|
|
// We can return, but the site will remain in (the shared, not global) maintenance mode until this finishes
|
|
|
|
// This is managed on request: https://github.com/TryGhost/Ghost/blob/main/core/server/web/shared/middlewares/maintenance.js#L13
|
|
|
|
urlService.init();
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('End: Url Service');
|
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
// Job Service allows parts of Ghost to run in the background
|
|
|
|
debug('Begin: Job Service');
|
|
|
|
const jobService = require('./server/services/jobs');
|
|
|
|
ghostServer.registerCleanupTask(async () => {
|
|
|
|
await jobService.shutdown();
|
|
|
|
});
|
|
|
|
debug('End: Job Service');
|
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
debug('End: initCore');
|
|
|
|
}
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
/**
|
|
|
|
* Frontend is intended to be just Ghost's frontend
|
2021-02-23 14:49:59 +03:00
|
|
|
* This is technically wrong currently because the theme & frontend settings services contain code used by the API to upload themes & settings
|
2021-02-19 14:51:01 +03:00
|
|
|
*/
|
|
|
|
async function initFrontend() {
|
|
|
|
debug('Begin: initFrontend');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('Begin: Frontend Settings');
|
|
|
|
const frontendSettings = require('./frontend/services/settings');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await frontendSettings.init();
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: Frontend Settings');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('Begin: Themes');
|
2021-04-27 15:28:04 +03:00
|
|
|
const themeService = require('./server/services/themes');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await themeService.init();
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: Themes');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
debug('End: initFrontend');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* At the moment we load our express apps all in one go, they require themselves and are co-located
|
|
|
|
* What we want is to be able to optionally load various components and mount them
|
|
|
|
* So eventually this function should go away
|
|
|
|
*/
|
|
|
|
async function initExpressApps() {
|
|
|
|
debug('Begin: initExpressApps');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const parentApp = require('./server/web/parent/app')();
|
|
|
|
debug('End: initExpressApps');
|
|
|
|
return parentApp;
|
2021-02-19 14:51:01 +03:00
|
|
|
}
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
/**
|
|
|
|
* Services are components that make up part of Ghost and need initialising on boot
|
|
|
|
* These services should all be part of core, frontend services should be loaded with the frontend
|
|
|
|
* We are working towards this being a service loader, with the ability to make certain services optional
|
|
|
|
*/
|
|
|
|
async function initServices({config}) {
|
|
|
|
debug('Begin: initServices');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-04-21 16:57:07 +03:00
|
|
|
const defaultApiVersion = config.get('api:versions:default');
|
|
|
|
debug(`Default API Version: ${defaultApiVersion}`);
|
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('Begin: Dynamic Routing');
|
|
|
|
// Dynamic routing is generated from the routes.yaml file, which is part of the settings service
|
|
|
|
// When Ghost's DB and core are loaded, we can access this file and call routing.bootstrap.start
|
|
|
|
// However this _must_ happen after the express Apps are loaded, hence why this is here and not in initFrontend
|
|
|
|
// Routing is currently tightly coupled between the frontend and backend
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const routing = require('./frontend/services/routing');
|
2021-04-26 16:38:57 +03:00
|
|
|
const bridge = require('./bridge');
|
2021-04-23 16:19:18 +03:00
|
|
|
// We pass the frontend API version here, so that the frontend services are slightly less tightly-coupled
|
|
|
|
routing.bootstrap.start(bridge.getFrontendApiVersion());
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const settings = require('./server/services/settings');
|
2021-02-23 14:49:59 +03:00
|
|
|
const frontendSettings = require('./frontend/services/settings');
|
|
|
|
const getRoutesHash = () => frontendSettings.getCurrentHash('routes');
|
|
|
|
await settings.syncRoutesHash(getRoutesHash);
|
|
|
|
debug('End: Dynamic Routing');
|
|
|
|
|
|
|
|
debug('Begin: Services');
|
2021-05-12 15:48:59 +03:00
|
|
|
const members = require('./server/services/members');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const permissions = require('./server/services/permissions');
|
|
|
|
const xmlrpc = require('./server/services/xmlrpc');
|
|
|
|
const slack = require('./server/services/slack');
|
|
|
|
const {mega} = require('./server/services/mega');
|
|
|
|
const webhooks = require('./server/services/webhooks');
|
2021-02-23 14:49:59 +03:00
|
|
|
const appService = require('./frontend/services/apps');
|
2021-03-03 15:35:45 +03:00
|
|
|
const limits = require('./server/services/limits');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const scheduling = require('./server/adapters/scheduling');
|
2021-02-23 14:49:59 +03:00
|
|
|
|
|
|
|
const urlUtils = require('./shared/url-utils');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-05-11 17:11:09 +03:00
|
|
|
// NOTE: limits service has to be initialized first
|
|
|
|
// in case it limits initialization of any other service (e.g. webhooks)
|
|
|
|
await limits.init();
|
|
|
|
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await Promise.all([
|
2021-05-12 15:48:59 +03:00
|
|
|
members.init(),
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
permissions.init(),
|
|
|
|
xmlrpc.listen(),
|
|
|
|
slack.listen(),
|
|
|
|
mega.listen(),
|
|
|
|
webhooks.listen(),
|
|
|
|
appService.init(),
|
|
|
|
scheduling.init({
|
2021-04-21 16:57:07 +03:00
|
|
|
apiUrl: urlUtils.urlFor('api', {version: defaultApiVersion, versionType: 'admin'}, true)
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
})
|
|
|
|
]);
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: Services');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
|
|
|
// Initialise analytics events
|
|
|
|
if (config.get('segment:key')) {
|
2021-02-09 15:40:52 +03:00
|
|
|
require('./server/analytics-events').init();
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
}
|
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
debug('End: initServices');
|
|
|
|
}
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
/**
|
2021-02-22 20:30:25 +03:00
|
|
|
* Kick off recurring jobs and background services
|
2021-02-19 14:51:01 +03:00
|
|
|
* These are things that happen on boot, but we don't need to wait for them to finish
|
2021-02-22 20:30:25 +03:00
|
|
|
* Later, this might be a service hook
|
2021-02-19 14:51:01 +03:00
|
|
|
*/
|
2021-02-22 20:30:25 +03:00
|
|
|
async function initBackgroundServices({config}) {
|
|
|
|
debug('Begin: initBackgroundServices');
|
|
|
|
|
|
|
|
// we don't want to kick off background services that will interfere with tests
|
2021-02-19 13:09:41 +03:00
|
|
|
if (process.env.NODE_ENV.match(/^testing/)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-02-22 20:30:25 +03:00
|
|
|
// Load email analytics recurring jobs
|
2021-02-19 13:09:41 +03:00
|
|
|
if (config.get('backgroundJobs:emailAnalytics')) {
|
|
|
|
const emailAnalyticsJobs = require('./server/services/email-analytics/jobs');
|
|
|
|
await emailAnalyticsJobs.scheduleRecurringJobs();
|
|
|
|
}
|
|
|
|
|
2021-02-22 20:30:25 +03:00
|
|
|
// Load all inactive themes
|
2021-04-27 15:28:04 +03:00
|
|
|
const themeService = require('./server/services/themes');
|
2021-02-22 20:30:25 +03:00
|
|
|
themeService.loadInactiveThemes();
|
|
|
|
|
2021-05-27 17:36:46 +03:00
|
|
|
const jobsService = require('./server/services/jobs');
|
|
|
|
|
|
|
|
// use a random seconds/minutes/hours value to avoid spikes to the update service API
|
|
|
|
const s = Math.floor(Math.random() * 60); // 0-59
|
|
|
|
const m = Math.floor(Math.random() * 60); // 0-59
|
|
|
|
const h = Math.floor(Math.random() * 24); // 0-23
|
|
|
|
|
|
|
|
jobsService.addJob({
|
|
|
|
at: `${s} ${m} ${h} * * *`, // Every day
|
|
|
|
job: require('path').resolve(__dirname, 'server', 'run-update-check.js'),
|
|
|
|
name: 'update-check'
|
|
|
|
});
|
|
|
|
|
2021-02-22 20:30:25 +03:00
|
|
|
debug('End: initBackgroundServices');
|
2021-02-19 13:09:41 +03:00
|
|
|
}
|
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
/**
|
|
|
|
* ----------------------------------
|
|
|
|
* Boot Ghost - The magic starts here
|
|
|
|
* ----------------------------------
|
|
|
|
*
|
|
|
|
* - This function is written with async/await so you can read, line by line, what happens on boot
|
|
|
|
* - All the functions above handle init/boot logic for a single component
|
|
|
|
*/
|
|
|
|
async function bootGhost() {
|
2021-02-19 12:10:45 +03:00
|
|
|
// Metrics
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const startTime = Date.now();
|
2021-02-19 14:51:01 +03:00
|
|
|
debug('Begin Boot');
|
2021-02-23 12:43:12 +03:00
|
|
|
|
|
|
|
// We need access to these variables in both the try and catch block
|
2021-03-18 14:58:24 +03:00
|
|
|
let bootLogger;
|
|
|
|
let config;
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
let ghostServer;
|
2021-02-23 12:43:12 +03:00
|
|
|
let logging;
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// These require their own try-catch block and error format, because we can't log an error if logging isn't working
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
try {
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 0 - Load config and logging - fundamental required components
|
2021-02-16 14:54:19 +03:00
|
|
|
// Config must be the first thing we do, because it is required for absolutely everything
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('Begin: Load config');
|
2021-03-18 14:58:24 +03:00
|
|
|
config = require('./shared/config');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('End: Load config');
|
|
|
|
|
2021-02-16 14:54:19 +03:00
|
|
|
// Logging is used absolutely everywhere
|
|
|
|
debug('Begin: Load logging');
|
2021-06-15 17:36:27 +03:00
|
|
|
logging = require('@tryghost/logging');
|
2021-03-18 14:58:24 +03:00
|
|
|
bootLogger = new BootLogger(logging, startTime);
|
2021-02-16 14:54:19 +03:00
|
|
|
debug('End: Load logging');
|
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// At this point logging is required, so we can handle errors better
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error); // eslint-disable-line no-console
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Step 1 - require more fundamental components
|
2021-02-24 03:05:29 +03:00
|
|
|
// Version is required by sentry & Migration config & so is fundamental to booting
|
2021-02-23 12:43:12 +03:00
|
|
|
// However, it involves reading package.json so its slow & it's here for visibility on that slowness
|
|
|
|
debug('Begin: Load version info');
|
2021-06-16 11:36:58 +03:00
|
|
|
require('@tryghost/version');
|
2021-02-23 12:43:12 +03:00
|
|
|
debug('End: Load version info');
|
|
|
|
|
2021-02-19 12:10:45 +03:00
|
|
|
// Sentry must be initialised early, but requires config
|
|
|
|
debug('Begin: Load sentry');
|
|
|
|
require('./shared/sentry');
|
|
|
|
debug('End: Load sentry');
|
|
|
|
|
2021-05-05 18:07:51 +03:00
|
|
|
// I18n is basically used to colocate all of our error message strings & required to log server start messages
|
|
|
|
debug('Begin: i18n');
|
|
|
|
const i18n = require('./shared/i18n');
|
|
|
|
i18n.init();
|
|
|
|
debug('End: i18n');
|
|
|
|
|
2021-05-05 16:24:59 +03:00
|
|
|
debug('Begin: Load urlUtils');
|
|
|
|
const urlUtils = require('./shared/url-utils');
|
|
|
|
debug('End: Load urlUtils');
|
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 2 - Start server with minimal app in global maintenance mode
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('Begin: load server + minimal app');
|
|
|
|
const rootApp = require('./app');
|
|
|
|
const GhostServer = require('./server/ghost-server');
|
2021-05-05 16:24:59 +03:00
|
|
|
ghostServer = new GhostServer({url: urlUtils.urlFor('home', true)});
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await ghostServer.start(rootApp);
|
2021-02-16 14:54:19 +03:00
|
|
|
bootLogger.log('server started');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('End: load server + minimal app');
|
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 3 - Get the DB ready
|
2021-02-16 14:54:19 +03:00
|
|
|
debug('Begin: Get DB ready');
|
2021-02-19 14:51:01 +03:00
|
|
|
await initDatabase({config, logging});
|
2021-02-16 14:54:19 +03:00
|
|
|
bootLogger.log('database ready');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
debug('End: Get DB ready');
|
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 4 - Load Ghost with all its services
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('Begin: Load Ghost Services & Apps');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
await initCore({ghostServer});
|
2021-02-19 14:51:01 +03:00
|
|
|
await initFrontend();
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
const ghostApp = await initExpressApps({});
|
|
|
|
await initServices({config});
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('End: Load Ghost Services & Apps');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 5 - Mount the full Ghost app onto the minimal root app & disable maintenance mode
|
2021-02-23 14:49:59 +03:00
|
|
|
debug('Begin: mountGhost');
|
|
|
|
rootApp.disable('maintenance');
|
|
|
|
rootApp.use(urlUtils.getSubdir(), ghostApp);
|
|
|
|
debug('End: mountGhost');
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 6 - We are technically done here - let everyone know!
|
2021-02-16 14:54:19 +03:00
|
|
|
bootLogger.log('booted');
|
2021-02-19 23:32:37 +03:00
|
|
|
notifyServerReady();
|
2021-02-18 23:06:16 +03:00
|
|
|
|
2021-03-18 14:58:24 +03:00
|
|
|
// Step 7 - Init our background services, we don't wait for this to finish
|
2021-02-22 20:30:25 +03:00
|
|
|
initBackgroundServices({config});
|
2021-02-19 14:51:01 +03:00
|
|
|
|
2021-02-23 14:49:59 +03:00
|
|
|
// We return the server purely for testing purposes
|
2021-02-19 14:51:01 +03:00
|
|
|
debug('End Boot: Returning Ghost Server');
|
2021-02-18 23:06:16 +03:00
|
|
|
return ghostServer;
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
} catch (error) {
|
|
|
|
const errors = require('@tryghost/errors');
|
|
|
|
|
2021-02-23 12:43:12 +03:00
|
|
|
// Ensure the error we have is an ignition error
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
let serverStartError = error;
|
|
|
|
if (!errors.utils.isIgnitionError(serverStartError)) {
|
|
|
|
serverStartError = new errors.GhostError({message: serverStartError.message, err: serverStartError});
|
|
|
|
}
|
|
|
|
|
|
|
|
logging.error(serverStartError);
|
|
|
|
|
2021-02-19 14:51:01 +03:00
|
|
|
// If ghost was started and something else went wrong, we shut it down
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
if (ghostServer) {
|
2021-02-19 23:32:37 +03:00
|
|
|
notifyServerReady(serverStartError);
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
ghostServer.shutdown(2);
|
|
|
|
} else {
|
2021-02-19 14:51:01 +03:00
|
|
|
// Ghost server failed to start, set a timeout to give logging a chance to flush
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
setTimeout(() => {
|
|
|
|
process.exit(2);
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
}
|
2021-02-19 14:51:01 +03:00
|
|
|
}
|
Added new, simpler, linear boot process
Background:
- Ghosts existing boot process is split across multiple files, has affordances for outdated ways of running Ghost and is generally non-linear making it nigh-impossible to follow
- The web of dependencies that are loaded on boot are also impossible to unpick, which makes it really hard to decouple Ghost
- With 4.0 we want to introduce a new, linear, simpler, clearer way to boot up Ghost to unlock decoupling Ghost into much smaller pieces
This commit:
- adds a new ghost.js file which switches between boot mode with `node index` or `node index old` so that if we find bugs we can work around them this week
- Note: the old boot process will go away very soon, but ghost.js will remain as the interface between the command to start Ghost and the application code
- reworks the database migration process into a standalone utility, so that the DB is handled as one simple step of the boot process, decoupled from everything else
- is missing tests for this new db utility
- leaves a lot of work to do around loading core code, services, express apps in a sensible order, as work to fix this would start to break the old boot process
- doesn't use the new maintenance app because we aren't restarting the server here, instead we have the concept of a "core app" that starts in maintenance mode - need to think about how apps will be decoupled in the near future
2021-02-02 17:47:16 +03:00
|
|
|
|
|
|
|
module.exports = bootGhost;
|