Skip to content

Commit

Permalink
[server] decouple get ide config logic from server
Browse files Browse the repository at this point in the history
  • Loading branch information
iQQBot authored and roboquat committed Sep 27, 2022
1 parent 3c7c79b commit 481267b
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 294 deletions.
3 changes: 3 additions & 0 deletions components/server/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ packages:
- components/ws-manager-api/typescript:lib
- components/supervisor-api/typescript-grpcweb:lib
- components/usage-api/typescript:lib
- components/ide-service-api/typescript:lib
config:
packaging: offline-mirror
yarnLock: ${coreYarnLockBase}/yarn.lock
Expand Down Expand Up @@ -57,6 +58,7 @@ packages:
- components/ws-manager-api/typescript:lib
- components/supervisor-api/typescript-grpcweb:lib
- components/usage-api/typescript:lib
- components/ide-service-api/typescript:lib
- :dbtest
config:
packaging: library
Expand All @@ -83,6 +85,7 @@ packages:
- components/ws-manager-api/typescript:lib
- components/supervisor-api/typescript-grpcweb:lib
- components/usage-api/typescript:lib
- components/ide-service-api/typescript:lib
config:
packaging: library
yarnLock: ${coreYarnLockBase}/yarn.lock
Expand Down
2 changes: 1 addition & 1 deletion components/server/ee/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Workspace, User, WorkspaceInstance, NamedWorkspaceFeatureFlag } from "@gitpod/gitpod-protocol";
import { TraceContext } from "@gitpod/gitpod-protocol/lib/util/tracing";
import { injectable } from "inversify";
import { IDEConfig } from "../../../src/ide-config";
import { IDEConfig } from "../../../src/ide-service";
import { WorkspaceStarter } from "../../../src/workspace/workspace-starter";

@injectable()
Expand Down
4 changes: 0 additions & 4 deletions components/server/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ COPY components-server--app /installer/
WORKDIR /app
RUN /installer/install.sh

FROM golang:1.17.2 as oci-tool-builder
RUN go install github.com/csweichel/oci-tool@v0.1.1

FROM node:16.13.0-slim
ENV NODE_OPTIONS="--unhandled-rejections=warn --max_old_space_size=2048"
# Using ssh-keygen for RSA keypair generation
Expand All @@ -27,7 +24,6 @@ RUN apt-get update && apt-get install -yq \

EXPOSE 3000

COPY --from=oci-tool-builder /go /go/
ENV PATH="/go/bin:${PATH}"

# '--no-log-init': see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
Expand Down
1 change: 1 addition & 0 deletions components/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@gitpod/gitpod-messagebus": "0.1.5",
"@gitpod/gitpod-payment-endpoint": "0.1.5",
"@gitpod/gitpod-protocol": "0.1.5",
"@gitpod/ide-service-api": "0.1.5",
"@gitpod/image-builder": "0.1.5",
"@gitpod/licensor": "0.1.5",
"@gitpod/supervisor-api-grpcweb": "0.1.5",
Expand Down
6 changes: 6 additions & 0 deletions components/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ export interface ConfigSerialized {
*/
usageServiceAddr: string;

/**
* The address ide service clients connect to
* Example: ide-service:9001
*/
ideServiceAddr: string;

codeSync: CodeSyncConfig;

vsxRegistryUrl: string;
Expand Down
8 changes: 6 additions & 2 deletions components/server/src/container-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ import { ProjectsService } from "./projects/projects-service";
import { NewsletterSubscriptionController } from "./user/newsletter-subscription-controller";
import { Config, ConfigFile } from "./config";
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/gitpod-protocol/lib/util/grpc";
import { DebugApp } from "@gitpod/gitpod-protocol/lib/util/debug-app";
Expand All @@ -111,10 +110,10 @@ import {
import { VerificationService } from "./auth/verification-service";
import { WebhookEventGarbageCollector } from "./projects/webhook-event-garbage-collector";
import { LivenessController } from "./liveness/liveness-controller";
import { IDEServiceClient, IDEServiceDefinition } from "@gitpod/ide-service-api/lib/ide.pb";

export const productionContainerModule = new ContainerModule((bind, unbind, isBound, rebind) => {
bind(Config).toConstantValue(ConfigFile.fromFile());
bind(IDEConfigService).toSelf().inSingletonScope();
bind(IDEService).toSelf().inSingletonScope();

bind(UserService).toSelf().inSingletonScope();
Expand Down Expand Up @@ -270,6 +269,11 @@ export const productionContainerModule = new ContainerModule((bind, unbind, isBo
return createClient(BillingServiceDefinition, createChannel(config.usageServiceAddr));
});

bind<IDEServiceClient>(IDEServiceDefinition.name).toDynamicValue((ctx) => {
const config = ctx.container.get<Config>(Config);
return createClient(IDEServiceDefinition, createChannel(config.ideServiceAddr));
});

bind(EntitlementService).to(CommunityEntitlementService).inSingletonScope();

bind(ConfigCatClientFactory)
Expand Down
264 changes: 0 additions & 264 deletions components/server/src/ide-config.ts

This file was deleted.

Loading

0 comments on commit 481267b

Please sign in to comment.