diff --git a/components/gitpod-protocol/package.json b/components/gitpod-protocol/package.json index e1036808a7c56c..ffb71ce29967fe 100644 --- a/components/gitpod-protocol/package.json +++ b/components/gitpod-protocol/package.json @@ -13,6 +13,7 @@ "@types/analytics-node": "^3.1.5", "@types/chai-subset": "^1.3.3", "@types/cookie": "^0.4.1", + "@types/express": "^4.17.13", "@types/jaeger-client": "^3.18.3", "@types/js-yaml": "^3.10.1", "@types/mocha": "^5.2.7", @@ -42,6 +43,7 @@ "ajv": "^6.5.4", "analytics-node": "^4.0.1", "cookie": "^0.4.2", + "express": "^4.17.3", "inversify": "^5.1.1", "jaeger-client": "^3.18.1", "js-yaml": "^3.10.0", diff --git a/components/server/src/debug-app.ts b/components/gitpod-protocol/src/util/debug-app.ts similarity index 95% rename from components/server/src/debug-app.ts rename to components/gitpod-protocol/src/util/debug-app.ts index 96b71b2c29fb52..467e174bbd97ac 100644 --- a/components/server/src/debug-app.ts +++ b/components/gitpod-protocol/src/util/debug-app.ts @@ -7,7 +7,7 @@ import * as http from "http"; import * as express from "express"; import { injectable, postConstruct } from "inversify"; -import { log, LogrusLogLevel } from "@gitpod/gitpod-protocol/lib/util/logging"; +import { log, LogrusLogLevel } from "./logging"; export interface SetLogLevelRequest { level: LogrusLogLevel; @@ -53,7 +53,7 @@ export class DebugApp { return app; } - public start(port: number) { + public start(port: number = 6060) { this.httpServer = this._app.listen(port, "localhost", () => { log.info(`debug server listening on port: ${port}`); }); diff --git a/components/server/src/container-module.ts b/components/server/src/container-module.ts index 0c0d37232bfb80..eb9ee9eac74912 100644 --- a/components/server/src/container-module.ts +++ b/components/server/src/container-module.ts @@ -92,7 +92,7 @@ import { defaultGRPCOptions } from "@gitpod/gitpod-protocol/lib/util/grpc"; import { IDEConfigService } from "./ide-config"; import { PrometheusClientCallMetrics } from "@gitpod/gitpod-protocol/lib/messaging/client-call-metrics"; import { IClientCallMetrics } from "@gitpod/content-service/lib/client-call-metrics"; -import { DebugApp } from "./debug-app"; +import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app"; import { LocalMessageBroker, LocalRabbitMQBackedMessageBroker } from "./messaging/local-message-broker"; import { contentServiceBinder } from "@gitpod/content-service/lib/sugar"; import { ReferrerPrefixParser } from "./workspace/referrer-prefix-context-parser"; diff --git a/components/server/src/server.ts b/components/server/src/server.ts index ff3976d18736b3..e3df4bddf3c0e7 100644 --- a/components/server/src/server.ts +++ b/components/server/src/server.ts @@ -44,7 +44,7 @@ import { } from "./workspace/headless-log-controller"; import { NewsletterSubscriptionController } from "./user/newsletter-subscription-controller"; import { Config } from "./config"; -import { DebugApp } from "./debug-app"; +import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app"; import { LocalMessageBroker } from "./messaging/local-message-broker"; import { WsConnectionHandler } from "./express/ws-connection-handler"; import { InstallationAdminController } from "./installation-admin/installation-admin-controller"; @@ -334,7 +334,7 @@ export class Server { }); } - this.debugApp.start(6060); + this.debugApp.start(); } public async stop() { diff --git a/components/ws-manager-bridge/src/bridge-controller.ts b/components/ws-manager-bridge/src/bridge-controller.ts index 6283909b8a37a5..1cd1706dac1ead 100644 --- a/components/ws-manager-bridge/src/bridge-controller.ts +++ b/components/ws-manager-bridge/src/bridge-controller.ts @@ -64,7 +64,7 @@ export class BridgeController { protected async reconcile() { return this.reconcileQueue.enqueue(async () => { const allClusters = await this.getAllWorkspaceClusters(); - log.info("reconciling clusters...", { allClusters: Array.from(allClusters.values()) }); + log.info("reconciling clusters...", { allClusters: Array.from(allClusters.keys()) }); const toDelete: string[] = []; try { for (const [name, bridge] of this.bridges) { diff --git a/components/ws-manager-bridge/src/container-module.ts b/components/ws-manager-bridge/src/container-module.ts index 61aa89dfe45f26..6895981d69c01f 100644 --- a/components/ws-manager-bridge/src/container-module.ts +++ b/components/ws-manager-bridge/src/container-module.ts @@ -35,6 +35,7 @@ import { PrometheusClientCallMetrics } from "@gitpod/gitpod-protocol/lib/messagi import { PreparingUpdateEmulator, PreparingUpdateEmulatorFactory } from "./preparing-update-emulator"; import { PrebuildStateMapper } from "./prebuild-state-mapper"; import { PrebuildUpdater, PrebuildUpdaterNoOp } from "./prebuild-updater"; +import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app"; export const containerModule = new ContainerModule((bind) => { bind(MessagebusConfiguration).toSelf().inSingletonScope(); @@ -85,4 +86,6 @@ export const containerModule = new ContainerModule((bind) => { bind(PrebuildStateMapper).toSelf().inSingletonScope(); bind(PrebuildUpdater).to(PrebuildUpdaterNoOp).inSingletonScope(); + + bind(DebugApp).toSelf().inSingletonScope(); }); diff --git a/components/ws-manager-bridge/src/main.ts b/components/ws-manager-bridge/src/main.ts index 1ddf64e962910e..3c1755e1d92a39 100644 --- a/components/ws-manager-bridge/src/main.ts +++ b/components/ws-manager-bridge/src/main.ts @@ -8,6 +8,7 @@ import { Container } from "inversify"; import * as express from "express"; import * as prometheusClient from "prom-client"; import { log, LogrusLogLevel } from "@gitpod/gitpod-protocol/lib/util/logging"; +import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app"; import { MessageBusIntegration } from "./messagebus-integration"; import { TypeORM } from "@gitpod/gitpod-db/lib/typeorm/typeorm"; import { TracingManager } from "@gitpod/gitpod-protocol/lib/util/tracing"; @@ -39,6 +40,9 @@ export const start = async (container: Container) => { log.info(`prometheus metrics server running on: localhost:${metricsPort}`); }); + const debugApp = container.get(DebugApp); + debugApp.start(); + const bridgeController = container.get(BridgeController); await bridgeController.start();