Merge branch 'master' into feat/row-actions

This commit is contained in:
Adria Navarro 2024-07-24 16:52:54 +02:00 committed by GitHub
commit b568c9e592
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -80,18 +80,31 @@ export async function startup(
const address = server.address() as AddressInfo const address = server.address() as AddressInfo
env._set("PORT", address.port) env._set("PORT", address.port)
} }
console.log("Emitting port event")
eventEmitter.emitPort(env.PORT) eventEmitter.emitPort(env.PORT)
console.log("Initialising file system")
fileSystem.init() fileSystem.init()
console.log("Initialising redis")
await redis.init() await redis.init()
console.log("Initialising writethrough cache")
cache.docWritethrough.init() cache.docWritethrough.init()
console.log("Initialising events")
eventInit() eventInit()
if (app && server) { if (app && server) {
console.log("Initialising websockets")
initialiseWebsockets(app, server) initialiseWebsockets(app, server)
} }
// run migrations on startup if not done via http // run migrations on startup if not done via http
// not recommended in a clustered environment // not recommended in a clustered environment
if (!env.HTTP_MIGRATIONS && !env.isTest()) { if (!env.HTTP_MIGRATIONS && !env.isTest()) {
console.log("Running migrations")
try { try {
await migrations.migrate() await migrations.migrate()
} catch (e) { } catch (e) {
@ -107,12 +120,15 @@ export async function startup(
env.PLUGINS_DIR && env.PLUGINS_DIR &&
fs.existsSync(env.PLUGINS_DIR) fs.existsSync(env.PLUGINS_DIR)
) { ) {
console.log("Monitoring plugin directory")
watch() watch()
} }
// check for version updates // check for version updates
console.log("Checking for version updates")
await installation.checkInstallVersion() await installation.checkInstallVersion()
console.log("Initialising queues")
// get the references to the queue promises, don't await as // get the references to the queue promises, don't await as
// they will never end, unless the processing stops // they will never end, unless the processing stops
let queuePromises = [] let queuePromises = []
@ -126,6 +142,7 @@ export async function startup(
} }
queuePromises.push(initPro()) queuePromises.push(initPro())
if (app) { if (app) {
console.log("Initialising routes")
// bring routes online as final step once everything ready // bring routes online as final step once everything ready
await initRoutes(app) await initRoutes(app)
} }
@ -141,6 +158,7 @@ export async function startup(
bbAdminEmail && bbAdminEmail &&
bbAdminPassword bbAdminPassword
) { ) {
console.log("Initialising admin user")
const tenantId = tenancy.getTenantId() const tenantId = tenancy.getTenantId()
await tenancy.doInTenant(tenantId, async () => { await tenancy.doInTenant(tenantId, async () => {
const exists = await users.doesUserExist(bbAdminEmail) const exists = await users.doesUserExist(bbAdminEmail)
@ -171,5 +189,6 @@ export async function startup(
}) })
} }
console.log("Initialising JS runner")
jsRunner.init() jsRunner.init()
} }