diff --git a/packages/server-core/src/assets/model-transform/model-transform.job.ts b/packages/server-core/src/assets/model-transform/model-transform.job.ts index 2b4bbd0d52..31aed91b20 100644 --- a/packages/server-core/src/assets/model-transform/model-transform.job.ts +++ b/packages/server-core/src/assets/model-transform/model-transform.job.ts @@ -31,7 +31,7 @@ import { argsToObject } from '@etherealengine/common/src/utils/objectToCommandLi import { ModelTransformParameters } from '@etherealengine/engine/src/assets/classes/ModelTransform' import { transformModel } from '@etherealengine/engine/src/assets/compression/ModelTransformFunctions' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' const modelTransformParameters: ModelTransformParameters = argsToObject(process.argv.slice(3)) @@ -56,7 +56,7 @@ cli.enable('status') cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() await transformModel(modelTransformParameters) cli.exit(0) diff --git a/packages/server-core/src/createApp.ts b/packages/server-core/src/createApp.ts index 6dfbbe10d8..cae9ebcddc 100644 --- a/packages/server-core/src/createApp.ts +++ b/packages/server-core/src/createApp.ts @@ -165,6 +165,8 @@ export const serverPipe = pipe(configureOpenAPI(), configurePrimus(), configureR app: Application ) => Application +export const serverJobPipe = pipe(configurePrimus(), configureK8s()) as (app: Application) => Application + export const createFeathersKoaApp = ( serverMode: ServerTypeMode = ServerMode.API, configurationPipe = serverPipe diff --git a/scripts/archive-directory.ts b/scripts/archive-directory.ts index dabbec8944..95f95ce6e0 100644 --- a/scripts/archive-directory.ts +++ b/scripts/archive-directory.ts @@ -29,7 +29,7 @@ import dotenv from 'dotenv-flow' import { archiverPath } from '@etherealengine/common/src/schema.type.module' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' dotenv.config({ path: appRootPath.path, @@ -58,7 +58,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const { directory, jobId, storageProviderName } = options await app.service(archiverPath).get(null, { diff --git a/scripts/auto-update-project.ts b/scripts/auto-update-project.ts index 231bb4c929..9953dc4e10 100644 --- a/scripts/auto-update-project.ts +++ b/scripts/auto-update-project.ts @@ -27,7 +27,7 @@ import appRootPath from 'app-root-path' import cli from 'cli' import dotenv from 'dotenv-flow' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import { checkProjectAutoUpdate } from '@etherealengine/server-core/src/projects/project/project-helper' import { ServerMode } from '@etherealengine/server-core/src/ServerState' @@ -56,7 +56,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() await checkProjectAutoUpdate(app, options.projectName) cli.exit(0) diff --git a/scripts/convert-resource-urls-to-app.ts b/scripts/convert-resource-urls-to-app.ts index 09e9cf726c..47304a1393 100644 --- a/scripts/convert-resource-urls-to-app.ts +++ b/scripts/convert-resource-urls-to-app.ts @@ -32,7 +32,7 @@ import cli from 'cli' import dotenv from 'dotenv-flow' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' dotenv.config({ path: appRootPath.path, @@ -72,7 +72,7 @@ cli.main(async () => { }) console.log('options', options) - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const staticResources = await knexClient.from(staticResourcePath) diff --git a/scripts/convert-static-resource-url.ts b/scripts/convert-static-resource-url.ts index e9ffd444bb..58c4410256 100644 --- a/scripts/convert-static-resource-url.ts +++ b/scripts/convert-static-resource-url.ts @@ -30,7 +30,7 @@ import knex from 'knex' import { StaticResourceDatabaseType, staticResourcePath } from '@etherealengine/common/src/schema.type.module' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import cli from 'cli' import dotenv from 'dotenv-flow' @@ -55,7 +55,7 @@ cli.main(async () => { } }) - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() type UpdatedStaticResourceType = StaticResourceDatabaseType & { diff --git a/scripts/create-project.ts b/scripts/create-project.ts index 1307cd27ec..b95954c3ac 100644 --- a/scripts/create-project.ts +++ b/scripts/create-project.ts @@ -29,7 +29,7 @@ import dotenv from 'dotenv-flow' import { projectPath } from '@etherealengine/common/src/schema.type.module' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' dotenv.config({ path: appRootPath.path, @@ -56,7 +56,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const name = options.name.replace(' ', '-') await app.service(projectPath).create({ name }) diff --git a/scripts/install-projects.js b/scripts/install-projects.js index dba4dd3b87..835cea0396 100755 --- a/scripts/install-projects.js +++ b/scripts/install-projects.js @@ -26,7 +26,7 @@ Ethereal Engine. All Rights Reserved. import { projectPath } from '@etherealengine/common/src/schema.type.module' import logger from '@etherealengine/server-core/src/ServerLogger' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import { createDefaultStorageProvider } from '@etherealengine/server-core/src/media/storageprovider/storageprovider' import { download } from '@etherealengine/server-core/src/projects/project/downloadProjects' import { getProjectConfig, onProjectEvent } from '@etherealengine/server-core/src/projects/project/project-helper' @@ -49,7 +49,7 @@ db.url = process.env.MYSQL_URL ?? `mysql://${db.username}:${db.password}@${db.ho async function installAllProjects() { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() createDefaultStorageProvider() const localProjectDirectory = path.join(appRootPath.path, 'packages/projects/projects') diff --git a/scripts/push-project.ts b/scripts/push-project.ts index 9cdf1cd316..bb42fe17ec 100644 --- a/scripts/push-project.ts +++ b/scripts/push-project.ts @@ -29,7 +29,7 @@ import dotenv from 'dotenv-flow' import { projectPath, userPath } from '@etherealengine/common/src/schema.type.module' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import { pushProjectToGithub } from '@etherealengine/server-core/src/projects/project/github-helper' dotenv.config({ @@ -62,7 +62,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const { userId, projectId, reset, commitSHA, storageProviderName, jobId } = options const user = await app.service(userPath).get(userId) diff --git a/scripts/update-cloudfront-function.ts b/scripts/update-cloudfront-function.ts index e0621076a9..c00c7f53a9 100644 --- a/scripts/update-cloudfront-function.ts +++ b/scripts/update-cloudfront-function.ts @@ -28,7 +28,7 @@ import cli from 'cli' import { InstalledRoutesInterface } from '@etherealengine/common/src/interfaces/Route' import { routePath } from '@etherealengine/common/src/schema.type.module' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import { getStorageProvider } from '@etherealengine/server-core/src/media/storageprovider/storageprovider' import { ServerMode } from '@etherealengine/server-core/src/ServerState' @@ -53,7 +53,7 @@ const options = cli.parse({ }) cli.main(async () => { try { - const app = await createFeathersKoaApp(ServerMode.API) + const app = await createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const storageProvider = getStorageProvider() const routes = (await getAllRoutes(app, [], 0)).map((item) => item.route) diff --git a/scripts/update-cronjob-image.ts b/scripts/update-cronjob-image.ts index e90aa3dda8..0941b2c702 100644 --- a/scripts/update-cronjob-image.ts +++ b/scripts/update-cronjob-image.ts @@ -30,7 +30,7 @@ import dotenv from 'dotenv-flow' import { ProjectType, projectPath } from '@etherealengine/common/src/schema.type.module' import { getState } from '@etherealengine/hyperflux' import { ServerMode, ServerState } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' import { getCronJobBody } from '@etherealengine/server-core/src/projects/project/project-helper' dotenv.config({ @@ -61,7 +61,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const autoUpdateProjects = (await app.service(projectPath).find({ query: { diff --git a/scripts/update-project.ts b/scripts/update-project.ts index f0e39d32d3..d2fd74b006 100644 --- a/scripts/update-project.ts +++ b/scripts/update-project.ts @@ -29,7 +29,7 @@ import dotenv from 'dotenv-flow' import { projectPath, userPath } from '@etherealengine/common/src/schema.type.module' import { ServerMode } from '@etherealengine/server-core/src/ServerState' -import { createFeathersKoaApp } from '@etherealengine/server-core/src/createApp' +import { createFeathersKoaApp, serverJobPipe } from '@etherealengine/server-core/src/createApp' dotenv.config({ path: appRootPath.path, @@ -66,7 +66,7 @@ const options = cli.parse({ cli.main(async () => { try { - const app = createFeathersKoaApp(ServerMode.API) + const app = createFeathersKoaApp(ServerMode.API, serverJobPipe) await app.setup() const { userId, jobId, ...data } = options data.reset = data.reset === 'true'