Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/agent-app/src/executors/deploy-template.executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,13 @@ export class DeployTemplateExecutor {
opts.resolvedConfig,
);

await this.resourceAvailabilityService.assertRamAvailable(
requirements.memoryBytes,
);

await this.resourceAvailabilityService.assertCpuAvailable(
requirements.cpuCores,
);

await this.resourceAvailabilityService.assertRamAvailable(
requirements.memoryBytes,
);
} else {
this.logger.warn(
"RAM and CPU availability checks skipped: user confirmed resource override",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Param,
Patch,
Post,
Query,
Req,
UseGuards,
UsePipes,
Expand Down Expand Up @@ -45,6 +46,7 @@ export class DeploymentsController {
async deployCompose(
@Req() req: { user: UserEntity },
@Body() body: DeployTemplateDto,
@Query("acknowledgeResourceWarning") acknowledgeResourceWarning?: string,
): Promise<{
message: string;
template: string;
Expand Down Expand Up @@ -100,7 +102,9 @@ export class DeploymentsController {
const result = this.deploymentsService.schedulePreparedDeployment(
prepared,
Boolean(deploymentId),
{ skipResourceValidation: body.skipResourceValidation },
{
skipResourceValidation: acknowledgeResourceWarning === "true",
},
);

const publicUrl = resolvePrimaryServicePublicUrl(
Expand Down Expand Up @@ -160,6 +164,7 @@ export class DeploymentsController {
async deploy(
@Req() req: { user: UserEntity },
@Body() body: DeployTemplateDto,
@Query("acknowledgeResourceWarning") acknowledgeResourceWarning?: string,
): Promise<{
message: string;
template: string;
Expand Down Expand Up @@ -213,7 +218,9 @@ export class DeploymentsController {
return this.deploymentsService.schedulePreparedDeployment(
prepared,
Boolean(deploymentId),
{ skipResourceValidation: body.skipResourceValidation },
{
skipResourceValidation: acknowledgeResourceWarning === "true",
},
);
} catch (error) {
this.logger.error(
Expand All @@ -233,6 +240,7 @@ export class DeploymentsController {
@Req() req: { user: UserEntity },
@Param("deploymentId") deploymentId: string,
@Body() body: DeployTemplateDto,
@Query("acknowledgeResourceWarning") acknowledgeResourceWarning?: string,
): Promise<{
message: string;
template: string;
Expand All @@ -249,14 +257,18 @@ export class DeploymentsController {
);
}

return this.deploy(req, {
...body,
templateSlug: deployment.templateSlug,
deploymentId,
serverId: body.serverId ?? deployment.serverId ?? undefined,
deployOnLocal:
body.deployOnLocal ?? (!body.serverId && !deployment.serverId),
});
return this.deploy(
req,
{
...body,
templateSlug: deployment.templateSlug,
deploymentId,
serverId: body.serverId ?? deployment.serverId ?? undefined,
deployOnLocal:
body.deployOnLocal ?? (!body.serverId && !deployment.serverId),
},
acknowledgeResourceWarning,
);
} catch (error) {
this.logger.error(
`Redeploy failed: ${error instanceof Error ? error.message : String(error)}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,4 @@ export class DeployTemplateDto {
@IsOptional()
@IsBoolean()
useTraefik?: boolean;

/** When true, skip RAM/CPU availability checks for this deployment only. */
@IsOptional()
@IsBoolean()
skipResourceValidation?: boolean;
}
19 changes: 12 additions & 7 deletions console-app/src/features/deployments/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ function responseBody(response: { data: unknown }): Record<string, unknown> {
export async function deployTemplate(
input: DeployTemplateInput,
): Promise<DeployTemplateResult> {
const response = await apiClient.post("/deployments/compose", {
templateSlug: input.templateSlug,
serverId: input.serverId,
env: input.env ?? {},
ports: input.ports ?? {},
skipResourceValidation: input.skipResourceValidation,
});
const response = await apiClient.post(
"/deployments/compose",
{
templateSlug: input.templateSlug,
serverId: input.serverId,
env: input.env ?? {},
ports: input.ports ?? {},
},
input.acknowledgeResourceWarning
? { params: { acknowledgeResourceWarning: "true" } }
: undefined,
);
return unwrapServerApiData<DeployTemplateResult>(
responseBody(response),
"Failed to start deployment",
Expand Down
2 changes: 1 addition & 1 deletion console-app/src/features/deployments/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface DeployTemplateInput {
serverId: string;
env?: Record<string, string>;
ports?: Record<string, string>;
skipResourceValidation?: boolean;
acknowledgeResourceWarning?: boolean;
}

export type DeploymentResourceWarningCode =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function DeployConfigurationForm({
function proceedToDeployLogs(
env: Record<string, string>,
portValues: Record<string, string>,
skipResourceValidation = false,
acknowledgeResourceWarning = false,
) {
navigate(`/servers/${serverId}/deploy/${template.slug}/logs`, {
state: {
Expand All @@ -113,7 +113,7 @@ export function DeployConfigurationForm({
templateSlug: template.slug,
env,
ports: portValues,
skipResourceValidation,
acknowledgeResourceWarning,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion console-app/src/features/templates/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface DeployTemplateRequest {
templateSlug: string;
env: Record<string, string>;
ports?: Record<string, string>;
skipResourceValidation?: boolean;
acknowledgeResourceWarning?: boolean;
}

export interface DeployFormField {
Expand Down
4 changes: 2 additions & 2 deletions console-app/src/pages/deploy-logs-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { NotFoundPage } from "./not-found-page";
type PendingDeployLocationState = {
deployRequest?: Pick<
DeployTemplateRequest,
"env" | "ports" | "templateSlug" | "serverId" | "skipResourceValidation"
"env" | "ports" | "templateSlug" | "serverId" | "acknowledgeResourceWarning"
>;
};

Expand Down Expand Up @@ -109,7 +109,7 @@ export function DeployLogsPage() {
serverId,
env: pendingDeploy.env,
ports: pendingDeploy.ports,
skipResourceValidation: pendingDeploy.skipResourceValidation,
acknowledgeResourceWarning: pendingDeploy.acknowledgeResourceWarning,
})
.then((result) => {
if (cancelled) return;
Expand Down
Loading