From 2b2079b4f1233ca8415849f8a9c1ebf18e2cf0c1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 11 Jun 2024 15:45:07 +0100 Subject: [PATCH] Moving app migrations back to API service. --- .../src/appMigrations/appMigrationMetadata.ts | 4 ++-- packages/server/src/startup/index.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/server/src/appMigrations/appMigrationMetadata.ts b/packages/server/src/appMigrations/appMigrationMetadata.ts index a9a75bc104..176cd0ff84 100644 --- a/packages/server/src/appMigrations/appMigrationMetadata.ts +++ b/packages/server/src/appMigrations/appMigrationMetadata.ts @@ -25,8 +25,8 @@ export async function getAppMigrationVersion(appId: string): Promise { let metadata: AppMigrationDoc | undefined = await cache.get(cacheKey) - // We don't want to cache in dev or QA, in order to be able to tweak it - if (metadata && !env.isDev() && !env.isQA()) { + // We don't want to cache in dev in order to be able to tweak it + if (metadata && !env.isDev()) { return metadata.version } diff --git a/packages/server/src/startup/index.ts b/packages/server/src/startup/index.ts index 7f244f6573..0e08075698 100644 --- a/packages/server/src/startup/index.ts +++ b/packages/server/src/startup/index.ts @@ -20,7 +20,7 @@ import * as pro from "@budibase/pro" import * as api from "../api" import sdk from "../sdk" import { initialise as initialiseWebsockets } from "../websockets" -import { automationsEnabled, printFeatures } from "../features" +import { apiEnabled, automationsEnabled, printFeatures } from "../features" import * as jsRunner from "../jsRunner" import Koa from "koa" import { Server } from "http" @@ -70,13 +70,12 @@ export async function startup( return } printFeatures() + if (env.BUDIBASE_ENVIRONMENT) { + console.log(`service running environment: "${env.BUDIBASE_ENVIRONMENT}"`) + } STARTUP_RAN = true if (app && server && !env.CLUSTER_MODE) { - let startupLog = `Budibase running on ${JSON.stringify(server.address())}` - if (env.BUDIBASE_ENVIRONMENT) { - startupLog = `${startupLog} - environment: "${env.BUDIBASE_ENVIRONMENT}"` - } - console.log(startupLog) + console.log(`Budibase running on ${JSON.stringify(server.address())}`) const address = server.address() as AddressInfo env._set("PORT", address.port) } @@ -121,9 +120,11 @@ export async function startup( queuePromises.push(events.processors.init(pro.sdk.auditLogs.write)) // app migrations and automations on other service if (automationsEnabled()) { - queuePromises.push(appMigrations.init()) queuePromises.push(automations.init()) } + if (apiEnabled()) { + queuePromises.push(appMigrations.init()) + } queuePromises.push(initPro()) if (app) { // bring routes online as final step once everything ready