console.log the crap out of startup
This commit is contained in:
parent
0fb9c78551
commit
dfa2437f46
|
@ -27,6 +27,7 @@ import Koa from "koa"
|
||||||
import { Server } from "http"
|
import { Server } from "http"
|
||||||
import { AddressInfo } from "net"
|
import { AddressInfo } from "net"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
|
import { c } from "tar"
|
||||||
|
|
||||||
let STARTUP_RAN = false
|
let STARTUP_RAN = false
|
||||||
|
|
||||||
|
@ -80,18 +81,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 +121,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 +143,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 +159,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 +190,6 @@ export async function startup(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Initialising JS runner")
|
||||||
jsRunner.init()
|
jsRunner.init()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue